diff options
author | lazyboy@chromium.org <lazyboy@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-06-25 18:03:18 +0000 |
---|---|---|
committer | lazyboy@chromium.org <lazyboy@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-06-25 18:03:18 +0000 |
commit | ab0464f76fe2825956bd196bf0a9a60baca97b1f (patch) | |
tree | 912b0b8051eb29243adf774ba0194ea0fd27982e /chrome | |
parent | 17ffd7f672e80546ec142d611e4146a8f61019af (diff) | |
download | chromium_src-ab0464f76fe2825956bd196bf0a9a60baca97b1f.zip chromium_src-ab0464f76fe2825956bd196bf0a9a60baca97b1f.tar.gz chromium_src-ab0464f76fe2825956bd196bf0a9a60baca97b1f.tar.bz2 |
Revert 279748 "Rename webview API related files to web_view_inte..."
> Rename webview API related files to web_view_internal.
> webview.json -> web_view_internal.json
>
> NOTRY=True
> BUG=388380
> Test=Internal cleanup, no visible change.
>
> Review URL: https://codereview.chromium.org/347143004
TBR=lazyboy@chromium.org
Review URL: https://codereview.chromium.org/351033006
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@279755 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome')
28 files changed, 660 insertions, 719 deletions
diff --git a/chrome/browser/extensions/api/declarative/declarative_api.cc b/chrome/browser/extensions/api/declarative/declarative_api.cc index 9967de4..f53ead1 100644 --- a/chrome/browser/extensions/api/declarative/declarative_api.cc +++ b/chrome/browser/extensions/api/declarative/declarative_api.cc @@ -9,7 +9,6 @@ #include "base/task_runner_util.h" #include "base/values.h" #include "chrome/browser/extensions/api/declarative/rules_registry_service.h" -#include "chrome/browser/guest_view/web_view/web_view_constants.h" #include "chrome/browser/guest_view/web_view/web_view_guest.h" #include "chrome/browser/profiles/profile.h" #include "chrome/common/extensions/api/events.h" @@ -32,23 +31,20 @@ namespace extensions { namespace { const char kWebRequest[] = "declarativeWebRequest."; +const char kWebView[] = "webview."; const char kWebViewExpectedError[] = "Webview event with Webview ID expected."; bool IsWebViewEvent(const std::string& event_name) { // Sample event names: - // webViewInternal.onRequest. - // webViewInternal.onMessage. - return event_name.compare(0, - strlen(webview::kWebViewEventPrefix), - webview::kWebViewEventPrefix) == 0; + // webview.onRequest. + // webview.OnMessage. + return event_name.compare(0, strlen(kWebView), kWebView) == 0; } std::string GetWebRequestEventName(const std::string& event_name) { std::string web_request_event_name(event_name); - if (IsWebViewEvent(web_request_event_name)) { - web_request_event_name.replace( - 0, strlen(webview::kWebViewEventPrefix), kWebRequest); - } + if (IsWebViewEvent(web_request_event_name)) + web_request_event_name.replace(0, strlen(kWebView), kWebRequest); return web_request_event_name; } diff --git a/chrome/browser/extensions/api/web_request/web_request_api.cc b/chrome/browser/extensions/api/web_request/web_request_api.cc index 4a192bb..5560282 100644 --- a/chrome/browser/extensions/api/web_request/web_request_api.cc +++ b/chrome/browser/extensions/api/web_request/web_request_api.cc @@ -92,7 +92,8 @@ namespace activitylog = activity_log_web_request_constants; namespace { -const char kWebRequestEventPrefix[] = "webRequest."; +const char kWebRequest[] = "webRequest"; +const char kWebView[] = "webview"; // List of all the webRequest events. const char* const kWebRequestEvents[] = { @@ -139,11 +140,8 @@ const char* GetRequestStageAsString( bool IsWebRequestEvent(const std::string& event_name) { std::string web_request_event_name(event_name); - if (StartsWithASCII( - web_request_event_name, webview::kWebViewEventPrefix, true)) { - web_request_event_name.replace( - 0, strlen(webview::kWebViewEventPrefix), kWebRequestEventPrefix); - } + if (web_request_event_name.find(kWebView) != std::string::npos) + web_request_event_name.replace(0, sizeof(kWebView) - 1, kWebRequest); return std::find(kWebRequestEvents, ARRAYEND(kWebRequestEvents), web_request_event_name) != ARRAYEND(kWebRequestEvents); } @@ -456,8 +454,7 @@ WebRequestAPI::WebRequestAPI(content::BrowserContext* context) event_router->RegisterObserver(this, event_name); // Also observe the corresponding webview event. - event_name.replace( - 0, sizeof(kWebRequestEventPrefix) - 1, webview::kWebViewEventPrefix); + event_name.replace(0, sizeof(kWebRequest) - 1, kWebView); event_router->RegisterObserver(this, event_name); } } @@ -1469,10 +1466,8 @@ void ExtensionWebRequestEventRouter::GetMatchingListenersImpl( ExtensionRendererState::WebViewInfo web_view_info; bool is_web_view_guest = ExtensionRendererState::GetInstance()-> GetWebViewInfo(render_process_host_id, routing_id, &web_view_info); - if (is_web_view_guest) { - web_request_event_name.replace( - 0, sizeof(kWebRequestEventPrefix) - 1, webview::kWebViewEventPrefix); - } + if (is_web_view_guest) + web_request_event_name.replace(0, sizeof(kWebRequest) - 1, kWebView); std::set<EventListener>& listeners = listeners_[profile][web_request_event_name]; 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 3ccf27d..0000000 --- a/chrome/browser/extensions/api/web_view/web_view_internal_api.h +++ /dev/null @@ -1,443 +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_WEBVIEW_WEB_VIEW_INTERNRAL_API_H_ -#define CHROME_BROWSER_EXTENSIONS_API_WEBVIEW_WEB_VIEW_INTERNRAL_API_H_ - -#include "chrome/browser/extensions/api/capture_web_contents_function.h" -#include "chrome/browser/extensions/api/execute_code_function.h" -#include "chrome/browser/guest_view/web_view/web_view_find_helper.h" -#include "chrome/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 { - 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, - int32 on_page_id, - 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 { - 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_WEBVIEW_WEB_VIEW_INTERNRAL_API_H_ diff --git a/chrome/browser/extensions/api/web_view/OWNERS b/chrome/browser/extensions/api/webview/OWNERS index 057dbdc..057dbdc 100644 --- a/chrome/browser/extensions/api/web_view/OWNERS +++ b/chrome/browser/extensions/api/webview/OWNERS diff --git a/chrome/browser/extensions/api/web_view/web_view_internal_api.cc b/chrome/browser/extensions/api/webview/webview_api.cc index 598c9ff..1f1f626 100644 --- a/chrome/browser/extensions/api/web_view/web_view_internal_api.cc +++ b/chrome/browser/extensions/api/webview/webview_api.cc @@ -1,8 +1,8 @@ -// Copyright 2014 The Chromium Authors. All rights reserved. +// Copyright (c) 2013 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. -#include "chrome/browser/extensions/api/web_view/web_view_internal_api.h" +#include "chrome/browser/extensions/api/webview/webview_api.h" #include "base/strings/utf_string_conversions.h" #include "chrome/browser/extensions/api/browsing_data/browsing_data_api.h" @@ -23,7 +23,7 @@ using content::WebContents; using extensions::api::tabs::InjectDetails; using extensions::api::webview::SetPermission::Params; namespace helpers = extensions::context_menus_api_helpers; -namespace webview = extensions::api::web_view_internal; +namespace webview = extensions::api::webview; namespace extensions { @@ -46,7 +46,7 @@ int MaskForKey(const char* key) { } // namespace -bool WebViewInternalExtensionFunction::RunAsync() { +bool WebviewExtensionFunction::RunAsync() { int instance_id = 0; EXTENSION_FUNCTION_VALIDATE(args_->GetInteger(0, &instance_id)); WebViewGuest* guest = WebViewGuest::From( @@ -58,8 +58,8 @@ bool WebViewInternalExtensionFunction::RunAsync() { } // TODO(lazyboy): Add checks similar to -// WebViewInternalExtensionFunction::RunAsyncSafe(WebViewGuest*). -bool WebViewInternalContextMenusCreateFunction::RunAsync() { +// WebviewExtensionFunction::RunAsyncSafe(WebViewGuest*). +bool WebviewContextMenusCreateFunction::RunAsync() { scoped_ptr<webview::ContextMenusCreate::Params> params( webview::ContextMenusCreate::Params::Create(*args_)); EXTENSION_FUNCTION_VALIDATE(params.get()); @@ -71,7 +71,7 @@ bool WebViewInternalContextMenusCreateFunction::RunAsync() { if (params->create_properties.id.get()) { id.string_uid = *params->create_properties.id; } else { - // The Generated Id is added by web_view_internal_custom_bindings.js. + // The Generated Id is added by webview_custom_bindings.js. base::DictionaryValue* properties = NULL; EXTENSION_FUNCTION_VALIDATE(args_->GetDictionary(1, &properties)); EXTENSION_FUNCTION_VALIDATE( @@ -89,7 +89,7 @@ bool WebViewInternalContextMenusCreateFunction::RunAsync() { return success; } -bool WebViewInternalNavigateFunction::RunAsyncSafe(WebViewGuest* guest) { +bool WebviewNavigateFunction::RunAsyncSafe(WebViewGuest* guest) { scoped_ptr<webview::Navigate::Params> params( webview::Navigate::Params::Create(*args_)); EXTENSION_FUNCTION_VALIDATE(params.get()); @@ -98,7 +98,7 @@ bool WebViewInternalNavigateFunction::RunAsyncSafe(WebViewGuest* guest) { return true; } -bool WebViewInternalContextMenusUpdateFunction::RunAsync() { +bool WebviewContextMenusUpdateFunction::RunAsync() { scoped_ptr<webview::ContextMenusUpdate::Params> params( webview::ContextMenusUpdate::Params::Create(*args_)); EXTENSION_FUNCTION_VALIDATE(params.get()); @@ -121,7 +121,7 @@ bool WebViewInternalContextMenusUpdateFunction::RunAsync() { return success; } -bool WebViewInternalContextMenusRemoveFunction::RunAsync() { +bool WebviewContextMenusRemoveFunction::RunAsync() { scoped_ptr<webview::ContextMenusRemove::Params> params( webview::ContextMenusRemove::Params::Create(*args_)); EXTENSION_FUNCTION_VALIDATE(params.get()); @@ -157,7 +157,7 @@ bool WebViewInternalContextMenusRemoveFunction::RunAsync() { return success; } -bool WebViewInternalContextMenusRemoveAllFunction::RunAsync() { +bool WebviewContextMenusRemoveAllFunction::RunAsync() { scoped_ptr<webview::ContextMenusRemoveAll::Params> params( webview::ContextMenusRemoveAll::Params::Create(*args_)); EXTENSION_FUNCTION_VALIDATE(params.get()); @@ -172,17 +172,15 @@ bool WebViewInternalContextMenusRemoveAllFunction::RunAsync() { return true; } -WebViewInternalClearDataFunction::WebViewInternalClearDataFunction() - : remove_mask_(0), bad_message_(false) { -} +WebviewClearDataFunction::WebviewClearDataFunction() + : remove_mask_(0), bad_message_(false) {} -WebViewInternalClearDataFunction::~WebViewInternalClearDataFunction() { -} +WebviewClearDataFunction::~WebviewClearDataFunction() {} // Parses the |dataToRemove| argument to generate the remove mask. Sets // |bad_message_| (like EXTENSION_FUNCTION_VALIDATE would if this were a bool // method) if 'dataToRemove' is not present. -uint32 WebViewInternalClearDataFunction::GetRemovalMask() { +uint32 WebviewClearDataFunction::GetRemovalMask() { base::DictionaryValue* data_to_remove; if (!args_->GetDictionary(2, &data_to_remove)) { bad_message_ = true; @@ -190,7 +188,8 @@ uint32 WebViewInternalClearDataFunction::GetRemovalMask() { } uint32 remove_mask = 0; - for (base::DictionaryValue::Iterator i(*data_to_remove); !i.IsAtEnd(); + for (base::DictionaryValue::Iterator i(*data_to_remove); + !i.IsAtEnd(); i.Advance()) { bool selected = false; if (!i.value().GetAsBoolean(&selected)) { @@ -206,7 +205,7 @@ uint32 WebViewInternalClearDataFunction::GetRemovalMask() { // TODO(lazyboy): Parameters in this extension function are similar (or a // sub-set) to BrowsingDataRemoverFunction. How can we share this code? -bool WebViewInternalClearDataFunction::RunAsyncSafe(WebViewGuest* guest) { +bool WebviewClearDataFunction::RunAsyncSafe(WebViewGuest* guest) { // Grab the initial |options| parameter, and parse out the arguments. base::DictionaryValue* options; EXTENSION_FUNCTION_VALIDATE(args_->GetDictionary(1, &options)); @@ -223,22 +222,23 @@ bool WebViewInternalClearDataFunction::RunAsyncSafe(WebViewGuest* guest) { // gives developers milliseconds, so do a quick conversion before populating // the object. Also, Time::FromDoubleT converts double time 0 to empty Time // object. So we need to do special handling here. - remove_since_ = (ms_since_epoch == 0) - ? base::Time::UnixEpoch() - : base::Time::FromDoubleT(ms_since_epoch / 1000.0); + remove_since_ = (ms_since_epoch == 0) ? + base::Time::UnixEpoch() : + base::Time::FromDoubleT(ms_since_epoch / 1000.0); remove_mask_ = GetRemovalMask(); if (bad_message_) return false; - AddRef(); // Balanced below or in WebViewInternalClearDataFunction::Done(). + AddRef(); // Balanced below or in WebviewClearDataFunction::Done(). bool scheduled = false; if (remove_mask_) { scheduled = guest->ClearData( remove_since_, remove_mask_, - base::Bind(&WebViewInternalClearDataFunction::ClearDataDone, this)); + base::Bind(&WebviewClearDataFunction::ClearDataDone, + this)); } if (!remove_mask_ || !scheduled) { SendResponse(false); @@ -250,19 +250,18 @@ bool WebViewInternalClearDataFunction::RunAsyncSafe(WebViewGuest* guest) { return true; } -void WebViewInternalClearDataFunction::ClearDataDone() { +void WebviewClearDataFunction::ClearDataDone() { Release(); // Balanced in RunAsync(). SendResponse(true); } -WebViewInternalExecuteCodeFunction::WebViewInternalExecuteCodeFunction() - : guest_instance_id_(0), guest_src_(GURL::EmptyGURL()) { -} +WebviewExecuteCodeFunction::WebviewExecuteCodeFunction() + : guest_instance_id_(0), guest_src_(GURL::EmptyGURL()) {} -WebViewInternalExecuteCodeFunction::~WebViewInternalExecuteCodeFunction() { +WebviewExecuteCodeFunction::~WebviewExecuteCodeFunction() { } -bool WebViewInternalExecuteCodeFunction::Init() { +bool WebviewExecuteCodeFunction::Init() { if (details_.get()) return true; @@ -291,16 +290,15 @@ bool WebViewInternalExecuteCodeFunction::Init() { return true; } -bool WebViewInternalExecuteCodeFunction::ShouldInsertCSS() const { +bool WebviewExecuteCodeFunction::ShouldInsertCSS() const { return false; } -bool WebViewInternalExecuteCodeFunction::CanExecuteScriptOnPage() { +bool WebviewExecuteCodeFunction::CanExecuteScriptOnPage() { return true; } -extensions::ScriptExecutor* -WebViewInternalExecuteCodeFunction::GetScriptExecutor() { +extensions::ScriptExecutor* WebviewExecuteCodeFunction::GetScriptExecutor() { WebViewGuest* guest = WebViewGuest::From( render_view_host()->GetProcess()->GetID(), guest_instance_id_); if (!guest) @@ -309,72 +307,70 @@ WebViewInternalExecuteCodeFunction::GetScriptExecutor() { return guest->script_executor(); } -bool WebViewInternalExecuteCodeFunction::IsWebView() const { +bool WebviewExecuteCodeFunction::IsWebView() const { return true; } -const GURL& WebViewInternalExecuteCodeFunction::GetWebViewSrc() const { +const GURL& WebviewExecuteCodeFunction::GetWebViewSrc() const { return guest_src_; } -WebViewInternalExecuteScriptFunction::WebViewInternalExecuteScriptFunction() { +WebviewExecuteScriptFunction::WebviewExecuteScriptFunction() { } -void WebViewInternalExecuteScriptFunction::OnExecuteCodeFinished( +void WebviewExecuteScriptFunction::OnExecuteCodeFinished( const std::string& error, int32 on_page_id, const GURL& on_url, const base::ListValue& result) { if (error.empty()) SetResult(result.DeepCopy()); - WebViewInternalExecuteCodeFunction::OnExecuteCodeFinished( - error, on_page_id, on_url, result); + WebviewExecuteCodeFunction::OnExecuteCodeFinished(error, on_page_id, on_url, + result); } -WebViewInternalInsertCSSFunction::WebViewInternalInsertCSSFunction() { +WebviewInsertCSSFunction::WebviewInsertCSSFunction() { } -bool WebViewInternalInsertCSSFunction::ShouldInsertCSS() const { +bool WebviewInsertCSSFunction::ShouldInsertCSS() const { return true; } -WebViewInternalCaptureVisibleRegionFunction:: - WebViewInternalCaptureVisibleRegionFunction() { +WebviewCaptureVisibleRegionFunction::WebviewCaptureVisibleRegionFunction() { } -WebViewInternalCaptureVisibleRegionFunction:: - ~WebViewInternalCaptureVisibleRegionFunction() { +WebviewCaptureVisibleRegionFunction::~WebviewCaptureVisibleRegionFunction() { } -bool WebViewInternalCaptureVisibleRegionFunction::IsScreenshotEnabled() { +bool WebviewCaptureVisibleRegionFunction::IsScreenshotEnabled() { return true; } -WebContents* WebViewInternalCaptureVisibleRegionFunction::GetWebContentsForID( +WebContents* WebviewCaptureVisibleRegionFunction::GetWebContentsForID( int instance_id) { WebViewGuest* guest = WebViewGuest::From( render_view_host()->GetProcess()->GetID(), instance_id); return guest ? guest->guest_web_contents() : NULL; } -void WebViewInternalCaptureVisibleRegionFunction::OnCaptureFailure( +void WebviewCaptureVisibleRegionFunction::OnCaptureFailure( FailureReason reason) { SendResponse(false); } -WebViewInternalSetNameFunction::WebViewInternalSetNameFunction() { +WebviewSetNameFunction::WebviewSetNameFunction() { } -WebViewInternalSetNameFunction::~WebViewInternalSetNameFunction() { +WebviewSetNameFunction::~WebviewSetNameFunction() { } -WebViewInternalSetZoomFunction::WebViewInternalSetZoomFunction() { +WebviewSetZoomFunction::WebviewSetZoomFunction() { } -WebViewInternalSetZoomFunction::~WebViewInternalSetZoomFunction() { +WebviewSetZoomFunction::~WebviewSetZoomFunction() { } -bool WebViewInternalSetNameFunction::RunAsyncSafe(WebViewGuest* guest) { +bool WebviewSetNameFunction::RunAsyncSafe(WebViewGuest* guest) { scoped_ptr<webview::SetName::Params> params( webview::SetName::Params::Create(*args_)); EXTENSION_FUNCTION_VALIDATE(params.get()); @@ -383,7 +379,7 @@ bool WebViewInternalSetNameFunction::RunAsyncSafe(WebViewGuest* guest) { return true; } -bool WebViewInternalSetZoomFunction::RunAsyncSafe(WebViewGuest* guest) { +bool WebviewSetZoomFunction::RunAsyncSafe(WebViewGuest* guest) { scoped_ptr<webview::SetZoom::Params> params( webview::SetZoom::Params::Create(*args_)); EXTENSION_FUNCTION_VALIDATE(params.get()); @@ -393,13 +389,13 @@ bool WebViewInternalSetZoomFunction::RunAsyncSafe(WebViewGuest* guest) { return true; } -WebViewInternalGetZoomFunction::WebViewInternalGetZoomFunction() { +WebviewGetZoomFunction::WebviewGetZoomFunction() { } -WebViewInternalGetZoomFunction::~WebViewInternalGetZoomFunction() { +WebviewGetZoomFunction::~WebviewGetZoomFunction() { } -bool WebViewInternalGetZoomFunction::RunAsyncSafe(WebViewGuest* guest) { +bool WebviewGetZoomFunction::RunAsyncSafe(WebViewGuest* guest) { scoped_ptr<webview::GetZoom::Params> params( webview::GetZoom::Params::Create(*args_)); EXTENSION_FUNCTION_VALIDATE(params.get()); @@ -410,21 +406,22 @@ bool WebViewInternalGetZoomFunction::RunAsyncSafe(WebViewGuest* guest) { return true; } -WebViewInternalFindFunction::WebViewInternalFindFunction() { +WebviewFindFunction::WebviewFindFunction() { } -WebViewInternalFindFunction::~WebViewInternalFindFunction() { +WebviewFindFunction::~WebviewFindFunction() { } -bool WebViewInternalFindFunction::RunAsyncSafe(WebViewGuest* guest) { +bool WebviewFindFunction::RunAsyncSafe(WebViewGuest* guest) { scoped_ptr<webview::Find::Params> params( webview::Find::Params::Create(*args_)); EXTENSION_FUNCTION_VALIDATE(params.get()); // Convert the std::string search_text to string16. base::string16 search_text; - base::UTF8ToUTF16( - params->search_text.c_str(), params->search_text.length(), &search_text); + base::UTF8ToUTF16(params->search_text.c_str(), + params->search_text.length(), + &search_text); // Set the find options to their default values. blink::WebFindOptions options; @@ -439,13 +436,13 @@ bool WebViewInternalFindFunction::RunAsyncSafe(WebViewGuest* guest) { return true; } -WebViewInternalStopFindingFunction::WebViewInternalStopFindingFunction() { +WebviewStopFindingFunction::WebviewStopFindingFunction() { } -WebViewInternalStopFindingFunction::~WebViewInternalStopFindingFunction() { +WebviewStopFindingFunction::~WebviewStopFindingFunction() { } -bool WebViewInternalStopFindingFunction::RunAsyncSafe(WebViewGuest* guest) { +bool WebviewStopFindingFunction::RunAsyncSafe(WebViewGuest* guest) { scoped_ptr<webview::StopFinding::Params> params( webview::StopFinding::Params::Create(*args_)); EXTENSION_FUNCTION_VALIDATE(params.get()); @@ -470,13 +467,13 @@ bool WebViewInternalStopFindingFunction::RunAsyncSafe(WebViewGuest* guest) { return true; } -WebViewInternalGoFunction::WebViewInternalGoFunction() { +WebviewGoFunction::WebviewGoFunction() { } -WebViewInternalGoFunction::~WebViewInternalGoFunction() { +WebviewGoFunction::~WebviewGoFunction() { } -bool WebViewInternalGoFunction::RunAsyncSafe(WebViewGuest* guest) { +bool WebviewGoFunction::RunAsyncSafe(WebViewGuest* guest) { scoped_ptr<webview::Go::Params> params(webview::Go::Params::Create(*args_)); EXTENSION_FUNCTION_VALIDATE(params.get()); @@ -484,24 +481,24 @@ bool WebViewInternalGoFunction::RunAsyncSafe(WebViewGuest* guest) { return true; } -WebViewInternalReloadFunction::WebViewInternalReloadFunction() { +WebviewReloadFunction::WebviewReloadFunction() { } -WebViewInternalReloadFunction::~WebViewInternalReloadFunction() { +WebviewReloadFunction::~WebviewReloadFunction() { } -bool WebViewInternalReloadFunction::RunAsyncSafe(WebViewGuest* guest) { +bool WebviewReloadFunction::RunAsyncSafe(WebViewGuest* guest) { guest->Reload(); return true; } -WebViewInternalSetPermissionFunction::WebViewInternalSetPermissionFunction() { +WebviewSetPermissionFunction::WebviewSetPermissionFunction() { } -WebViewInternalSetPermissionFunction::~WebViewInternalSetPermissionFunction() { +WebviewSetPermissionFunction::~WebviewSetPermissionFunction() { } -bool WebViewInternalSetPermissionFunction::RunAsyncSafe(WebViewGuest* guest) { +bool WebviewSetPermissionFunction::RunAsyncSafe(WebViewGuest* guest) { scoped_ptr<webview::SetPermission::Params> params( webview::SetPermission::Params::Create(*args_)); EXTENSION_FUNCTION_VALIDATE(params.get()); @@ -535,15 +532,13 @@ bool WebViewInternalSetPermissionFunction::RunAsyncSafe(WebViewGuest* guest) { return true; } -WebViewInternalShowContextMenuFunction:: - WebViewInternalShowContextMenuFunction() { +WebviewShowContextMenuFunction::WebviewShowContextMenuFunction() { } -WebViewInternalShowContextMenuFunction:: - ~WebViewInternalShowContextMenuFunction() { +WebviewShowContextMenuFunction::~WebviewShowContextMenuFunction() { } -bool WebViewInternalShowContextMenuFunction::RunAsyncSafe(WebViewGuest* guest) { +bool WebviewShowContextMenuFunction::RunAsyncSafe(WebViewGuest* guest) { scoped_ptr<webview::ShowContextMenu::Params> params( webview::ShowContextMenu::Params::Create(*args_)); EXTENSION_FUNCTION_VALIDATE(params.get()); @@ -556,42 +551,39 @@ bool WebViewInternalShowContextMenuFunction::RunAsyncSafe(WebViewGuest* guest) { return true; } -WebViewInternalOverrideUserAgentFunction:: - WebViewInternalOverrideUserAgentFunction() { +WebviewOverrideUserAgentFunction::WebviewOverrideUserAgentFunction() { } -WebViewInternalOverrideUserAgentFunction:: - ~WebViewInternalOverrideUserAgentFunction() { +WebviewOverrideUserAgentFunction::~WebviewOverrideUserAgentFunction() { } -bool WebViewInternalOverrideUserAgentFunction::RunAsyncSafe( - WebViewGuest* guest) { - scoped_ptr<webview::OverrideUserAgent::Params> params( - webview::OverrideUserAgent::Params::Create(*args_)); +bool WebviewOverrideUserAgentFunction::RunAsyncSafe(WebViewGuest* guest) { + scoped_ptr<extensions::api::webview::OverrideUserAgent::Params> params( + extensions::api::webview::OverrideUserAgent::Params::Create(*args_)); EXTENSION_FUNCTION_VALIDATE(params.get()); guest->SetUserAgentOverride(params->user_agent_override); return true; } -WebViewInternalStopFunction::WebViewInternalStopFunction() { +WebviewStopFunction::WebviewStopFunction() { } -WebViewInternalStopFunction::~WebViewInternalStopFunction() { +WebviewStopFunction::~WebviewStopFunction() { } -bool WebViewInternalStopFunction::RunAsyncSafe(WebViewGuest* guest) { +bool WebviewStopFunction::RunAsyncSafe(WebViewGuest* guest) { guest->Stop(); return true; } -WebViewInternalTerminateFunction::WebViewInternalTerminateFunction() { +WebviewTerminateFunction::WebviewTerminateFunction() { } -WebViewInternalTerminateFunction::~WebViewInternalTerminateFunction() { +WebviewTerminateFunction::~WebviewTerminateFunction() { } -bool WebViewInternalTerminateFunction::RunAsyncSafe(WebViewGuest* guest) { +bool WebviewTerminateFunction::RunAsyncSafe(WebViewGuest* guest) { guest->Terminate(); return true; } diff --git a/chrome/browser/extensions/api/webview/webview_api.h b/chrome/browser/extensions/api/webview/webview_api.h new file mode 100644 index 0000000..dfd6d72 --- /dev/null +++ b/chrome/browser/extensions/api/webview/webview_api.h @@ -0,0 +1,418 @@ +// Copyright (c) 2013 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_WEBVIEW_WEBVIEW_API_H_ +#define CHROME_BROWSER_EXTENSIONS_API_WEBVIEW_WEBVIEW_API_H_ + +#include "chrome/browser/extensions/api/capture_web_contents_function.h" +#include "chrome/browser/extensions/api/execute_code_function.h" +#include "chrome/browser/guest_view/web_view/web_view_find_helper.h" +#include "chrome/browser/guest_view/web_view/web_view_guest.h" + +// WARNING: Webview could be loaded in an unblessed context, thus any new +// APIs must extend WebviewExtensionFunction/WebviewExecuteCodeFunction which +// do a process ID check to prevent abuse by normal renderer processes. +// TODO(guohui): refactor WebviewExecuteCodeFunction to also extend +// WebviewExtensionFunction. +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 WebviewExtensionFunction : public AsyncExtensionFunction { + public: + WebviewExtensionFunction() {} + + protected: + virtual ~WebviewExtensionFunction() {} + + // ExtensionFunction implementation. + virtual bool RunAsync() OVERRIDE FINAL; + + private: + virtual bool RunAsyncSafe(WebViewGuest* guest) = 0; +}; + +class WebviewContextMenusCreateFunction : public AsyncExtensionFunction { + public: + DECLARE_EXTENSION_FUNCTION("webview.contextMenusCreate", + WEBVIEW_CONTEXTMENUSCREATE); + WebviewContextMenusCreateFunction() {} + + protected: + virtual ~WebviewContextMenusCreateFunction() {} + + // ExtensionFunction implementation. + virtual bool RunAsync() OVERRIDE; + + private: + DISALLOW_COPY_AND_ASSIGN(WebviewContextMenusCreateFunction); +}; + +class WebviewContextMenusUpdateFunction : public AsyncExtensionFunction { + public: + DECLARE_EXTENSION_FUNCTION("webview.contextMenusUpdate", + WEBVIEW_CONTEXTMENUSUPDATE); + WebviewContextMenusUpdateFunction() {} + + protected: + virtual ~WebviewContextMenusUpdateFunction() {} + + // ExtensionFunction implementation. + virtual bool RunAsync() OVERRIDE; + + private: + DISALLOW_COPY_AND_ASSIGN(WebviewContextMenusUpdateFunction); +}; + +class WebviewContextMenusRemoveFunction : public AsyncExtensionFunction { + public: + DECLARE_EXTENSION_FUNCTION("webview.contextMenusRemove", + WEBVIEW_CONTEXTMENUSREMOVE); + WebviewContextMenusRemoveFunction() {} + + protected: + virtual ~WebviewContextMenusRemoveFunction() {} + + // ExtensionFunction implementation. + virtual bool RunAsync() OVERRIDE; + + private: + DISALLOW_COPY_AND_ASSIGN(WebviewContextMenusRemoveFunction); +}; + +class WebviewContextMenusRemoveAllFunction : public AsyncExtensionFunction { + public: + DECLARE_EXTENSION_FUNCTION("webview.contextMenusRemoveAll", + WEBVIEW_CONTEXTMENUSREMOVEALL); + WebviewContextMenusRemoveAllFunction() {} + + protected: + virtual ~WebviewContextMenusRemoveAllFunction() {} + + // ExtensionFunction implementation. + virtual bool RunAsync() OVERRIDE; + + private: + DISALLOW_COPY_AND_ASSIGN(WebviewContextMenusRemoveAllFunction); +}; + +class WebviewNavigateFunction : public WebviewExtensionFunction { + public: + DECLARE_EXTENSION_FUNCTION("webview.navigate", WEBVIEW_NAVIGATE); + WebviewNavigateFunction() {} + + protected: + virtual ~WebviewNavigateFunction() {} + + private: + // WebviewExtensionFunction implementation. + virtual bool RunAsyncSafe(WebViewGuest* guest) OVERRIDE; + + DISALLOW_COPY_AND_ASSIGN(WebviewNavigateFunction); +}; + +class WebviewClearDataFunction : public WebviewExtensionFunction { + public: + DECLARE_EXTENSION_FUNCTION("webview.clearData", WEBVIEW_CLEARDATA); + + WebviewClearDataFunction(); + + protected: + virtual ~WebviewClearDataFunction(); + + private: + // WebviewExtensionFunction 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(WebviewClearDataFunction); +}; + +class WebviewExecuteCodeFunction : public extensions::ExecuteCodeFunction { + public: + WebviewExecuteCodeFunction(); + + protected: + virtual ~WebviewExecuteCodeFunction(); + + // 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(WebviewExecuteCodeFunction); +}; + +class WebviewExecuteScriptFunction : public WebviewExecuteCodeFunction { + public: + WebviewExecuteScriptFunction(); + + protected: + virtual ~WebviewExecuteScriptFunction() {} + + virtual void OnExecuteCodeFinished(const std::string& error, + int32 on_page_id, + const GURL& on_url, + const base::ListValue& result) OVERRIDE; + + DECLARE_EXTENSION_FUNCTION("webview.executeScript", WEBVIEW_EXECUTESCRIPT) + + private: + DISALLOW_COPY_AND_ASSIGN(WebviewExecuteScriptFunction); +}; + +class WebviewInsertCSSFunction : public WebviewExecuteCodeFunction { + public: + WebviewInsertCSSFunction(); + + protected: + virtual ~WebviewInsertCSSFunction() {} + + virtual bool ShouldInsertCSS() const OVERRIDE; + + DECLARE_EXTENSION_FUNCTION("webview.insertCSS", WEBVIEW_INSERTCSS) + + private: + DISALLOW_COPY_AND_ASSIGN(WebviewInsertCSSFunction); +}; + +class WebviewCaptureVisibleRegionFunction + : public extensions::CaptureWebContentsFunction { + DECLARE_EXTENSION_FUNCTION("webview.captureVisibleRegion", + WEBVIEW_CAPTUREVISIBLEREGION); + + WebviewCaptureVisibleRegionFunction(); + + protected: + virtual ~WebviewCaptureVisibleRegionFunction(); + + 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(WebviewCaptureVisibleRegionFunction); +}; + +class WebviewSetNameFunction : public WebviewExtensionFunction { + public: + DECLARE_EXTENSION_FUNCTION("webview.setName", WEBVIEW_SETNAME); + + WebviewSetNameFunction(); + + protected: + virtual ~WebviewSetNameFunction(); + + private: + virtual bool RunAsyncSafe(WebViewGuest* guest) OVERRIDE; + + DISALLOW_COPY_AND_ASSIGN(WebviewSetNameFunction); +}; + +class WebviewSetZoomFunction : public WebviewExtensionFunction { + public: + DECLARE_EXTENSION_FUNCTION("webview.setZoom", WEBVIEW_SETZOOM); + + WebviewSetZoomFunction(); + + protected: + virtual ~WebviewSetZoomFunction(); + + private: + virtual bool RunAsyncSafe(WebViewGuest* guest) OVERRIDE; + + DISALLOW_COPY_AND_ASSIGN(WebviewSetZoomFunction); +}; + +class WebviewGetZoomFunction : public WebviewExtensionFunction { + public: + DECLARE_EXTENSION_FUNCTION("webview.getZoom", WEBVIEW_GETZOOM); + + WebviewGetZoomFunction(); + + protected: + virtual ~WebviewGetZoomFunction(); + + private: + virtual bool RunAsyncSafe(WebViewGuest* guest) OVERRIDE; + + DISALLOW_COPY_AND_ASSIGN(WebviewGetZoomFunction); +}; + +class WebviewFindFunction : public WebviewExtensionFunction { + public: + DECLARE_EXTENSION_FUNCTION("webview.find", WEBVIEW_FIND); + + WebviewFindFunction(); + + // Exposes SendResponse() for use by WebviewFindHelper. + using WebviewExtensionFunction::SendResponse; + + protected: + virtual ~WebviewFindFunction(); + + private: + // WebviewExtensionFunction implementation. + virtual bool RunAsyncSafe(WebViewGuest* guest) OVERRIDE; + + DISALLOW_COPY_AND_ASSIGN(WebviewFindFunction); +}; + +class WebviewStopFindingFunction : public WebviewExtensionFunction { + public: + DECLARE_EXTENSION_FUNCTION("webview.stopFinding", WEBVIEW_STOPFINDING); + + WebviewStopFindingFunction(); + + protected: + virtual ~WebviewStopFindingFunction(); + + private: + // WebviewExtensionFunction implementation. + virtual bool RunAsyncSafe(WebViewGuest* guest) OVERRIDE; + + DISALLOW_COPY_AND_ASSIGN(WebviewStopFindingFunction); +}; + +class WebviewGoFunction : public WebviewExtensionFunction { + public: + DECLARE_EXTENSION_FUNCTION("webview.go", WEBVIEW_GO); + + WebviewGoFunction(); + + protected: + virtual ~WebviewGoFunction(); + + private: + // WebviewExtensionFunction implementation. + virtual bool RunAsyncSafe(WebViewGuest* guest) OVERRIDE; + + DISALLOW_COPY_AND_ASSIGN(WebviewGoFunction); +}; + +class WebviewReloadFunction : public WebviewExtensionFunction { + public: + DECLARE_EXTENSION_FUNCTION("webview.reload", WEBVIEW_RELOAD); + + WebviewReloadFunction(); + + protected: + virtual ~WebviewReloadFunction(); + + private: + // WebviewExtensionFunction implementation. + virtual bool RunAsyncSafe(WebViewGuest* guest) OVERRIDE; + + DISALLOW_COPY_AND_ASSIGN(WebviewReloadFunction); +}; + +class WebviewSetPermissionFunction : public WebviewExtensionFunction { + public: + DECLARE_EXTENSION_FUNCTION("webview.setPermission", WEBVIEW_SETPERMISSION); + + WebviewSetPermissionFunction(); + + protected: + virtual ~WebviewSetPermissionFunction(); + + private: + // WebviewExtensionFunction implementation. + virtual bool RunAsyncSafe(WebViewGuest* guest) OVERRIDE; + + DISALLOW_COPY_AND_ASSIGN(WebviewSetPermissionFunction); +}; + +class WebviewShowContextMenuFunction : public WebviewExtensionFunction { + public: + DECLARE_EXTENSION_FUNCTION("webview.showContextMenu", + WEBVIEW_SHOWCONTEXTMENU); + + WebviewShowContextMenuFunction(); + + protected: + virtual ~WebviewShowContextMenuFunction(); + + private: + // WebviewExtensionFunction implementation. + virtual bool RunAsyncSafe(WebViewGuest* guest) OVERRIDE; + + DISALLOW_COPY_AND_ASSIGN(WebviewShowContextMenuFunction); +}; + +class WebviewOverrideUserAgentFunction: public WebviewExtensionFunction { + public: + DECLARE_EXTENSION_FUNCTION("webview.overrideUserAgent", + WEBVIEW_OVERRIDEUSERAGENT); + + WebviewOverrideUserAgentFunction(); + + protected: + virtual ~WebviewOverrideUserAgentFunction(); + + private: + // WebviewExtensionFunction implementation. + virtual bool RunAsyncSafe(WebViewGuest* guest) OVERRIDE; + + DISALLOW_COPY_AND_ASSIGN(WebviewOverrideUserAgentFunction); +}; + +class WebviewStopFunction : public WebviewExtensionFunction { + public: + DECLARE_EXTENSION_FUNCTION("webview.stop", WEBVIEW_STOP); + + WebviewStopFunction(); + + protected: + virtual ~WebviewStopFunction(); + + private: + // WebviewExtensionFunction implementation. + virtual bool RunAsyncSafe(WebViewGuest* guest) OVERRIDE; + + DISALLOW_COPY_AND_ASSIGN(WebviewStopFunction); +}; + +class WebviewTerminateFunction : public WebviewExtensionFunction { + public: + DECLARE_EXTENSION_FUNCTION("webview.terminate", WEBVIEW_TERMINATE); + + WebviewTerminateFunction(); + + protected: + virtual ~WebviewTerminateFunction(); + + private: + // WebviewExtensionFunction implementation. + virtual bool RunAsyncSafe(WebViewGuest* guest) OVERRIDE; + + DISALLOW_COPY_AND_ASSIGN(WebviewTerminateFunction); +}; + +} // namespace extensions + +#endif // CHROME_BROWSER_EXTENSIONS_API_WEBVIEW_WEBVIEW_API_H_ diff --git a/chrome/browser/extensions/menu_manager.cc b/chrome/browser/extensions/menu_manager.cc index e40b467..0a06139 100644 --- a/chrome/browser/extensions/menu_manager.cc +++ b/chrome/browser/extensions/menu_manager.cc @@ -20,7 +20,7 @@ #include "chrome/browser/guest_view/web_view/web_view_guest.h" #include "chrome/browser/profiles/profile.h" #include "chrome/common/extensions/api/context_menus.h" -#include "chrome/common/extensions/api/web_view_internal.h" +#include "chrome/common/extensions/api/webview.h" #include "content/public/browser/notification_details.h" #include "content/public/browser/notification_service.h" #include "content/public/browser/notification_source.h" @@ -41,7 +41,7 @@ using extensions::ExtensionSystem; namespace extensions { namespace context_menus = api::context_menus; -namespace web_view = api::web_view_internal; +namespace webview = api::webview; namespace { @@ -300,8 +300,7 @@ bool MenuItem::PopulateURLPatterns( // static const char MenuManager::kOnContextMenus[] = "contextMenus"; -const char MenuManager::kOnWebviewContextMenus[] = - "webViewInternal.contextMenus"; +const char MenuManager::kOnWebviewContextMenus[] = "webview.contextMenus"; MenuManager::MenuManager(Profile* profile, StateStore* store) : extension_registry_observer_(this), profile_(profile), store_(store) { @@ -655,7 +654,7 @@ void MenuManager::ExecuteCommand(Profile* profile, WebViewGuest* webview_guest = WebViewGuest::FromWebContents(web_contents); if (webview_guest) { - // This is used in web_view_internalcustom_bindings.js. + // This is used in webview_custom_bindings.js. // The property is not exposed to developer API. properties->SetInteger("webviewInstanceId", webview_guest->view_instance_id()); @@ -710,7 +709,7 @@ void MenuManager::ExecuteCommand(Profile* profile, { // Dispatch to .contextMenus.onClicked handler. scoped_ptr<Event> event( - new Event(webview_guest ? web_view::OnClicked::kEventName + new Event(webview_guest ? webview::OnClicked::kEventName : context_menus::OnClicked::kEventName, args.Pass())); event->restrict_to_browser_context = profile; diff --git a/chrome/browser/guest_view/web_view/web_view_constants.cc b/chrome/browser/guest_view/web_view/web_view_constants.cc index d844581..f0116a8 100644 --- a/chrome/browser/guest_view/web_view/web_view_constants.cc +++ b/chrome/browser/guest_view/web_view/web_view_constants.cc @@ -7,30 +7,27 @@ namespace webview { // Events. -const char kEventClose[] = "webViewInternal.onClose"; -const char kEventConsoleMessage[] = "webViewInternal.onConsoleMessage"; -const char kEventContentLoad[] = "webViewInternal.onContentLoad"; -const char kEventContextMenu[] = "webViewInternal.contextmenu"; -const char kEventDialog[] = "webViewInternal.onDialog"; -const char kEventExit[] = "webViewInternal.onExit"; -const char kEventFindReply[] = "webViewInternal.onFindReply"; -const char kEventFrameNameChanged[] = "webViewInternal.onFrameNameChanged"; -const char kEventLoadAbort[] = "webViewInternal.onLoadAbort"; -const char kEventLoadCommit[] = "webViewInternal.onLoadCommit"; -const char kEventLoadProgress[] = "webViewInternal.onLoadProgress"; -const char kEventLoadRedirect[] = "webViewInternal.onLoadRedirect"; -const char kEventLoadStart[] = "webViewInternal.onLoadStart"; -const char kEventLoadStop[] = "webViewInternal.onLoadStop"; -const char kEventMessage[] = "webViewInternal.onMessage"; -const char kEventNewWindow[] = "webViewInternal.onNewWindow"; -const char kEventPermissionRequest[] = "webViewInternal.onPermissionRequest"; -const char kEventResponsive[] = "webViewInternal.onResponsive"; -const char kEventSizeChanged[] = "webViewInternal.onSizeChanged"; -const char kEventUnresponsive[] = "webViewInternal.onUnresponsive"; -const char kEventZoomChange[] = "webViewInternal.onZoomChange"; - -// Event related constants. -const char kWebViewEventPrefix[] = "webViewInternal."; +const char kEventClose[] = "webview.onClose"; +const char kEventConsoleMessage[] = "webview.onConsoleMessage"; +const char kEventContentLoad[] = "webview.onContentLoad"; +const char kEventContextMenu[] = "webview.contextmenu"; +const char kEventDialog[] = "webview.onDialog"; +const char kEventExit[] = "webview.onExit"; +const char kEventFindReply[] = "webview.onFindReply"; +const char kEventFrameNameChanged[] = "webview.onFrameNameChanged"; +const char kEventLoadAbort[] = "webview.onLoadAbort"; +const char kEventLoadCommit[] = "webview.onLoadCommit"; +const char kEventLoadProgress[] = "webview.onLoadProgress"; +const char kEventLoadRedirect[] = "webview.onLoadRedirect"; +const char kEventLoadStart[] = "webview.onLoadStart"; +const char kEventLoadStop[] = "webview.onLoadStop"; +const char kEventMessage[] = "webview.onMessage"; +const char kEventNewWindow[] = "webview.onNewWindow"; +const char kEventPermissionRequest[] = "webview.onPermissionRequest"; +const char kEventResponsive[] = "webview.onResponsive"; +const char kEventSizeChanged[] = "webview.onSizeChanged"; +const char kEventUnresponsive[] = "webview.onUnresponsive"; +const char kEventZoomChange[] = "webview.onZoomChange"; // Parameters/properties on events. const char kContextMenuItems[] = "items"; diff --git a/chrome/browser/guest_view/web_view/web_view_constants.h b/chrome/browser/guest_view/web_view/web_view_constants.h index bddc7d5..0357088 100644 --- a/chrome/browser/guest_view/web_view/web_view_constants.h +++ b/chrome/browser/guest_view/web_view/web_view_constants.h @@ -32,9 +32,6 @@ extern const char kEventSizeChanged[]; extern const char kEventUnresponsive[]; extern const char kEventZoomChange[]; -// Event related constants. -extern const char kWebViewEventPrefix[]; - // Parameters/properties on events. extern const char kContextMenuItems[]; extern const char kDefaultPromptText[]; diff --git a/chrome/browser/guest_view/web_view/web_view_find_helper.cc b/chrome/browser/guest_view/web_view/web_view_find_helper.cc index 27b960b..e292a50 100644 --- a/chrome/browser/guest_view/web_view/web_view_find_helper.cc +++ b/chrome/browser/guest_view/web_view/web_view_find_helper.cc @@ -6,18 +6,19 @@ #include <utility> -#include "chrome/browser/extensions/api/web_view/web_view_internal_api.h" +#include "chrome/browser/extensions/api/webview/webview_api.h" #include "chrome/browser/guest_view/web_view/web_view_constants.h" -WebViewFindHelper::WebViewFindHelper(WebViewGuest* webview_guest) - : webview_guest_(webview_guest), current_find_request_id_(0) { +WebviewFindHelper::WebviewFindHelper(WebViewGuest* webview_guest) + : webview_guest_(webview_guest), + current_find_request_id_(0) { } -WebViewFindHelper::~WebViewFindHelper() { +WebviewFindHelper::~WebviewFindHelper() { } -void WebViewFindHelper::CancelAllFindSessions() { - current_find_session_ = linked_ptr<WebViewFindHelper::FindInfo>(); +void WebviewFindHelper::CancelAllFindSessions() { + current_find_session_ = linked_ptr<WebviewFindHelper::FindInfo>(); while (!find_info_map_.empty()) { find_info_map_.begin()->second->SendResponse(true /* canceled */); find_info_map_.erase(find_info_map_.begin()); @@ -27,7 +28,7 @@ void WebViewFindHelper::CancelAllFindSessions() { find_update_event_.reset(); } -void WebViewFindHelper::DispatchFindUpdateEvent(bool canceled, +void WebviewFindHelper::DispatchFindUpdateEvent(bool canceled, bool final_update) { DCHECK(find_update_event_.get()); scoped_ptr<base::DictionaryValue> args(new base::DictionaryValue()); @@ -39,7 +40,7 @@ void WebViewFindHelper::DispatchFindUpdateEvent(bool canceled, new GuestViewBase::Event(webview::kEventFindReply, args.Pass())); } -void WebViewFindHelper::EndFindSession(int session_request_id, bool canceled) { +void WebviewFindHelper::EndFindSession(int session_request_id, bool canceled) { FindInfoMap::iterator session_iterator = find_info_map_.find(session_request_id); DCHECK(session_iterator != find_info_map_.end()); @@ -49,10 +50,9 @@ void WebViewFindHelper::EndFindSession(int session_request_id, bool canceled) { find_info->SendResponse(canceled); // For every subsequent find request of the find session. - for (std::vector<base::WeakPtr<WebViewFindHelper::FindInfo> >::iterator i = + for (std::vector<base::WeakPtr<WebviewFindHelper::FindInfo> >::iterator i = find_info->find_next_requests_.begin(); - i != find_info->find_next_requests_.end(); - ++i) { + i != find_info->find_next_requests_.end(); ++i) { DCHECK(i->get()); // Do not call callbacks for subsequent find requests that have not been @@ -71,33 +71,35 @@ void WebViewFindHelper::EndFindSession(int session_request_id, bool canceled) { } // Call the request's callback function with the find results, and then - // delete its map entry to free the WebViewInternalFindFunction object. + // delete its map entry to free the WebviewFindFunction object. (*i)->SendResponse(canceled); find_info_map_.erase((*i)->request_id_); } - // Erase the first find request's map entry to free the - // WebViewInternalFindFunction + // Erase the first find request's map entry to free the WebviewFindFunction // object. find_info_map_.erase(session_request_id); } -void WebViewFindHelper::Find( +void WebviewFindHelper::Find( content::WebContents* guest_web_contents, const base::string16& search_text, const blink::WebFindOptions& options, - scoped_refptr<extensions::WebViewInternalFindFunction> find_function) { + scoped_refptr<extensions::WebviewFindFunction> find_function) { // Need a new request_id for each new find request. ++current_find_request_id_; // Stores the find request information by request_id so that its callback // function can be called when the find results are available. std::pair<FindInfoMap::iterator, bool> insert_result = - find_info_map_.insert(std::make_pair( - current_find_request_id_, - linked_ptr< - WebViewFindHelper::FindInfo>(new WebViewFindHelper::FindInfo( - current_find_request_id_, search_text, options, find_function)))); + find_info_map_.insert( + std::make_pair(current_find_request_id_, + linked_ptr<WebviewFindHelper::FindInfo>( + new WebviewFindHelper::FindInfo( + current_find_request_id_, + search_text, + options, + find_function)))); // No duplicate insertions. DCHECK(insert_result.second); @@ -131,7 +133,7 @@ void WebViewFindHelper::Find( search_text, *full_options); } -void WebViewFindHelper::FindReply(int request_id, +void WebviewFindHelper::FindReply(int request_id, int number_of_matches, const gfx::Rect& selection_rect, int active_match_ordinal, @@ -145,7 +147,7 @@ void WebViewFindHelper::FindReply(int request_id, // This find request must be a part of an existing find session. DCHECK(current_find_session_.get()); - WebViewFindHelper::FindInfo* find_info = find_iterator->second.get(); + WebviewFindHelper::FindInfo* find_info = find_iterator->second.get(); // Handle canceled find requests. if (!find_info->options()->findNext && @@ -174,14 +176,14 @@ void WebViewFindHelper::FindReply(int request_id, EndFindSession(request_id, false /* canceled */); } -WebViewFindHelper::FindResults::FindResults() - : number_of_matches_(0), active_match_ordinal_(0) { -} +WebviewFindHelper::FindResults::FindResults() + : number_of_matches_(0), + active_match_ordinal_(0) {} -WebViewFindHelper::FindResults::~FindResults() { +WebviewFindHelper::FindResults::~FindResults() { } -void WebViewFindHelper::FindResults::AggregateResults( +void WebviewFindHelper::FindResults::AggregateResults( int number_of_matches, const gfx::Rect& selection_rect, int active_match_ordinal, @@ -200,7 +202,7 @@ void WebViewFindHelper::FindResults::AggregateResults( } } -void WebViewFindHelper::FindResults::PrepareResults( +void WebviewFindHelper::FindResults::PrepareResults( base::DictionaryValue* results) { results->SetInteger(webview::kFindNumberOfMatches, number_of_matches_); results->SetInteger(webview::kFindActiveMatchOrdinal, active_match_ordinal_); @@ -212,15 +214,14 @@ void WebViewFindHelper::FindResults::PrepareResults( results->Set(webview::kFindSelectionRect, rect.DeepCopy()); } -WebViewFindHelper::FindUpdateEvent::FindUpdateEvent( - const base::string16& search_text) - : search_text_(search_text) { +WebviewFindHelper::FindUpdateEvent::FindUpdateEvent( + const base::string16& search_text) : search_text_(search_text) { } -WebViewFindHelper::FindUpdateEvent::~FindUpdateEvent() { +WebviewFindHelper::FindUpdateEvent::~FindUpdateEvent() { } -void WebViewFindHelper::FindUpdateEvent::AggregateResults( +void WebviewFindHelper::FindUpdateEvent::AggregateResults( int number_of_matches, const gfx::Rect& selection_rect, int active_match_ordinal, @@ -229,17 +230,17 @@ void WebViewFindHelper::FindUpdateEvent::AggregateResults( active_match_ordinal, final_update); } -void WebViewFindHelper::FindUpdateEvent::PrepareResults( +void WebviewFindHelper::FindUpdateEvent::PrepareResults( base::DictionaryValue* results) { results->SetString(webview::kFindSearchText, search_text_); find_results_.PrepareResults(results); } -WebViewFindHelper::FindInfo::FindInfo( +WebviewFindHelper::FindInfo::FindInfo( int request_id, const base::string16& search_text, const blink::WebFindOptions& options, - scoped_refptr<extensions::WebViewInternalFindFunction> find_function) + scoped_refptr<extensions::WebviewFindFunction> find_function) : request_id_(request_id), search_text_(search_text), options_(options), @@ -248,10 +249,10 @@ WebViewFindHelper::FindInfo::FindInfo( weak_ptr_factory_(this) { } -WebViewFindHelper::FindInfo::~FindInfo() { +WebviewFindHelper::FindInfo::~FindInfo() { } -void WebViewFindHelper::FindInfo::AggregateResults( +void WebviewFindHelper::FindInfo::AggregateResults( int number_of_matches, const gfx::Rect& selection_rect, int active_match_ordinal, @@ -261,12 +262,12 @@ void WebViewFindHelper::FindInfo::AggregateResults( active_match_ordinal, final_update); } -base::WeakPtr<WebViewFindHelper::FindInfo> -WebViewFindHelper::FindInfo::AsWeakPtr() { +base::WeakPtr<WebviewFindHelper::FindInfo> + WebviewFindHelper::FindInfo::AsWeakPtr() { return weak_ptr_factory_.GetWeakPtr(); } -void WebViewFindHelper::FindInfo::SendResponse(bool canceled) { +void WebviewFindHelper::FindInfo::SendResponse(bool canceled) { // Prepare the find results to pass to the callback function. base::DictionaryValue results; find_results_.PrepareResults(&results); diff --git a/chrome/browser/guest_view/web_view/web_view_find_helper.h b/chrome/browser/guest_view/web_view/web_view_find_helper.h index 9d4d74c..d8b26e36 100644 --- a/chrome/browser/guest_view/web_view/web_view_find_helper.h +++ b/chrome/browser/guest_view/web_view/web_view_find_helper.h @@ -15,16 +15,15 @@ #include "ui/gfx/geometry/rect.h" namespace extensions { -class WebViewInternalFindFunction; +class WebviewFindFunction; } // namespace extensions class WebViewGuest; -// Helper class for find requests and replies for the web_view_internal find -// API. -class WebViewFindHelper { +// Helper class for find requests and replies for the webview find API. +class WebviewFindHelper { public: - explicit WebViewFindHelper(WebViewGuest* webview_guest); - ~WebViewFindHelper(); + explicit WebviewFindHelper(WebViewGuest* webview_guest); + ~WebviewFindHelper(); // Cancels all find requests in progress and calls their callback functions. void CancelAllFindSessions(); @@ -37,11 +36,10 @@ class WebViewFindHelper { void EndFindSession(int session_request_id, bool canceled); // Helper function for WebViewGuest::Find(). - void Find( - content::WebContents* guest_web_contents, - const base::string16& search_text, - const blink::WebFindOptions& options, - scoped_refptr<extensions::WebViewInternalFindFunction> find_function); + void Find(content::WebContents* guest_web_contents, + const base::string16& search_text, + const blink::WebFindOptions& options, + scoped_refptr<extensions::WebviewFindFunction> find_function); // Helper function for WeViewGuest:FindReply(). void FindReply(int request_id, @@ -71,7 +69,7 @@ class WebViewFindHelper { int active_match_ordinal_; gfx::Rect selection_rect_; - friend void WebViewFindHelper::EndFindSession(int session_request_id, + friend void WebviewFindHelper::EndFindSession(int session_request_id, bool canceled); DISALLOW_COPY_AND_ASSIGN(FindResults); @@ -102,11 +100,10 @@ class WebViewFindHelper { // Handles all information about a find request and its results. class FindInfo { public: - FindInfo( - int request_id, - const base::string16& search_text, - const blink::WebFindOptions& options, - scoped_refptr<extensions::WebViewInternalFindFunction> find_function); + FindInfo(int request_id, + const base::string16& search_text, + const blink::WebFindOptions& options, + scoped_refptr<extensions::WebviewFindFunction> find_function); ~FindInfo(); // Add another request to |find_next_requests_|. @@ -146,7 +143,7 @@ class WebViewFindHelper { const int request_id_; const base::string16 search_text_; blink::WebFindOptions options_; - scoped_refptr<extensions::WebViewInternalFindFunction> find_function_; + scoped_refptr<extensions::WebviewFindFunction> find_function_; FindResults find_results_; // A find reply has been received for this find request. @@ -159,7 +156,7 @@ class WebViewFindHelper { // Weak pointer used to access the find info of fin. base::WeakPtrFactory<FindInfo> weak_ptr_factory_; - friend void WebViewFindHelper::EndFindSession(int session_request_id, + friend void WebviewFindHelper::EndFindSession(int session_request_id, bool canceled); DISALLOW_COPY_AND_ASSIGN(FindInfo); @@ -183,7 +180,7 @@ class WebViewFindHelper { typedef std::map<int, linked_ptr<FindInfo> > FindInfoMap; FindInfoMap find_info_map_; - DISALLOW_COPY_AND_ASSIGN(WebViewFindHelper); + DISALLOW_COPY_AND_ASSIGN(WebviewFindHelper); }; #endif // CHROME_BROWSER_GUEST_VIEW_WEB_VIEW_WEB_VIEW_FIND_HELPER_H_ diff --git a/chrome/browser/guest_view/web_view/web_view_guest.cc b/chrome/browser/guest_view/web_view/web_view_guest.cc index 0c1065b..1b0a442 100644 --- a/chrome/browser/guest_view/web_view/web_view_guest.cc +++ b/chrome/browser/guest_view/web_view/web_view_guest.cc @@ -10,7 +10,7 @@ #include "chrome/browser/chrome_notification_types.h" #include "chrome/browser/content_settings/tab_specific_content_settings.h" #include "chrome/browser/extensions/api/web_request/web_request_api.h" -#include "chrome/browser/extensions/api/web_view/web_view_internal_api.h" +#include "chrome/browser/extensions/api/webview/webview_api.h" #include "chrome/browser/extensions/chrome_extension_web_contents_observer.h" #include "chrome/browser/extensions/extension_renderer_state.h" #include "chrome/browser/extensions/menu_manager.h" @@ -716,7 +716,7 @@ double WebViewGuest::GetZoom() { void WebViewGuest::Find( const base::string16& search_text, const blink::WebFindOptions& options, - scoped_refptr<extensions::WebViewInternalFindFunction> find_function) { + scoped_refptr<extensions::WebviewFindFunction> find_function) { find_helper_.Find(guest_web_contents(), search_text, options, find_function); } diff --git a/chrome/browser/guest_view/web_view/web_view_guest.h b/chrome/browser/guest_view/web_view/web_view_guest.h index f9aa6c6..e50bab7 100644 --- a/chrome/browser/guest_view/web_view/web_view_guest.h +++ b/chrome/browser/guest_view/web_view/web_view_guest.h @@ -13,7 +13,7 @@ #include "chrome/browser/guest_view/web_view/javascript_dialog_helper.h" #include "chrome/browser/guest_view/web_view/web_view_find_helper.h" #include "chrome/browser/guest_view/web_view/web_view_permission_types.h" -#include "chrome/common/extensions/api/web_view_internal.h" +#include "chrome/common/extensions/api/webview.h" #include "content/public/browser/javascript_dialog_manager.h" #include "content/public/browser/notification_registrar.h" #include "third_party/WebKit/public/web/WebFindOptions.h" @@ -22,13 +22,13 @@ #include "chrome/browser/chromeos/accessibility/accessibility_manager.h" #endif -namespace webview_api = extensions::api::web_view_internal; +namespace webview_api = extensions::api::webview; class RenderViewContextMenu; namespace extensions { class ScriptExecutor; -class WebViewInternalFindFunction; +class WebviewFindFunction; } // namespace extensions namespace ui { @@ -167,10 +167,9 @@ class WebViewGuest : public GuestView<WebViewGuest>, double GetZoom(); // Begin or continue a find request. - void Find( - const base::string16& search_text, - const blink::WebFindOptions& options, - scoped_refptr<extensions::WebViewInternalFindFunction> find_function); + void Find(const base::string16& search_text, + const blink::WebFindOptions& options, + scoped_refptr<extensions::WebviewFindFunction> find_function); // Conclude a find request to clear highlighting. void StopFinding(content::StopFindAction); @@ -469,12 +468,12 @@ class WebViewGuest : public GuestView<WebViewGuest>, std::string name_; // Handles find requests and replies for the webview find API. - WebViewFindHelper find_helper_; + WebviewFindHelper find_helper_; // Handles the JavaScript dialog requests. JavaScriptDialogHelper javascript_dialog_helper_; - friend void WebViewFindHelper::DispatchFindUpdateEvent(bool canceled, + friend void WebviewFindHelper::DispatchFindUpdateEvent(bool canceled, bool final_update); // Holds the RenderViewContextMenu that has been built but yet to be diff --git a/chrome/chrome_browser_extensions.gypi b/chrome/chrome_browser_extensions.gypi index 4b5eb00..a330395 100644 --- a/chrome/chrome_browser_extensions.gypi +++ b/chrome/chrome_browser_extensions.gypi @@ -632,8 +632,6 @@ 'browser/extensions/api/web_request/web_request_permissions.h', 'browser/extensions/api/web_request/web_request_time_tracker.cc', 'browser/extensions/api/web_request/web_request_time_tracker.h', - 'browser/extensions/api/web_view/web_view_internal_api.cc', - 'browser/extensions/api/web_view/web_view_internal_api.h', 'browser/extensions/api/webrtc_audio_private/webrtc_audio_private_api.cc', 'browser/extensions/api/webrtc_audio_private/webrtc_audio_private_api.h', 'browser/extensions/api/webrtc_logging_private/webrtc_logging_private_api.cc', @@ -642,6 +640,8 @@ 'browser/extensions/api/webstore_private/webstore_private_api.h', 'browser/extensions/api/webstore/webstore_api.cc', 'browser/extensions/api/webstore/webstore_api.h', + 'browser/extensions/api/webview/webview_api.cc', + 'browser/extensions/api/webview/webview_api.h', 'browser/extensions/app_icon_loader.h', 'browser/extensions/app_icon_loader_impl.cc', 'browser/extensions/app_icon_loader_impl.h', diff --git a/chrome/chrome_renderer.gypi b/chrome/chrome_renderer.gypi index a846b8c..86c2953 100644 --- a/chrome/chrome_renderer.gypi +++ b/chrome/chrome_renderer.gypi @@ -111,7 +111,7 @@ 'renderer/resources/extensions/web_view.js', 'renderer/resources/extensions/web_view_events.js', 'renderer/resources/extensions/web_view_experimental.js', - 'renderer/resources/extensions/web_view_internal_custom_bindings.js', + 'renderer/resources/extensions/webview_custom_bindings.js', 'renderer/chrome_content_renderer_client.cc', 'renderer/chrome_content_renderer_client.h', 'renderer/chrome_render_frame_observer.cc', diff --git a/chrome/common/extensions/api/_api_features.json b/chrome/common/extensions/api/_api_features.json index 205326d5..479a405 100644 --- a/chrome/common/extensions/api/_api_features.json +++ b/chrome/common/extensions/api/_api_features.json @@ -739,7 +739,7 @@ "dependencies": ["permission:webstorePrivate"], "contexts": ["blessed_extension"] }, - "webViewInternal": { + "webview": { "internal": true, "dependencies": ["permission:webview"], "contexts": ["blessed_extension", "unblessed_extension"] diff --git a/chrome/common/extensions/api/api.gyp b/chrome/common/extensions/api/api.gyp index 530b913..3f3fde9 100644 --- a/chrome/common/extensions/api/api.gyp +++ b/chrome/common/extensions/api/api.gyp @@ -23,7 +23,6 @@ 'tab_capture.idl', 'tabs.json', 'types.json', - 'web_navigation.json', 'windows.json', ], @@ -125,7 +124,7 @@ 'webrtc_audio_private.idl', 'webrtc_logging_private.idl', 'webstore_private.json', - 'web_view_internal.json', + 'webview.json', 'windows.json', ], 'main_non_compiled_schema_files': [ diff --git a/chrome/common/extensions/api/web_view_internal.json b/chrome/common/extensions/api/webview.json index 94bf180..63278ae 100644 --- a/chrome/common/extensions/api/web_view_internal.json +++ b/chrome/common/extensions/api/webview.json @@ -1,14 +1,11 @@ -// Copyright 2014 The Chromium Authors. All rights reserved. +// Copyright (c) 2013 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. [ { - "namespace": "webViewInternal", + "namespace": "webview", "description": "none", - "compiler_options": { - "implemented_in": "chrome/browser/extensions/api/web_view/web_view_internal_api.h" - }, "dependencies": ["contextMenusInternal"], "types": [ { diff --git a/chrome/common/extensions/api/web_view_request.json b/chrome/common/extensions/api/webview_request.json index 826cfa3..653e195 100644 --- a/chrome/common/extensions/api/web_view_request.json +++ b/chrome/common/extensions/api/webview_request.json @@ -1,4 +1,4 @@ -// Copyright 2014 The Chromium Authors. All rights reserved. +// Copyright 2013 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. diff --git a/chrome/common/extensions/chrome_extensions_client.cc b/chrome/common/extensions/chrome_extensions_client.cc index 929faa2..d668b1b 100644 --- a/chrome/common/extensions/chrome_extensions_client.cc +++ b/chrome/common/extensions/chrome_extensions_client.cc @@ -260,7 +260,7 @@ void ChromeExtensionsClient::RegisterAPISchemaResources( IDR_EXTENSION_API_JSON_TYPES_PRIVATE); api->RegisterSchemaResource("webstore", IDR_EXTENSION_API_JSON_WEBSTORE); api->RegisterSchemaResource("webViewRequest", - IDR_EXTENSION_API_JSON_WEB_VIEW_REQUEST); + IDR_EXTENSION_API_JSON_WEBVIEW_REQUEST); #endif // defined(ENABLE_EXTENSIONS) } diff --git a/chrome/common/extensions_api_resources.grd b/chrome/common/extensions_api_resources.grd index 5598aaf..6f77ab7 100644 --- a/chrome/common/extensions_api_resources.grd +++ b/chrome/common/extensions_api_resources.grd @@ -27,7 +27,7 @@ <include name="IDR_EXTENSION_API_JSON_TYPES" file="extensions\api\types.json" type="BINDATA" /> <include name="IDR_EXTENSION_API_JSON_TYPES_PRIVATE" file="extensions\api\types_private.json" type="BINDATA" /> <include name="IDR_EXTENSION_API_JSON_WEBSTORE" file="extensions\api\webstore.json" type="BINDATA" /> - <include name="IDR_EXTENSION_API_JSON_WEB_VIEW_REQUEST" file="extensions\api\web_view_request.json" type="BINDATA" /> + <include name="IDR_EXTENSION_API_JSON_WEBVIEW_REQUEST" file="extensions\api\webview_request.json" type="BINDATA" /> </includes> </release> </grit> diff --git a/chrome/renderer/extensions/chrome_extensions_dispatcher_delegate.cc b/chrome/renderer/extensions/chrome_extensions_dispatcher_delegate.cc index 08bc023..08fbf5b 100644 --- a/chrome/renderer/extensions/chrome_extensions_dispatcher_delegate.cc +++ b/chrome/renderer/extensions/chrome_extensions_dispatcher_delegate.cc @@ -236,8 +236,7 @@ void ChromeExtensionsDispatcherDelegate::PopulateSourceMap( // Platform app sources that are not API-specific.. source_map->RegisterSource("tagWatcher", IDR_TAG_WATCHER_JS); - source_map->RegisterSource("webViewInternal", - IDR_WEB_VIEW_INTERNAL_CUSTOM_BINDINGS_JS); + source_map->RegisterSource("webview", IDR_WEBVIEW_CUSTOM_BINDINGS_JS); // Note: webView not webview so that this doesn't interfere with the // chrome.webview API bindings. source_map->RegisterSource("webView", IDR_WEB_VIEW_JS); diff --git a/chrome/renderer/resources/extensions/web_view.js b/chrome/renderer/resources/extensions/web_view.js index 171b6a6..f3abbec 100644 --- a/chrome/renderer/resources/extensions/web_view.js +++ b/chrome/renderer/resources/extensions/web_view.js @@ -10,9 +10,7 @@ var DocumentNatives = requireNative('document_natives'); var GuestViewInternal = require('binding').Binding.create('guestViewInternal').generate(); var IdGenerator = requireNative('id_generator'); -// TODO(lazyboy): Rename this to WebViewInternal and call WebViewInternal -// something else. -var WebView = require('webViewInternal').WebView; +var WebView = require('webview').WebView; var WebViewEvents = require('webViewEvents').WebViewEvents; var WEB_VIEW_ATTRIBUTE_MAXHEIGHT = 'maxheight'; diff --git a/chrome/renderer/resources/extensions/web_view_events.js b/chrome/renderer/resources/extensions/web_view_events.js index 3729cff..441e623 100644 --- a/chrome/renderer/resources/extensions/web_view_events.js +++ b/chrome/renderer/resources/extensions/web_view_events.js @@ -12,15 +12,15 @@ var MessagingNatives = requireNative('messaging_natives'); var WebRequestEvent = require('webRequestInternal').WebRequestEvent; var WebRequestSchema = requireNative('schema_registry').GetSchema('webRequest'); -var WebView = require('webViewInternal').WebView; +var WebView = require('webview').WebView; var CreateEvent = function(name) { var eventOpts = {supportsListeners: true, supportsFilters: true}; return new EventBindings.Event(name, undefined, eventOpts); }; -var FrameNameChangedEvent = CreateEvent('webViewInternal.onFrameNameChanged'); -var WebRequestMessageEvent = CreateEvent('webViewInternal.onMessage'); +var FrameNameChangedEvent = CreateEvent('webview.onFrameNameChanged'); +var WebRequestMessageEvent = CreateEvent('webview.onMessage'); // WEB_VIEW_EVENTS is a map of stable <webview> DOM event names to their // associated extension event descriptor objects. @@ -38,19 +38,19 @@ var WebRequestMessageEvent = CreateEvent('webViewInternal.onMessage'); // handler. The event must have a custom handler for this to be meaningful. var WEB_VIEW_EVENTS = { 'close': { - evt: CreateEvent('webViewInternal.onClose'), + evt: CreateEvent('webview.onClose'), fields: [] }, 'consolemessage': { - evt: CreateEvent('webViewInternal.onConsoleMessage'), + evt: CreateEvent('webview.onConsoleMessage'), fields: ['level', 'message', 'line', 'sourceId'] }, 'contentload': { - evt: CreateEvent('webViewInternal.onContentLoad'), + evt: CreateEvent('webview.onContentLoad'), fields: [] }, 'contextmenu': { - evt: CreateEvent('webViewInternal.contextmenu'), + evt: CreateEvent('webview.contextmenu'), cancelable: true, customHandler: function(handler, event, webViewEvent) { handler.handleContextMenu(event, webViewEvent); @@ -62,11 +62,11 @@ var WEB_VIEW_EVENTS = { customHandler: function(handler, event, webViewEvent) { handler.handleDialogEvent(event, webViewEvent); }, - evt: CreateEvent('webViewInternal.onDialog'), + evt: CreateEvent('webview.onDialog'), fields: ['defaultPromptText', 'messageText', 'messageType', 'url'] }, 'exit': { - evt: CreateEvent('webViewInternal.onExit'), + evt: CreateEvent('webview.onExit'), fields: ['processId', 'reason'] }, 'loadabort': { @@ -74,30 +74,30 @@ var WEB_VIEW_EVENTS = { customHandler: function(handler, event, webViewEvent) { handler.handleLoadAbortEvent(event, webViewEvent); }, - evt: CreateEvent('webViewInternal.onLoadAbort'), + evt: CreateEvent('webview.onLoadAbort'), fields: ['url', 'isTopLevel', 'reason'] }, 'loadcommit': { customHandler: function(handler, event, webViewEvent) { handler.handleLoadCommitEvent(event, webViewEvent); }, - evt: CreateEvent('webViewInternal.onLoadCommit'), + evt: CreateEvent('webview.onLoadCommit'), fields: ['url', 'isTopLevel'] }, 'loadprogress': { - evt: CreateEvent('webViewInternal.onLoadProgress'), + evt: CreateEvent('webview.onLoadProgress'), fields: ['url', 'progress'] }, 'loadredirect': { - evt: CreateEvent('webViewInternal.onLoadRedirect'), + evt: CreateEvent('webview.onLoadRedirect'), fields: ['isTopLevel', 'oldUrl', 'newUrl'] }, 'loadstart': { - evt: CreateEvent('webViewInternal.onLoadStart'), + evt: CreateEvent('webview.onLoadStart'), fields: ['url', 'isTopLevel'] }, 'loadstop': { - evt: CreateEvent('webViewInternal.onLoadStop'), + evt: CreateEvent('webview.onLoadStop'), fields: [] }, 'newwindow': { @@ -105,7 +105,7 @@ var WEB_VIEW_EVENTS = { customHandler: function(handler, event, webViewEvent) { handler.handleNewWindowEvent(event, webViewEvent); }, - evt: CreateEvent('webViewInternal.onNewWindow'), + evt: CreateEvent('webview.onNewWindow'), fields: [ 'initialHeight', 'initialWidth', @@ -119,7 +119,7 @@ var WEB_VIEW_EVENTS = { customHandler: function(handler, event, webViewEvent) { handler.handlePermissionEvent(event, webViewEvent); }, - evt: CreateEvent('webViewInternal.onPermissionRequest'), + evt: CreateEvent('webview.onPermissionRequest'), fields: [ 'identifier', 'lastUnlockedBySelf', @@ -131,18 +131,18 @@ var WEB_VIEW_EVENTS = { ] }, 'responsive': { - evt: CreateEvent('webViewInternal.onResponsive'), + evt: CreateEvent('webview.onResponsive'), fields: ['processId'] }, 'sizechanged': { - evt: CreateEvent('webViewInternal.onSizeChanged'), + evt: CreateEvent('webview.onSizeChanged'), customHandler: function(handler, event, webViewEvent) { handler.handleSizeChangedEvent(event, webViewEvent); }, fields: ['oldHeight', 'oldWidth', 'newHeight', 'newWidth'] }, 'unresponsive': { - evt: CreateEvent('webViewInternal.onUnresponsive'), + evt: CreateEvent('webview.onUnresponsive'), fields: ['processId'] } }; @@ -201,7 +201,7 @@ WebViewEvents.prototype.setupWebRequestEvents = function() { if (!self[webRequestEvent.name]) { self[webRequestEvent.name] = new WebRequestEvent( - 'webViewInternal.' + webRequestEvent.name, + 'webview.' + webRequestEvent.name, webRequestEvent.parameters, webRequestEvent.extraParameters, webRequestEvent.options, self.viewInstanceId); @@ -220,7 +220,7 @@ WebViewEvents.prototype.setupWebRequestEvents = function() { DeclarativeWebRequestEvent : EventBindings.Event; self[webRequestEvent.name] = new EventClass( - 'webViewInternal.' + webRequestEvent.name, + 'webview.' + webRequestEvent.name, webRequestEvent.parameters, webRequestEvent.options, self.viewInstanceId); @@ -392,7 +392,7 @@ WebViewEvents.prototype.handleNewWindowEvent = function(event, webViewEvent) { 'An action has already been taken for this "newwindow" event.'; var ERROR_MSG_NEWWINDOW_UNABLE_TO_ATTACH = '<webview>: ' + - 'Unable to attach the new window to the provided webViewInternal.'; + 'Unable to attach the new window to the provided webview.'; var ERROR_MSG_WEBVIEW_EXPECTED = '<webview> element expected.'; diff --git a/chrome/renderer/resources/extensions/web_view_experimental.js b/chrome/renderer/resources/extensions/web_view_experimental.js index 05a3b8c..c927d2a4 100644 --- a/chrome/renderer/resources/extensions/web_view_experimental.js +++ b/chrome/renderer/resources/extensions/web_view_experimental.js @@ -13,9 +13,9 @@ var ContextMenusSchema = var CreateEvent = require('webViewEvents').CreateEvent; var EventBindings = require('event_bindings'); var MessagingNatives = requireNative('messaging_natives'); -var WebView = require('webViewInternal').WebView; +var WebView = require('webView').WebView; var WebViewInternal = require('webView').WebViewInternal; -var WebViewSchema = requireNative('schema_registry').GetSchema('webViewInternal'); +var WebViewSchema = requireNative('schema_registry').GetSchema('webview'); var idGeneratorNatives = requireNative('id_generator'); var utils = require('utils'); @@ -35,7 +35,7 @@ var utils = require('utils'); // handler. The event must have a custom handler for this to be meaningful. var WEB_VIEW_EXPERIMENTAL_EVENTS = { 'findupdate': { - evt: CreateEvent('webViewInternal.onFindReply'), + evt: CreateEvent('webview.onFindReply'), fields: [ 'searchText', 'numberOfMatches', @@ -46,7 +46,7 @@ var WEB_VIEW_EXPERIMENTAL_EVENTS = { ] }, 'zoomchange': { - evt: CreateEvent('webViewInternal.onZoomChange'), + evt: CreateEvent('webview.onZoomChange'), fields: ['oldZoomFactor', 'newZoomFactor'] } }; @@ -55,7 +55,7 @@ function GetUniqueSubEventName(eventName) { return eventName + "/" + idGeneratorNatives.GetNextId(); } -// This is the only "webViewInternal.onClicked" named event for this renderer. +// This is the only "webview.onClicked" named event for this renderer. // // Since we need an event per <webview>, we define events with suffix // (subEventName) in each of the <webview>. Behind the scenes, this event is @@ -63,7 +63,7 @@ function GetUniqueSubEventName(eventName) { // |viewInstanceId|. Any time a ContextMenusEvent is dispatched, we re-dispatch // it to the subEvent's listeners. This way // <webview>.contextMenus.onClicked behave as a regular chrome Event type. -var ContextMenusEvent = CreateEvent('webViewInternal.onClicked'); +var ContextMenusEvent = CreateEvent('webview.onClicked'); /** * This event is exposed as <webview>.contextMenus.onClicked. @@ -259,7 +259,7 @@ WebViewInternal.prototype.setupExperimentalContextMenus = function() { var getOnClickedEvent = function() { return function() { if (!self.contextMenusOnClickedEvent_) { - var eventName = 'webViewInternal.onClicked'; + var eventName = 'webview.onClicked'; // TODO(lazyboy): Find event by name instead of events[0]. var eventSchema = WebViewSchema.events[0]; var eventOptions = {supportsListeners: true}; diff --git a/chrome/renderer/resources/extensions/web_view_internal_custom_bindings.js b/chrome/renderer/resources/extensions/webview_custom_bindings.js index 6ab8d0d..a7da243 100644 --- a/chrome/renderer/resources/extensions/web_view_internal_custom_bindings.js +++ b/chrome/renderer/resources/extensions/webview_custom_bindings.js @@ -11,7 +11,7 @@ // TODO(lazyboy): Share common code /w context_menus_custom_bindings.js. var EventBindings = require('event_bindings'); -var binding = require('binding').Binding.create('webViewInternal'); +var binding = require('binding').Binding.create('webview'); var contextMenuNatives = requireNative('context_menus'); var sendRequest = require('sendRequest').sendRequest; @@ -23,7 +23,7 @@ binding.registerCustomHook(function(bindingsAPI) { webviewContextMenus.stringIdHandlers = {}; // Per item event handler. - var ename = 'webViewInternal.contextMenus'; + var ename = 'webview.contextMenus'; webviewContextMenus.event = new EventBindings.Event(ename); webviewContextMenus.getIdFromCreateProperties = function(prop) { diff --git a/chrome/renderer/resources/extensions/web_view_request_custom_bindings.js b/chrome/renderer/resources/extensions/webview_request_custom_bindings.js index 62f7459..f1aa3ea 100644 --- a/chrome/renderer/resources/extensions/web_view_request_custom_bindings.js +++ b/chrome/renderer/resources/extensions/webview_request_custom_bindings.js @@ -1,4 +1,4 @@ -// Copyright 2014 The Chromium Authors. All rights reserved. +// Copyright 2013 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. diff --git a/chrome/renderer/resources/renderer_resources.grd b/chrome/renderer/resources/renderer_resources.grd index 2f31503..037447d 100644 --- a/chrome/renderer/resources/renderer_resources.grd +++ b/chrome/renderer/resources/renderer_resources.grd @@ -85,9 +85,9 @@ <include name="IDR_WEB_VIEW_DENY_JS" file="extensions\web_view_deny.js" type="BINDATA" /> <include name="IDR_WEB_VIEW_EVENTS_JS" file="extensions\web_view_events.js" type="BINDATA" /> <include name="IDR_WEB_VIEW_EXPERIMENTAL_JS" file="extensions\web_view_experimental.js" type="BINDATA" /> - <include name="IDR_WEB_VIEW_INTERNAL_CUSTOM_BINDINGS_JS" file="extensions\web_view_internal_custom_bindings.js" type="BINDATA" /> <include name="IDR_WEB_VIEW_JS" file="extensions\web_view.js" type="BINDATA" /> - <include name="IDR_WEB_VIEW_REQUEST_CUSTOM_BINDINGS_JS" file="extensions\web_view_request_custom_bindings.js" type="BINDATA" /> + <include name="IDR_WEBVIEW_CUSTOM_BINDINGS_JS" file="extensions\webview_custom_bindings.js" type="BINDATA" /> + <include name="IDR_WEB_VIEW_REQUEST_CUSTOM_BINDINGS_JS" file="extensions\webview_request_custom_bindings.js" type="BINDATA" /> <!-- Platform app support. --> <include name="IDR_INJECT_APP_TITLEBAR_JS" file="extensions\inject_app_titlebar.js" type="BINDATA" /> |