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.
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_
8 #include "extensions/browser/api/guest_view/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"
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
{
18 class ChromeWebViewInternalContextMenusCreateFunction
19 : public AsyncExtensionFunction
{
21 DECLARE_EXTENSION_FUNCTION("chromeWebViewInternal.contextMenusCreate",
22 WEBVIEWINTERNAL_CONTEXTMENUSCREATE
);
23 ChromeWebViewInternalContextMenusCreateFunction() {}
26 ~ChromeWebViewInternalContextMenusCreateFunction() override
{}
28 // ExtensionFunction implementation.
29 bool RunAsync() override
;
32 DISALLOW_COPY_AND_ASSIGN(ChromeWebViewInternalContextMenusCreateFunction
);
35 class ChromeWebViewInternalContextMenusUpdateFunction
36 : public AsyncExtensionFunction
{
38 DECLARE_EXTENSION_FUNCTION("chromeWebViewInternal.contextMenusUpdate",
39 WEBVIEWINTERNAL_CONTEXTMENUSUPDATE
);
40 ChromeWebViewInternalContextMenusUpdateFunction() {}
43 ~ChromeWebViewInternalContextMenusUpdateFunction() override
{}
45 // ExtensionFunction implementation.
46 bool RunAsync() override
;
49 DISALLOW_COPY_AND_ASSIGN(ChromeWebViewInternalContextMenusUpdateFunction
);
52 class ChromeWebViewInternalContextMenusRemoveFunction
53 : public AsyncExtensionFunction
{
55 DECLARE_EXTENSION_FUNCTION("chromeWebViewInternal.contextMenusRemove",
56 WEBVIEWINTERNAL_CONTEXTMENUSREMOVE
);
57 ChromeWebViewInternalContextMenusRemoveFunction() {}
60 ~ChromeWebViewInternalContextMenusRemoveFunction() override
{}
62 // ExtensionFunction implementation.
63 bool RunAsync() override
;
66 DISALLOW_COPY_AND_ASSIGN(ChromeWebViewInternalContextMenusRemoveFunction
);
69 class ChromeWebViewInternalContextMenusRemoveAllFunction
70 : public AsyncExtensionFunction
{
72 DECLARE_EXTENSION_FUNCTION("chromeWebViewInternal.contextMenusRemoveAll",
73 WEBVIEWINTERNAL_CONTEXTMENUSREMOVEALL
);
74 ChromeWebViewInternalContextMenusRemoveAllFunction() {}
77 ~ChromeWebViewInternalContextMenusRemoveAllFunction() override
{}
79 // ExtensionFunction implementation.
80 bool RunAsync() override
;
83 DISALLOW_COPY_AND_ASSIGN(ChromeWebViewInternalContextMenusRemoveAllFunction
);
86 class ChromeWebViewInternalShowContextMenuFunction
87 : public WebViewInternalExtensionFunction
{
89 DECLARE_EXTENSION_FUNCTION("chromeWebViewInternal.showContextMenu",
90 WEBVIEWINTERNAL_SHOWCONTEXTMENU
);
92 ChromeWebViewInternalShowContextMenuFunction();
95 ~ChromeWebViewInternalShowContextMenuFunction() override
;
98 // WebViewInternalExtensionFunction implementation.
99 bool RunAsyncSafe(WebViewGuest
* guest
) override
;
101 DISALLOW_COPY_AND_ASSIGN(ChromeWebViewInternalShowContextMenuFunction
);
104 } // namespace extensions
106 #endif // CHROME_BROWSER_EXTENSIONS_API_WEB_VIEW_CHROME_WEB_VIEW_INTERNAL_API_H_