Upstream version 10.39.225.0
[platform/framework/web/crosswalk.git] / src / chrome / browser / extensions / api / web_view / chrome_web_view_internal_api.h
1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #ifndef CHROME_BROWSER_EXTENSIONS_API_WEB_VIEW_CHROME_WEB_VIEW_INTERNAL_API_H_
6 #define CHROME_BROWSER_EXTENSIONS_API_WEB_VIEW_CHROME_WEB_VIEW_INTERNAL_API_H_
7
8 #include "extensions/browser/api/web_view/web_view_internal_api.h"
9 #include "extensions/browser/extension_function.h"
10 #include "extensions/browser/guest_view/web_view/web_view_guest.h"
11
12 // WARNING: *WebViewInternal could be loaded in an unblessed context, thus any
13 // new APIs must extend WebViewInternalExtensionFunction or
14 // WebViewInternalExecuteCodeFunction which do a process ID check to prevent
15 // abuse by normal renderer processes.
16 namespace extensions {
17
18 class ChromeWebViewInternalContextMenusCreateFunction
19     : public AsyncExtensionFunction {
20  public:
21   DECLARE_EXTENSION_FUNCTION("chromeWebViewInternal.contextMenusCreate",
22                              WEBVIEWINTERNAL_CONTEXTMENUSCREATE);
23   ChromeWebViewInternalContextMenusCreateFunction() {}
24
25  protected:
26   virtual ~ChromeWebViewInternalContextMenusCreateFunction() {}
27
28   // ExtensionFunction implementation.
29   virtual bool RunAsync() OVERRIDE;
30
31  private:
32   DISALLOW_COPY_AND_ASSIGN(ChromeWebViewInternalContextMenusCreateFunction);
33 };
34
35 class ChromeWebViewInternalContextMenusUpdateFunction
36     : public AsyncExtensionFunction {
37  public:
38   DECLARE_EXTENSION_FUNCTION("chromeWebViewInternal.contextMenusUpdate",
39                              WEBVIEWINTERNAL_CONTEXTMENUSUPDATE);
40   ChromeWebViewInternalContextMenusUpdateFunction() {}
41
42  protected:
43   virtual ~ChromeWebViewInternalContextMenusUpdateFunction() {}
44
45   // ExtensionFunction implementation.
46   virtual bool RunAsync() OVERRIDE;
47
48  private:
49   DISALLOW_COPY_AND_ASSIGN(ChromeWebViewInternalContextMenusUpdateFunction);
50 };
51
52 class ChromeWebViewInternalContextMenusRemoveFunction
53     : public AsyncExtensionFunction {
54  public:
55   DECLARE_EXTENSION_FUNCTION("chromeWebViewInternal.contextMenusRemove",
56                              WEBVIEWINTERNAL_CONTEXTMENUSREMOVE);
57   ChromeWebViewInternalContextMenusRemoveFunction() {}
58
59  protected:
60   virtual ~ChromeWebViewInternalContextMenusRemoveFunction() {}
61
62   // ExtensionFunction implementation.
63   virtual bool RunAsync() OVERRIDE;
64
65  private:
66   DISALLOW_COPY_AND_ASSIGN(ChromeWebViewInternalContextMenusRemoveFunction);
67 };
68
69 class ChromeWebViewInternalContextMenusRemoveAllFunction
70     : public AsyncExtensionFunction {
71  public:
72   DECLARE_EXTENSION_FUNCTION("chromeWebViewInternal.contextMenusRemoveAll",
73                              WEBVIEWINTERNAL_CONTEXTMENUSREMOVEALL);
74   ChromeWebViewInternalContextMenusRemoveAllFunction() {}
75
76  protected:
77   virtual ~ChromeWebViewInternalContextMenusRemoveAllFunction() {}
78
79   // ExtensionFunction implementation.
80   virtual bool RunAsync() OVERRIDE;
81
82  private:
83   DISALLOW_COPY_AND_ASSIGN(ChromeWebViewInternalContextMenusRemoveAllFunction);
84 };
85
86 class ChromeWebViewInternalShowContextMenuFunction
87     : public WebViewInternalExtensionFunction {
88  public:
89   DECLARE_EXTENSION_FUNCTION("chromeWebViewInternal.showContextMenu",
90                              WEBVIEWINTERNAL_SHOWCONTEXTMENU);
91
92   ChromeWebViewInternalShowContextMenuFunction();
93
94  protected:
95   virtual ~ChromeWebViewInternalShowContextMenuFunction();
96
97  private:
98   // WebViewInternalExtensionFunction implementation.
99   virtual bool RunAsyncSafe(WebViewGuest* guest) OVERRIDE;
100
101   DISALLOW_COPY_AND_ASSIGN(ChromeWebViewInternalShowContextMenuFunction);
102 };
103
104 }  // namespace extensions
105
106 #endif  // CHROME_BROWSER_EXTENSIONS_API_WEB_VIEW_CHROME_WEB_VIEW_INTERNAL_API_H_