522961a7e96c5364a3b31c97dbba07912bc8bf26
[platform/framework/web/crosswalk-tizen.git] / atom / common / native_mate_converters / content_converter.h
1 // Copyright (c) 2015 GitHub, Inc.
2 // Use of this source code is governed by the MIT license that can be
3 // found in the LICENSE file.
4
5 #ifndef ATOM_COMMON_NATIVE_MATE_CONVERTERS_CONTENT_CONVERTER_H_
6 #define ATOM_COMMON_NATIVE_MATE_CONVERTERS_CONTENT_CONVERTER_H_
7
8 #include <utility>
9
10 #include "content/public/browser/permission_type.h"
11 #include "content/public/common/menu_item.h"
12 #include "content/public/common/stop_find_action.h"
13 #include "third_party/WebKit/public/platform/modules/permissions/permission_status.mojom.h"
14 #include "native_mate/converter.h"
15
16 namespace content {
17 struct ContextMenuParams;
18 class WebContents;
19 }
20
21 using ContextMenuParamsWithWebContents =
22     std::pair<content::ContextMenuParams, content::WebContents*>;
23
24 namespace mate {
25
26 template<>
27 struct Converter<content::MenuItem::Type> {
28   static v8::Local<v8::Value> ToV8(v8::Isolate* isolate,
29                                    const content::MenuItem::Type& val);
30 };
31
32 template<>
33 struct Converter<ContextMenuParamsWithWebContents> {
34   static v8::Local<v8::Value> ToV8(v8::Isolate* isolate,
35                                    const ContextMenuParamsWithWebContents& val);
36 };
37
38 template<>
39 struct Converter<blink::mojom::PermissionStatus> {
40   static bool FromV8(v8::Isolate* isolate, v8::Local<v8::Value> val,
41                      blink::mojom::PermissionStatus* out);
42 };
43
44 template<>
45 struct Converter<content::PermissionType> {
46   static v8::Local<v8::Value> ToV8(v8::Isolate* isolate,
47                                    const content::PermissionType& val);
48 };
49
50 template<>
51 struct Converter<content::StopFindAction> {
52   static bool FromV8(v8::Isolate* isolate, v8::Local<v8::Value> val,
53                      content::StopFindAction* out);
54 };
55
56 template<>
57 struct Converter<content::WebContents*> {
58   static v8::Local<v8::Value> ToV8(v8::Isolate* isolate,
59                                    content::WebContents* val);
60   static bool FromV8(v8::Isolate* isolate, v8::Local<v8::Value> val,
61                      content::WebContents** out);
62 };
63
64 }  // namespace mate
65
66 #endif  // ATOM_COMMON_NATIVE_MATE_CONVERTERS_CONTENT_CONVERTER_H_