Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(5088)

Unified Diff: chrome/browser/extensions/api/web_view/web_view_internal_api.h

Issue 541753004: Split web_view_internal_api and move part of it to extensions. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/extensions/api/web_view/web_view_internal_api.h
diff --git a/chrome/browser/extensions/api/web_view/web_view_internal_api.h b/chrome/browser/extensions/api/web_view/web_view_internal_api.h
deleted file mode 100644
index cef54351c04308be400d562a7cbd914767dfa2d7..0000000000000000000000000000000000000000
--- a/chrome/browser/extensions/api/web_view/web_view_internal_api.h
+++ /dev/null
@@ -1,442 +0,0 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef CHROME_BROWSER_EXTENSIONS_API_WEB_VIEW_WEB_VIEW_INTERNAL_API_H_
-#define CHROME_BROWSER_EXTENSIONS_API_WEB_VIEW_WEB_VIEW_INTERNAL_API_H_
-
-#include "extensions/browser/api/capture_web_contents_function.h"
-#include "extensions/browser/api/execute_code_function.h"
-#include "extensions/browser/extension_function.h"
-#include "extensions/browser/guest_view/web_view/web_view_guest.h"
-
-// WARNING: WebViewInternal could be loaded in an unblessed context, thus any
-// new APIs must extend WebViewInternalExtensionFunction or
-// WebViewInternalExecuteCodeFunction which do a process ID check to prevent
-// abuse by normal renderer processes.
-// TODO(guohui): refactor WebViewInternalExecuteCodeFunction to also extend
-// WebViewInternalExtensionFunction.
-namespace extensions {
-
-// An abstract base class for async webview APIs. It does a process ID check
-// in RunAsync, and then calls RunAsyncSafe which must be overriden by all
-// subclasses.
-class WebViewInternalExtensionFunction : public AsyncExtensionFunction {
- public:
- WebViewInternalExtensionFunction() {}
-
- protected:
- virtual ~WebViewInternalExtensionFunction() {}
-
- // ExtensionFunction implementation.
- virtual bool RunAsync() OVERRIDE FINAL;
-
- private:
- virtual bool RunAsyncSafe(WebViewGuest* guest) = 0;
-};
-
-class WebViewInternalContextMenusCreateFunction
- : public AsyncExtensionFunction {
- public:
- DECLARE_EXTENSION_FUNCTION("webViewInternal.contextMenusCreate",
- WEBVIEWINTERNAL_CONTEXTMENUSCREATE);
- WebViewInternalContextMenusCreateFunction() {}
-
- protected:
- virtual ~WebViewInternalContextMenusCreateFunction() {}
-
- // ExtensionFunction implementation.
- virtual bool RunAsync() OVERRIDE;
-
- private:
- DISALLOW_COPY_AND_ASSIGN(WebViewInternalContextMenusCreateFunction);
-};
-
-class WebViewInternalContextMenusUpdateFunction
- : public AsyncExtensionFunction {
- public:
- DECLARE_EXTENSION_FUNCTION("webViewInternal.contextMenusUpdate",
- WEBVIEWINTERNAL_CONTEXTMENUSUPDATE);
- WebViewInternalContextMenusUpdateFunction() {}
-
- protected:
- virtual ~WebViewInternalContextMenusUpdateFunction() {}
-
- // ExtensionFunction implementation.
- virtual bool RunAsync() OVERRIDE;
-
- private:
- DISALLOW_COPY_AND_ASSIGN(WebViewInternalContextMenusUpdateFunction);
-};
-
-class WebViewInternalContextMenusRemoveFunction
- : public AsyncExtensionFunction {
- public:
- DECLARE_EXTENSION_FUNCTION("webViewInternal.contextMenusRemove",
- WEBVIEWINTERNAL_CONTEXTMENUSREMOVE);
- WebViewInternalContextMenusRemoveFunction() {}
-
- protected:
- virtual ~WebViewInternalContextMenusRemoveFunction() {}
-
- // ExtensionFunction implementation.
- virtual bool RunAsync() OVERRIDE;
-
- private:
- DISALLOW_COPY_AND_ASSIGN(WebViewInternalContextMenusRemoveFunction);
-};
-
-class WebViewInternalContextMenusRemoveAllFunction
- : public AsyncExtensionFunction {
- public:
- DECLARE_EXTENSION_FUNCTION("webViewInternal.contextMenusRemoveAll",
- WEBVIEWINTERNAL_CONTEXTMENUSREMOVEALL);
- WebViewInternalContextMenusRemoveAllFunction() {}
-
- protected:
- virtual ~WebViewInternalContextMenusRemoveAllFunction() {}
-
- // ExtensionFunction implementation.
- virtual bool RunAsync() OVERRIDE;
-
- private:
- DISALLOW_COPY_AND_ASSIGN(WebViewInternalContextMenusRemoveAllFunction);
-};
-
-class WebViewInternalNavigateFunction
- : public WebViewInternalExtensionFunction {
- public:
- DECLARE_EXTENSION_FUNCTION("webViewInternal.navigate",
- WEBVIEWINTERNAL_NAVIGATE);
- WebViewInternalNavigateFunction() {}
-
- protected:
- virtual ~WebViewInternalNavigateFunction() {}
-
- private:
- // WebViewInternalExtensionFunction implementation.
- virtual bool RunAsyncSafe(WebViewGuest* guest) OVERRIDE;
-
- DISALLOW_COPY_AND_ASSIGN(WebViewInternalNavigateFunction);
-};
-
-class WebViewInternalClearDataFunction
- : public WebViewInternalExtensionFunction {
- public:
- DECLARE_EXTENSION_FUNCTION("webViewInternal.clearData",
- WEBVIEWINTERNAL_CLEARDATA);
-
- WebViewInternalClearDataFunction();
-
- protected:
- virtual ~WebViewInternalClearDataFunction();
-
- private:
- // WebViewInternalExtensionFunction implementation.
- virtual bool RunAsyncSafe(WebViewGuest* guest) OVERRIDE;
-
- uint32 GetRemovalMask();
- void ClearDataDone();
-
- // Removal start time.
- base::Time remove_since_;
- // Removal mask, corresponds to StoragePartition::RemoveDataMask enum.
- uint32 remove_mask_;
- // Tracks any data related or parse errors.
- bool bad_message_;
-
- DISALLOW_COPY_AND_ASSIGN(WebViewInternalClearDataFunction);
-};
-
-class WebViewInternalExecuteCodeFunction
- : public extensions::ExecuteCodeFunction<AsyncExtensionFunction> {
- public:
- WebViewInternalExecuteCodeFunction();
-
- protected:
- virtual ~WebViewInternalExecuteCodeFunction();
-
- // Initialize |details_| if it hasn't already been.
- virtual bool Init() OVERRIDE;
- virtual bool ShouldInsertCSS() const OVERRIDE;
- virtual bool CanExecuteScriptOnPage() OVERRIDE;
- // Guarded by a process ID check.
- virtual extensions::ScriptExecutor* GetScriptExecutor() OVERRIDE FINAL;
- virtual bool IsWebView() const OVERRIDE;
- virtual const GURL& GetWebViewSrc() const OVERRIDE;
-
- private:
- // Contains extension resource built from path of file which is
- // specified in JSON arguments.
- extensions::ExtensionResource resource_;
-
- int guest_instance_id_;
-
- GURL guest_src_;
-
- DISALLOW_COPY_AND_ASSIGN(WebViewInternalExecuteCodeFunction);
-};
-
-class WebViewInternalExecuteScriptFunction
- : public WebViewInternalExecuteCodeFunction {
- public:
- WebViewInternalExecuteScriptFunction();
-
- protected:
- virtual ~WebViewInternalExecuteScriptFunction() {}
-
- virtual void OnExecuteCodeFinished(const std::string& error,
- const GURL& on_url,
- const base::ListValue& result) OVERRIDE;
-
- DECLARE_EXTENSION_FUNCTION("webViewInternal.executeScript",
- WEBVIEWINTERNAL_EXECUTESCRIPT)
-
- private:
- DISALLOW_COPY_AND_ASSIGN(WebViewInternalExecuteScriptFunction);
-};
-
-class WebViewInternalInsertCSSFunction
- : public WebViewInternalExecuteCodeFunction {
- public:
- WebViewInternalInsertCSSFunction();
-
- protected:
- virtual ~WebViewInternalInsertCSSFunction() {}
-
- virtual bool ShouldInsertCSS() const OVERRIDE;
-
- DECLARE_EXTENSION_FUNCTION("webViewInternal.insertCSS",
- WEBVIEWINTERNAL_INSERTCSS)
-
- private:
- DISALLOW_COPY_AND_ASSIGN(WebViewInternalInsertCSSFunction);
-};
-
-class WebViewInternalCaptureVisibleRegionFunction
- : public extensions::CaptureWebContentsFunction<AsyncExtensionFunction> {
- DECLARE_EXTENSION_FUNCTION("webViewInternal.captureVisibleRegion",
- WEBVIEWINTERNAL_CAPTUREVISIBLEREGION);
-
- WebViewInternalCaptureVisibleRegionFunction();
-
- protected:
- virtual ~WebViewInternalCaptureVisibleRegionFunction();
-
- private:
- // extensions::CaptureWebContentsFunction implementation.
- virtual bool IsScreenshotEnabled() OVERRIDE;
- virtual content::WebContents* GetWebContentsForID(int id) OVERRIDE;
- virtual void OnCaptureFailure(FailureReason reason) OVERRIDE;
-
- DISALLOW_COPY_AND_ASSIGN(WebViewInternalCaptureVisibleRegionFunction);
-};
-
-class WebViewInternalSetNameFunction : public WebViewInternalExtensionFunction {
- public:
- DECLARE_EXTENSION_FUNCTION("webViewInternal.setName",
- WEBVIEWINTERNAL_SETNAME);
-
- WebViewInternalSetNameFunction();
-
- protected:
- virtual ~WebViewInternalSetNameFunction();
-
- private:
- virtual bool RunAsyncSafe(WebViewGuest* guest) OVERRIDE;
-
- DISALLOW_COPY_AND_ASSIGN(WebViewInternalSetNameFunction);
-};
-
-class WebViewInternalSetZoomFunction : public WebViewInternalExtensionFunction {
- public:
- DECLARE_EXTENSION_FUNCTION("webViewInternal.setZoom",
- WEBVIEWINTERNAL_SETZOOM);
-
- WebViewInternalSetZoomFunction();
-
- protected:
- virtual ~WebViewInternalSetZoomFunction();
-
- private:
- virtual bool RunAsyncSafe(WebViewGuest* guest) OVERRIDE;
-
- DISALLOW_COPY_AND_ASSIGN(WebViewInternalSetZoomFunction);
-};
-
-class WebViewInternalGetZoomFunction : public WebViewInternalExtensionFunction {
- public:
- DECLARE_EXTENSION_FUNCTION("webViewInternal.getZoom",
- WEBVIEWINTERNAL_GETZOOM);
-
- WebViewInternalGetZoomFunction();
-
- protected:
- virtual ~WebViewInternalGetZoomFunction();
-
- private:
- virtual bool RunAsyncSafe(WebViewGuest* guest) OVERRIDE;
-
- DISALLOW_COPY_AND_ASSIGN(WebViewInternalGetZoomFunction);
-};
-
-class WebViewInternalFindFunction : public WebViewInternalExtensionFunction {
- public:
- DECLARE_EXTENSION_FUNCTION("webViewInternal.find", WEBVIEWINTERNAL_FIND);
-
- WebViewInternalFindFunction();
-
- // Exposes SendResponse() for use by WebViewInternalFindHelper.
- using WebViewInternalExtensionFunction::SendResponse;
-
- protected:
- virtual ~WebViewInternalFindFunction();
-
- private:
- // WebViewInternalExtensionFunction implementation.
- virtual bool RunAsyncSafe(WebViewGuest* guest) OVERRIDE;
-
- DISALLOW_COPY_AND_ASSIGN(WebViewInternalFindFunction);
-};
-
-class WebViewInternalStopFindingFunction
- : public WebViewInternalExtensionFunction {
- public:
- DECLARE_EXTENSION_FUNCTION("webViewInternal.stopFinding",
- WEBVIEWINTERNAL_STOPFINDING);
-
- WebViewInternalStopFindingFunction();
-
- protected:
- virtual ~WebViewInternalStopFindingFunction();
-
- private:
- // WebViewInternalExtensionFunction implementation.
- virtual bool RunAsyncSafe(WebViewGuest* guest) OVERRIDE;
-
- DISALLOW_COPY_AND_ASSIGN(WebViewInternalStopFindingFunction);
-};
-
-class WebViewInternalGoFunction : public WebViewInternalExtensionFunction {
- public:
- DECLARE_EXTENSION_FUNCTION("webViewInternal.go", WEBVIEWINTERNAL_GO);
-
- WebViewInternalGoFunction();
-
- protected:
- virtual ~WebViewInternalGoFunction();
-
- private:
- // WebViewInternalExtensionFunction implementation.
- virtual bool RunAsyncSafe(WebViewGuest* guest) OVERRIDE;
-
- DISALLOW_COPY_AND_ASSIGN(WebViewInternalGoFunction);
-};
-
-class WebViewInternalReloadFunction : public WebViewInternalExtensionFunction {
- public:
- DECLARE_EXTENSION_FUNCTION("webViewInternal.reload", WEBVIEWINTERNAL_RELOAD);
-
- WebViewInternalReloadFunction();
-
- protected:
- virtual ~WebViewInternalReloadFunction();
-
- private:
- // WebViewInternalExtensionFunction implementation.
- virtual bool RunAsyncSafe(WebViewGuest* guest) OVERRIDE;
-
- DISALLOW_COPY_AND_ASSIGN(WebViewInternalReloadFunction);
-};
-
-class WebViewInternalSetPermissionFunction
- : public WebViewInternalExtensionFunction {
- public:
- DECLARE_EXTENSION_FUNCTION("webViewInternal.setPermission",
- WEBVIEWINTERNAL_SETPERMISSION);
-
- WebViewInternalSetPermissionFunction();
-
- protected:
- virtual ~WebViewInternalSetPermissionFunction();
-
- private:
- // WebViewInternalExtensionFunction implementation.
- virtual bool RunAsyncSafe(WebViewGuest* guest) OVERRIDE;
-
- DISALLOW_COPY_AND_ASSIGN(WebViewInternalSetPermissionFunction);
-};
-
-class WebViewInternalShowContextMenuFunction
- : public WebViewInternalExtensionFunction {
- public:
- DECLARE_EXTENSION_FUNCTION("webViewInternal.showContextMenu",
- WEBVIEWINTERNAL_SHOWCONTEXTMENU);
-
- WebViewInternalShowContextMenuFunction();
-
- protected:
- virtual ~WebViewInternalShowContextMenuFunction();
-
- private:
- // WebViewInternalExtensionFunction implementation.
- virtual bool RunAsyncSafe(WebViewGuest* guest) OVERRIDE;
-
- DISALLOW_COPY_AND_ASSIGN(WebViewInternalShowContextMenuFunction);
-};
-
-class WebViewInternalOverrideUserAgentFunction
- : public WebViewInternalExtensionFunction {
- public:
- DECLARE_EXTENSION_FUNCTION("webViewInternal.overrideUserAgent",
- WEBVIEWINTERNAL_OVERRIDEUSERAGENT);
-
- WebViewInternalOverrideUserAgentFunction();
-
- protected:
- virtual ~WebViewInternalOverrideUserAgentFunction();
-
- private:
- // WebViewInternalExtensionFunction implementation.
- virtual bool RunAsyncSafe(WebViewGuest* guest) OVERRIDE;
-
- DISALLOW_COPY_AND_ASSIGN(WebViewInternalOverrideUserAgentFunction);
-};
-
-class WebViewInternalStopFunction : public WebViewInternalExtensionFunction {
- public:
- DECLARE_EXTENSION_FUNCTION("webViewInternal.stop", WEBVIEWINTERNAL_STOP);
-
- WebViewInternalStopFunction();
-
- protected:
- virtual ~WebViewInternalStopFunction();
-
- private:
- // WebViewInternalExtensionFunction implementation.
- virtual bool RunAsyncSafe(WebViewGuest* guest) OVERRIDE;
-
- DISALLOW_COPY_AND_ASSIGN(WebViewInternalStopFunction);
-};
-
-class WebViewInternalTerminateFunction
- : public WebViewInternalExtensionFunction {
- public:
- DECLARE_EXTENSION_FUNCTION("webViewInternal.terminate",
- WEBVIEWINTERNAL_TERMINATE);
-
- WebViewInternalTerminateFunction();
-
- protected:
- virtual ~WebViewInternalTerminateFunction();
-
- private:
- // WebViewInternalExtensionFunction implementation.
- virtual bool RunAsyncSafe(WebViewGuest* guest) OVERRIDE;
-
- DISALLOW_COPY_AND_ASSIGN(WebViewInternalTerminateFunction);
-};
-
-} // namespace extensions
-
-#endif // CHROME_BROWSER_EXTENSIONS_API_WEB_VIEW_WEB_VIEW_INTERNAL_API_H_

Powered by Google App Engine
This is Rietveld 408576698