diff options
author | lazyboy@chromium.org <lazyboy@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-06-25 17:39:11 +0000 |
---|---|---|
committer | lazyboy@chromium.org <lazyboy@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-06-25 17:39:11 +0000 |
commit | 1a895fbc4c5a8b5b763593092d93a2bfed4b7417 (patch) | |
tree | 60b0bce887796cf9d8bad1c6cef3031636055211 | |
parent | 38b07d57b9069e3fd44b15bb5883432202ddf78a (diff) | |
download | chromium_src-1a895fbc4c5a8b5b763593092d93a2bfed4b7417.zip chromium_src-1a895fbc4c5a8b5b763593092d93a2bfed4b7417.tar.gz chromium_src-1a895fbc4c5a8b5b763593092d93a2bfed4b7417.tar.bz2 |
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
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@279748 0039d316-1c4b-4281-b951-d872f2087c98
30 files changed, 803 insertions, 702 deletions
diff --git a/chrome/browser/extensions/api/declarative/declarative_api.cc b/chrome/browser/extensions/api/declarative/declarative_api.cc index f53ead1..9967de4 100644 --- a/chrome/browser/extensions/api/declarative/declarative_api.cc +++ b/chrome/browser/extensions/api/declarative/declarative_api.cc @@ -9,6 +9,7 @@ #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" @@ -31,20 +32,23 @@ 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: - // webview.onRequest. - // webview.OnMessage. - return event_name.compare(0, strlen(kWebView), kWebView) == 0; + // webViewInternal.onRequest. + // webViewInternal.onMessage. + return event_name.compare(0, + strlen(webview::kWebViewEventPrefix), + webview::kWebViewEventPrefix) == 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(kWebView), kWebRequest); + if (IsWebViewEvent(web_request_event_name)) { + web_request_event_name.replace( + 0, strlen(webview::kWebViewEventPrefix), 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 5560282..4a192bb 100644 --- a/chrome/browser/extensions/api/web_request/web_request_api.cc +++ b/chrome/browser/extensions/api/web_request/web_request_api.cc @@ -92,8 +92,7 @@ namespace activitylog = activity_log_web_request_constants; namespace { -const char kWebRequest[] = "webRequest"; -const char kWebView[] = "webview"; +const char kWebRequestEventPrefix[] = "webRequest."; // List of all the webRequest events. const char* const kWebRequestEvents[] = { @@ -140,8 +139,11 @@ const char* GetRequestStageAsString( bool IsWebRequestEvent(const std::string& event_name) { std::string web_request_event_name(event_name); - if (web_request_event_name.find(kWebView) != std::string::npos) - web_request_event_name.replace(0, sizeof(kWebView) - 1, kWebRequest); + if (StartsWithASCII( + web_request_event_name, webview::kWebViewEventPrefix, true)) { + web_request_event_name.replace( + 0, strlen(webview::kWebViewEventPrefix), kWebRequestEventPrefix); + } return std::find(kWebRequestEvents, ARRAYEND(kWebRequestEvents), web_request_event_name) != ARRAYEND(kWebRequestEvents); } @@ -454,7 +456,8 @@ WebRequestAPI::WebRequestAPI(content::BrowserContext* context) event_router->RegisterObserver(this, event_name); // Also observe the corresponding webview event. - event_name.replace(0, sizeof(kWebRequest) - 1, kWebView); + event_name.replace( + 0, sizeof(kWebRequestEventPrefix) - 1, webview::kWebViewEventPrefix); event_router->RegisterObserver(this, event_name); } } @@ -1466,8 +1469,10 @@ 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(kWebRequest) - 1, kWebView); + if (is_web_view_guest) { + web_request_event_name.replace( + 0, sizeof(kWebRequestEventPrefix) - 1, webview::kWebViewEventPrefix); + } std::set<EventListener>& listeners = listeners_[profile][web_request_event_name]; diff --git a/chrome/browser/extensions/api/webview/OWNERS b/chrome/browser/extensions/api/web_view/OWNERS index 057dbdc..057dbdc 100644 --- a/chrome/browser/extensions/api/webview/OWNERS +++ b/chrome/browser/extensions/api/web_view/OWNERS diff --git a/chrome/browser/extensions/api/webview/webview_api.cc b/chrome/browser/extensions/api/web_view/web_view_internal_api.cc index 1f1f626..598c9ff 100644 --- a/chrome/browser/extensions/api/webview/webview_api.cc +++ b/chrome/browser/extensions/api/web_view/web_view_internal_api.cc @@ -1,8 +1,8 @@ -// Copyright (c) 2013 The Chromium Authors. All rights reserved. +// 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. -#include "chrome/browser/extensions/api/webview/webview_api.h" +#include "chrome/browser/extensions/api/web_view/web_view_internal_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::webview; +namespace webview = extensions::api::web_view_internal; namespace extensions { @@ -46,7 +46,7 @@ int MaskForKey(const char* key) { } // namespace -bool WebviewExtensionFunction::RunAsync() { +bool WebViewInternalExtensionFunction::RunAsync() { int instance_id = 0; EXTENSION_FUNCTION_VALIDATE(args_->GetInteger(0, &instance_id)); WebViewGuest* guest = WebViewGuest::From( @@ -58,8 +58,8 @@ bool WebviewExtensionFunction::RunAsync() { } // TODO(lazyboy): Add checks similar to -// WebviewExtensionFunction::RunAsyncSafe(WebViewGuest*). -bool WebviewContextMenusCreateFunction::RunAsync() { +// WebViewInternalExtensionFunction::RunAsyncSafe(WebViewGuest*). +bool WebViewInternalContextMenusCreateFunction::RunAsync() { scoped_ptr<webview::ContextMenusCreate::Params> params( webview::ContextMenusCreate::Params::Create(*args_)); EXTENSION_FUNCTION_VALIDATE(params.get()); @@ -71,7 +71,7 @@ bool WebviewContextMenusCreateFunction::RunAsync() { if (params->create_properties.id.get()) { id.string_uid = *params->create_properties.id; } else { - // The Generated Id is added by webview_custom_bindings.js. + // The Generated Id is added by web_view_internal_custom_bindings.js. base::DictionaryValue* properties = NULL; EXTENSION_FUNCTION_VALIDATE(args_->GetDictionary(1, &properties)); EXTENSION_FUNCTION_VALIDATE( @@ -89,7 +89,7 @@ bool WebviewContextMenusCreateFunction::RunAsync() { return success; } -bool WebviewNavigateFunction::RunAsyncSafe(WebViewGuest* guest) { +bool WebViewInternalNavigateFunction::RunAsyncSafe(WebViewGuest* guest) { scoped_ptr<webview::Navigate::Params> params( webview::Navigate::Params::Create(*args_)); EXTENSION_FUNCTION_VALIDATE(params.get()); @@ -98,7 +98,7 @@ bool WebviewNavigateFunction::RunAsyncSafe(WebViewGuest* guest) { return true; } -bool WebviewContextMenusUpdateFunction::RunAsync() { +bool WebViewInternalContextMenusUpdateFunction::RunAsync() { scoped_ptr<webview::ContextMenusUpdate::Params> params( webview::ContextMenusUpdate::Params::Create(*args_)); EXTENSION_FUNCTION_VALIDATE(params.get()); @@ -121,7 +121,7 @@ bool WebviewContextMenusUpdateFunction::RunAsync() { return success; } -bool WebviewContextMenusRemoveFunction::RunAsync() { +bool WebViewInternalContextMenusRemoveFunction::RunAsync() { scoped_ptr<webview::ContextMenusRemove::Params> params( webview::ContextMenusRemove::Params::Create(*args_)); EXTENSION_FUNCTION_VALIDATE(params.get()); @@ -157,7 +157,7 @@ bool WebviewContextMenusRemoveFunction::RunAsync() { return success; } -bool WebviewContextMenusRemoveAllFunction::RunAsync() { +bool WebViewInternalContextMenusRemoveAllFunction::RunAsync() { scoped_ptr<webview::ContextMenusRemoveAll::Params> params( webview::ContextMenusRemoveAll::Params::Create(*args_)); EXTENSION_FUNCTION_VALIDATE(params.get()); @@ -172,15 +172,17 @@ bool WebviewContextMenusRemoveAllFunction::RunAsync() { return true; } -WebviewClearDataFunction::WebviewClearDataFunction() - : remove_mask_(0), bad_message_(false) {} +WebViewInternalClearDataFunction::WebViewInternalClearDataFunction() + : remove_mask_(0), bad_message_(false) { +} -WebviewClearDataFunction::~WebviewClearDataFunction() {} +WebViewInternalClearDataFunction::~WebViewInternalClearDataFunction() { +} // 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 WebviewClearDataFunction::GetRemovalMask() { +uint32 WebViewInternalClearDataFunction::GetRemovalMask() { base::DictionaryValue* data_to_remove; if (!args_->GetDictionary(2, &data_to_remove)) { bad_message_ = true; @@ -188,8 +190,7 @@ uint32 WebviewClearDataFunction::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)) { @@ -205,7 +206,7 @@ uint32 WebviewClearDataFunction::GetRemovalMask() { // TODO(lazyboy): Parameters in this extension function are similar (or a // sub-set) to BrowsingDataRemoverFunction. How can we share this code? -bool WebviewClearDataFunction::RunAsyncSafe(WebViewGuest* guest) { +bool WebViewInternalClearDataFunction::RunAsyncSafe(WebViewGuest* guest) { // Grab the initial |options| parameter, and parse out the arguments. base::DictionaryValue* options; EXTENSION_FUNCTION_VALIDATE(args_->GetDictionary(1, &options)); @@ -222,23 +223,22 @@ bool WebviewClearDataFunction::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 WebviewClearDataFunction::Done(). + AddRef(); // Balanced below or in WebViewInternalClearDataFunction::Done(). bool scheduled = false; if (remove_mask_) { scheduled = guest->ClearData( remove_since_, remove_mask_, - base::Bind(&WebviewClearDataFunction::ClearDataDone, - this)); + base::Bind(&WebViewInternalClearDataFunction::ClearDataDone, this)); } if (!remove_mask_ || !scheduled) { SendResponse(false); @@ -250,18 +250,19 @@ bool WebviewClearDataFunction::RunAsyncSafe(WebViewGuest* guest) { return true; } -void WebviewClearDataFunction::ClearDataDone() { +void WebViewInternalClearDataFunction::ClearDataDone() { Release(); // Balanced in RunAsync(). SendResponse(true); } -WebviewExecuteCodeFunction::WebviewExecuteCodeFunction() - : guest_instance_id_(0), guest_src_(GURL::EmptyGURL()) {} +WebViewInternalExecuteCodeFunction::WebViewInternalExecuteCodeFunction() + : guest_instance_id_(0), guest_src_(GURL::EmptyGURL()) { +} -WebviewExecuteCodeFunction::~WebviewExecuteCodeFunction() { +WebViewInternalExecuteCodeFunction::~WebViewInternalExecuteCodeFunction() { } -bool WebviewExecuteCodeFunction::Init() { +bool WebViewInternalExecuteCodeFunction::Init() { if (details_.get()) return true; @@ -290,15 +291,16 @@ bool WebviewExecuteCodeFunction::Init() { return true; } -bool WebviewExecuteCodeFunction::ShouldInsertCSS() const { +bool WebViewInternalExecuteCodeFunction::ShouldInsertCSS() const { return false; } -bool WebviewExecuteCodeFunction::CanExecuteScriptOnPage() { +bool WebViewInternalExecuteCodeFunction::CanExecuteScriptOnPage() { return true; } -extensions::ScriptExecutor* WebviewExecuteCodeFunction::GetScriptExecutor() { +extensions::ScriptExecutor* +WebViewInternalExecuteCodeFunction::GetScriptExecutor() { WebViewGuest* guest = WebViewGuest::From( render_view_host()->GetProcess()->GetID(), guest_instance_id_); if (!guest) @@ -307,70 +309,72 @@ extensions::ScriptExecutor* WebviewExecuteCodeFunction::GetScriptExecutor() { return guest->script_executor(); } -bool WebviewExecuteCodeFunction::IsWebView() const { +bool WebViewInternalExecuteCodeFunction::IsWebView() const { return true; } -const GURL& WebviewExecuteCodeFunction::GetWebViewSrc() const { +const GURL& WebViewInternalExecuteCodeFunction::GetWebViewSrc() const { return guest_src_; } -WebviewExecuteScriptFunction::WebviewExecuteScriptFunction() { +WebViewInternalExecuteScriptFunction::WebViewInternalExecuteScriptFunction() { } -void WebviewExecuteScriptFunction::OnExecuteCodeFinished( +void WebViewInternalExecuteScriptFunction::OnExecuteCodeFinished( const std::string& error, int32 on_page_id, const GURL& on_url, const base::ListValue& result) { if (error.empty()) SetResult(result.DeepCopy()); - WebviewExecuteCodeFunction::OnExecuteCodeFinished(error, on_page_id, on_url, - result); + WebViewInternalExecuteCodeFunction::OnExecuteCodeFinished( + error, on_page_id, on_url, result); } -WebviewInsertCSSFunction::WebviewInsertCSSFunction() { +WebViewInternalInsertCSSFunction::WebViewInternalInsertCSSFunction() { } -bool WebviewInsertCSSFunction::ShouldInsertCSS() const { +bool WebViewInternalInsertCSSFunction::ShouldInsertCSS() const { return true; } -WebviewCaptureVisibleRegionFunction::WebviewCaptureVisibleRegionFunction() { +WebViewInternalCaptureVisibleRegionFunction:: + WebViewInternalCaptureVisibleRegionFunction() { } -WebviewCaptureVisibleRegionFunction::~WebviewCaptureVisibleRegionFunction() { +WebViewInternalCaptureVisibleRegionFunction:: + ~WebViewInternalCaptureVisibleRegionFunction() { } -bool WebviewCaptureVisibleRegionFunction::IsScreenshotEnabled() { +bool WebViewInternalCaptureVisibleRegionFunction::IsScreenshotEnabled() { return true; } -WebContents* WebviewCaptureVisibleRegionFunction::GetWebContentsForID( +WebContents* WebViewInternalCaptureVisibleRegionFunction::GetWebContentsForID( int instance_id) { WebViewGuest* guest = WebViewGuest::From( render_view_host()->GetProcess()->GetID(), instance_id); return guest ? guest->guest_web_contents() : NULL; } -void WebviewCaptureVisibleRegionFunction::OnCaptureFailure( +void WebViewInternalCaptureVisibleRegionFunction::OnCaptureFailure( FailureReason reason) { SendResponse(false); } -WebviewSetNameFunction::WebviewSetNameFunction() { +WebViewInternalSetNameFunction::WebViewInternalSetNameFunction() { } -WebviewSetNameFunction::~WebviewSetNameFunction() { +WebViewInternalSetNameFunction::~WebViewInternalSetNameFunction() { } -WebviewSetZoomFunction::WebviewSetZoomFunction() { +WebViewInternalSetZoomFunction::WebViewInternalSetZoomFunction() { } -WebviewSetZoomFunction::~WebviewSetZoomFunction() { +WebViewInternalSetZoomFunction::~WebViewInternalSetZoomFunction() { } -bool WebviewSetNameFunction::RunAsyncSafe(WebViewGuest* guest) { +bool WebViewInternalSetNameFunction::RunAsyncSafe(WebViewGuest* guest) { scoped_ptr<webview::SetName::Params> params( webview::SetName::Params::Create(*args_)); EXTENSION_FUNCTION_VALIDATE(params.get()); @@ -379,7 +383,7 @@ bool WebviewSetNameFunction::RunAsyncSafe(WebViewGuest* guest) { return true; } -bool WebviewSetZoomFunction::RunAsyncSafe(WebViewGuest* guest) { +bool WebViewInternalSetZoomFunction::RunAsyncSafe(WebViewGuest* guest) { scoped_ptr<webview::SetZoom::Params> params( webview::SetZoom::Params::Create(*args_)); EXTENSION_FUNCTION_VALIDATE(params.get()); @@ -389,13 +393,13 @@ bool WebviewSetZoomFunction::RunAsyncSafe(WebViewGuest* guest) { return true; } -WebviewGetZoomFunction::WebviewGetZoomFunction() { +WebViewInternalGetZoomFunction::WebViewInternalGetZoomFunction() { } -WebviewGetZoomFunction::~WebviewGetZoomFunction() { +WebViewInternalGetZoomFunction::~WebViewInternalGetZoomFunction() { } -bool WebviewGetZoomFunction::RunAsyncSafe(WebViewGuest* guest) { +bool WebViewInternalGetZoomFunction::RunAsyncSafe(WebViewGuest* guest) { scoped_ptr<webview::GetZoom::Params> params( webview::GetZoom::Params::Create(*args_)); EXTENSION_FUNCTION_VALIDATE(params.get()); @@ -406,22 +410,21 @@ bool WebviewGetZoomFunction::RunAsyncSafe(WebViewGuest* guest) { return true; } -WebviewFindFunction::WebviewFindFunction() { +WebViewInternalFindFunction::WebViewInternalFindFunction() { } -WebviewFindFunction::~WebviewFindFunction() { +WebViewInternalFindFunction::~WebViewInternalFindFunction() { } -bool WebviewFindFunction::RunAsyncSafe(WebViewGuest* guest) { +bool WebViewInternalFindFunction::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; @@ -436,13 +439,13 @@ bool WebviewFindFunction::RunAsyncSafe(WebViewGuest* guest) { return true; } -WebviewStopFindingFunction::WebviewStopFindingFunction() { +WebViewInternalStopFindingFunction::WebViewInternalStopFindingFunction() { } -WebviewStopFindingFunction::~WebviewStopFindingFunction() { +WebViewInternalStopFindingFunction::~WebViewInternalStopFindingFunction() { } -bool WebviewStopFindingFunction::RunAsyncSafe(WebViewGuest* guest) { +bool WebViewInternalStopFindingFunction::RunAsyncSafe(WebViewGuest* guest) { scoped_ptr<webview::StopFinding::Params> params( webview::StopFinding::Params::Create(*args_)); EXTENSION_FUNCTION_VALIDATE(params.get()); @@ -467,13 +470,13 @@ bool WebviewStopFindingFunction::RunAsyncSafe(WebViewGuest* guest) { return true; } -WebviewGoFunction::WebviewGoFunction() { +WebViewInternalGoFunction::WebViewInternalGoFunction() { } -WebviewGoFunction::~WebviewGoFunction() { +WebViewInternalGoFunction::~WebViewInternalGoFunction() { } -bool WebviewGoFunction::RunAsyncSafe(WebViewGuest* guest) { +bool WebViewInternalGoFunction::RunAsyncSafe(WebViewGuest* guest) { scoped_ptr<webview::Go::Params> params(webview::Go::Params::Create(*args_)); EXTENSION_FUNCTION_VALIDATE(params.get()); @@ -481,24 +484,24 @@ bool WebviewGoFunction::RunAsyncSafe(WebViewGuest* guest) { return true; } -WebviewReloadFunction::WebviewReloadFunction() { +WebViewInternalReloadFunction::WebViewInternalReloadFunction() { } -WebviewReloadFunction::~WebviewReloadFunction() { +WebViewInternalReloadFunction::~WebViewInternalReloadFunction() { } -bool WebviewReloadFunction::RunAsyncSafe(WebViewGuest* guest) { +bool WebViewInternalReloadFunction::RunAsyncSafe(WebViewGuest* guest) { guest->Reload(); return true; } -WebviewSetPermissionFunction::WebviewSetPermissionFunction() { +WebViewInternalSetPermissionFunction::WebViewInternalSetPermissionFunction() { } -WebviewSetPermissionFunction::~WebviewSetPermissionFunction() { +WebViewInternalSetPermissionFunction::~WebViewInternalSetPermissionFunction() { } -bool WebviewSetPermissionFunction::RunAsyncSafe(WebViewGuest* guest) { +bool WebViewInternalSetPermissionFunction::RunAsyncSafe(WebViewGuest* guest) { scoped_ptr<webview::SetPermission::Params> params( webview::SetPermission::Params::Create(*args_)); EXTENSION_FUNCTION_VALIDATE(params.get()); @@ -532,13 +535,15 @@ bool WebviewSetPermissionFunction::RunAsyncSafe(WebViewGuest* guest) { return true; } -WebviewShowContextMenuFunction::WebviewShowContextMenuFunction() { +WebViewInternalShowContextMenuFunction:: + WebViewInternalShowContextMenuFunction() { } -WebviewShowContextMenuFunction::~WebviewShowContextMenuFunction() { +WebViewInternalShowContextMenuFunction:: + ~WebViewInternalShowContextMenuFunction() { } -bool WebviewShowContextMenuFunction::RunAsyncSafe(WebViewGuest* guest) { +bool WebViewInternalShowContextMenuFunction::RunAsyncSafe(WebViewGuest* guest) { scoped_ptr<webview::ShowContextMenu::Params> params( webview::ShowContextMenu::Params::Create(*args_)); EXTENSION_FUNCTION_VALIDATE(params.get()); @@ -551,39 +556,42 @@ bool WebviewShowContextMenuFunction::RunAsyncSafe(WebViewGuest* guest) { return true; } -WebviewOverrideUserAgentFunction::WebviewOverrideUserAgentFunction() { +WebViewInternalOverrideUserAgentFunction:: + WebViewInternalOverrideUserAgentFunction() { } -WebviewOverrideUserAgentFunction::~WebviewOverrideUserAgentFunction() { +WebViewInternalOverrideUserAgentFunction:: + ~WebViewInternalOverrideUserAgentFunction() { } -bool WebviewOverrideUserAgentFunction::RunAsyncSafe(WebViewGuest* guest) { - scoped_ptr<extensions::api::webview::OverrideUserAgent::Params> params( - extensions::api::webview::OverrideUserAgent::Params::Create(*args_)); +bool WebViewInternalOverrideUserAgentFunction::RunAsyncSafe( + WebViewGuest* guest) { + scoped_ptr<webview::OverrideUserAgent::Params> params( + webview::OverrideUserAgent::Params::Create(*args_)); EXTENSION_FUNCTION_VALIDATE(params.get()); guest->SetUserAgentOverride(params->user_agent_override); return true; } -WebviewStopFunction::WebviewStopFunction() { +WebViewInternalStopFunction::WebViewInternalStopFunction() { } -WebviewStopFunction::~WebviewStopFunction() { +WebViewInternalStopFunction::~WebViewInternalStopFunction() { } -bool WebviewStopFunction::RunAsyncSafe(WebViewGuest* guest) { +bool WebViewInternalStopFunction::RunAsyncSafe(WebViewGuest* guest) { guest->Stop(); return true; } -WebviewTerminateFunction::WebviewTerminateFunction() { +WebViewInternalTerminateFunction::WebViewInternalTerminateFunction() { } -WebviewTerminateFunction::~WebviewTerminateFunction() { +WebViewInternalTerminateFunction::~WebViewInternalTerminateFunction() { } -bool WebviewTerminateFunction::RunAsyncSafe(WebViewGuest* guest) { +bool WebViewInternalTerminateFunction::RunAsyncSafe(WebViewGuest* guest) { guest->Terminate(); return true; } 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 new file mode 100644 index 0000000..3ccf27d --- /dev/null +++ b/chrome/browser/extensions/api/web_view/web_view_internal_api.h @@ -0,0 +1,443 @@ +// 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/webview/webview_api.h b/chrome/browser/extensions/api/webview/webview_api.h deleted file mode 100644 index dfd6d72..0000000 --- a/chrome/browser/extensions/api/webview/webview_api.h +++ /dev/null @@ -1,418 +0,0 @@ -// 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 0a06139..e40b467 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/webview.h" +#include "chrome/common/extensions/api/web_view_internal.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 webview = api::webview; +namespace web_view = api::web_view_internal; namespace { @@ -300,7 +300,8 @@ bool MenuItem::PopulateURLPatterns( // static const char MenuManager::kOnContextMenus[] = "contextMenus"; -const char MenuManager::kOnWebviewContextMenus[] = "webview.contextMenus"; +const char MenuManager::kOnWebviewContextMenus[] = + "webViewInternal.contextMenus"; MenuManager::MenuManager(Profile* profile, StateStore* store) : extension_registry_observer_(this), profile_(profile), store_(store) { @@ -654,7 +655,7 @@ void MenuManager::ExecuteCommand(Profile* profile, WebViewGuest* webview_guest = WebViewGuest::FromWebContents(web_contents); if (webview_guest) { - // This is used in webview_custom_bindings.js. + // This is used in web_view_internalcustom_bindings.js. // The property is not exposed to developer API. properties->SetInteger("webviewInstanceId", webview_guest->view_instance_id()); @@ -709,7 +710,7 @@ void MenuManager::ExecuteCommand(Profile* profile, { // Dispatch to .contextMenus.onClicked handler. scoped_ptr<Event> event( - new Event(webview_guest ? webview::OnClicked::kEventName + new Event(webview_guest ? web_view::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 f0116a8..d844581 100644 --- a/chrome/browser/guest_view/web_view/web_view_constants.cc +++ b/chrome/browser/guest_view/web_view/web_view_constants.cc @@ -7,27 +7,30 @@ namespace webview { // Events. -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"; +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."; // 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 0357088..bddc7d5 100644 --- a/chrome/browser/guest_view/web_view/web_view_constants.h +++ b/chrome/browser/guest_view/web_view/web_view_constants.h @@ -32,6 +32,9 @@ 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 e292a50..27b960b 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,19 +6,18 @@ #include <utility> -#include "chrome/browser/extensions/api/webview/webview_api.h" +#include "chrome/browser/extensions/api/web_view/web_view_internal_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()); @@ -28,7 +27,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()); @@ -40,7 +39,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()); @@ -50,9 +49,10 @@ 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,35 +71,33 @@ 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 WebviewFindFunction object. + // delete its map entry to free the WebViewInternalFindFunction object. (*i)->SendResponse(canceled); find_info_map_.erase((*i)->request_id_); } - // Erase the first find request's map entry to free the WebviewFindFunction + // Erase the first find request's map entry to free the + // WebViewInternalFindFunction // 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::WebviewFindFunction> find_function) { + scoped_refptr<extensions::WebViewInternalFindFunction> 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); @@ -133,7 +131,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, @@ -147,7 +145,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 && @@ -176,14 +174,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, @@ -202,7 +200,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_); @@ -214,14 +212,15 @@ 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, @@ -230,17 +229,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::WebviewFindFunction> find_function) + scoped_refptr<extensions::WebViewInternalFindFunction> find_function) : request_id_(request_id), search_text_(search_text), options_(options), @@ -249,10 +248,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, @@ -262,12 +261,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 d8b26e36..9d4d74c 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,15 +15,16 @@ #include "ui/gfx/geometry/rect.h" namespace extensions { -class WebviewFindFunction; +class WebViewInternalFindFunction; } // namespace extensions class WebViewGuest; -// Helper class for find requests and replies for the webview find API. -class WebviewFindHelper { +// Helper class for find requests and replies for the web_view_internal 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(); @@ -36,10 +37,11 @@ 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::WebviewFindFunction> find_function); + void Find( + content::WebContents* guest_web_contents, + const base::string16& search_text, + const blink::WebFindOptions& options, + scoped_refptr<extensions::WebViewInternalFindFunction> find_function); // Helper function for WeViewGuest:FindReply(). void FindReply(int request_id, @@ -69,7 +71,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); @@ -100,10 +102,11 @@ 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::WebviewFindFunction> find_function); + FindInfo( + int request_id, + const base::string16& search_text, + const blink::WebFindOptions& options, + scoped_refptr<extensions::WebViewInternalFindFunction> find_function); ~FindInfo(); // Add another request to |find_next_requests_|. @@ -143,7 +146,7 @@ class WebviewFindHelper { const int request_id_; const base::string16 search_text_; blink::WebFindOptions options_; - scoped_refptr<extensions::WebviewFindFunction> find_function_; + scoped_refptr<extensions::WebViewInternalFindFunction> find_function_; FindResults find_results_; // A find reply has been received for this find request. @@ -156,7 +159,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); @@ -180,7 +183,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 1b0a442..0c1065b 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/webview/webview_api.h" +#include "chrome/browser/extensions/api/web_view/web_view_internal_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::WebviewFindFunction> find_function) { + scoped_refptr<extensions::WebViewInternalFindFunction> 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 e50bab7..f9aa6c6 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/webview.h" +#include "chrome/common/extensions/api/web_view_internal.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::webview; +namespace webview_api = extensions::api::web_view_internal; class RenderViewContextMenu; namespace extensions { class ScriptExecutor; -class WebviewFindFunction; +class WebViewInternalFindFunction; } // namespace extensions namespace ui { @@ -167,9 +167,10 @@ 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::WebviewFindFunction> find_function); + void Find( + const base::string16& search_text, + const blink::WebFindOptions& options, + scoped_refptr<extensions::WebViewInternalFindFunction> find_function); // Conclude a find request to clear highlighting. void StopFinding(content::StopFindAction); @@ -468,12 +469,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 a330395..4b5eb00 100644 --- a/chrome/chrome_browser_extensions.gypi +++ b/chrome/chrome_browser_extensions.gypi @@ -632,6 +632,8 @@ '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', @@ -640,8 +642,6 @@ '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 86c2953..a846b8c 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/webview_custom_bindings.js', + 'renderer/resources/extensions/web_view_internal_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 479a405..205326d5 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"] }, - "webview": { + "webViewInternal": { "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 3f3fde9..530b913 100644 --- a/chrome/common/extensions/api/api.gyp +++ b/chrome/common/extensions/api/api.gyp @@ -23,6 +23,7 @@ 'tab_capture.idl', 'tabs.json', 'types.json', + 'web_navigation.json', 'windows.json', ], @@ -124,7 +125,7 @@ 'webrtc_audio_private.idl', 'webrtc_logging_private.idl', 'webstore_private.json', - 'webview.json', + 'web_view_internal.json', 'windows.json', ], 'main_non_compiled_schema_files': [ diff --git a/chrome/common/extensions/api/webview.json b/chrome/common/extensions/api/web_view_internal.json index 63278ae..94bf180 100644 --- a/chrome/common/extensions/api/webview.json +++ b/chrome/common/extensions/api/web_view_internal.json @@ -1,11 +1,14 @@ -// Copyright (c) 2013 The Chromium Authors. All rights reserved. +// 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. [ { - "namespace": "webview", + "namespace": "webViewInternal", "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/webview_request.json b/chrome/common/extensions/api/web_view_request.json index 653e195..826cfa3 100644 --- a/chrome/common/extensions/api/webview_request.json +++ b/chrome/common/extensions/api/web_view_request.json @@ -1,4 +1,4 @@ -// Copyright 2013 The Chromium Authors. All rights reserved. +// 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. diff --git a/chrome/common/extensions/chrome_extensions_client.cc b/chrome/common/extensions/chrome_extensions_client.cc index d668b1b..929faa2 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_WEBVIEW_REQUEST); + IDR_EXTENSION_API_JSON_WEB_VIEW_REQUEST); #endif // defined(ENABLE_EXTENSIONS) } diff --git a/chrome/common/extensions_api_resources.grd b/chrome/common/extensions_api_resources.grd index 6f77ab7..5598aaf 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_WEBVIEW_REQUEST" file="extensions\api\webview_request.json" type="BINDATA" /> + <include name="IDR_EXTENSION_API_JSON_WEB_VIEW_REQUEST" file="extensions\api\web_view_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 08fbf5b..08bc023 100644 --- a/chrome/renderer/extensions/chrome_extensions_dispatcher_delegate.cc +++ b/chrome/renderer/extensions/chrome_extensions_dispatcher_delegate.cc @@ -236,7 +236,8 @@ void ChromeExtensionsDispatcherDelegate::PopulateSourceMap( // Platform app sources that are not API-specific.. source_map->RegisterSource("tagWatcher", IDR_TAG_WATCHER_JS); - source_map->RegisterSource("webview", IDR_WEBVIEW_CUSTOM_BINDINGS_JS); + source_map->RegisterSource("webViewInternal", + IDR_WEB_VIEW_INTERNAL_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 f3abbec..171b6a6 100644 --- a/chrome/renderer/resources/extensions/web_view.js +++ b/chrome/renderer/resources/extensions/web_view.js @@ -10,7 +10,9 @@ var DocumentNatives = requireNative('document_natives'); var GuestViewInternal = require('binding').Binding.create('guestViewInternal').generate(); var IdGenerator = requireNative('id_generator'); -var WebView = require('webview').WebView; +// TODO(lazyboy): Rename this to WebViewInternal and call WebViewInternal +// something else. +var WebView = require('webViewInternal').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 441e623..3729cff 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('webview').WebView; +var WebView = require('webViewInternal').WebView; var CreateEvent = function(name) { var eventOpts = {supportsListeners: true, supportsFilters: true}; return new EventBindings.Event(name, undefined, eventOpts); }; -var FrameNameChangedEvent = CreateEvent('webview.onFrameNameChanged'); -var WebRequestMessageEvent = CreateEvent('webview.onMessage'); +var FrameNameChangedEvent = CreateEvent('webViewInternal.onFrameNameChanged'); +var WebRequestMessageEvent = CreateEvent('webViewInternal.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('webview.onMessage'); // handler. The event must have a custom handler for this to be meaningful. var WEB_VIEW_EVENTS = { 'close': { - evt: CreateEvent('webview.onClose'), + evt: CreateEvent('webViewInternal.onClose'), fields: [] }, 'consolemessage': { - evt: CreateEvent('webview.onConsoleMessage'), + evt: CreateEvent('webViewInternal.onConsoleMessage'), fields: ['level', 'message', 'line', 'sourceId'] }, 'contentload': { - evt: CreateEvent('webview.onContentLoad'), + evt: CreateEvent('webViewInternal.onContentLoad'), fields: [] }, 'contextmenu': { - evt: CreateEvent('webview.contextmenu'), + evt: CreateEvent('webViewInternal.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('webview.onDialog'), + evt: CreateEvent('webViewInternal.onDialog'), fields: ['defaultPromptText', 'messageText', 'messageType', 'url'] }, 'exit': { - evt: CreateEvent('webview.onExit'), + evt: CreateEvent('webViewInternal.onExit'), fields: ['processId', 'reason'] }, 'loadabort': { @@ -74,30 +74,30 @@ var WEB_VIEW_EVENTS = { customHandler: function(handler, event, webViewEvent) { handler.handleLoadAbortEvent(event, webViewEvent); }, - evt: CreateEvent('webview.onLoadAbort'), + evt: CreateEvent('webViewInternal.onLoadAbort'), fields: ['url', 'isTopLevel', 'reason'] }, 'loadcommit': { customHandler: function(handler, event, webViewEvent) { handler.handleLoadCommitEvent(event, webViewEvent); }, - evt: CreateEvent('webview.onLoadCommit'), + evt: CreateEvent('webViewInternal.onLoadCommit'), fields: ['url', 'isTopLevel'] }, 'loadprogress': { - evt: CreateEvent('webview.onLoadProgress'), + evt: CreateEvent('webViewInternal.onLoadProgress'), fields: ['url', 'progress'] }, 'loadredirect': { - evt: CreateEvent('webview.onLoadRedirect'), + evt: CreateEvent('webViewInternal.onLoadRedirect'), fields: ['isTopLevel', 'oldUrl', 'newUrl'] }, 'loadstart': { - evt: CreateEvent('webview.onLoadStart'), + evt: CreateEvent('webViewInternal.onLoadStart'), fields: ['url', 'isTopLevel'] }, 'loadstop': { - evt: CreateEvent('webview.onLoadStop'), + evt: CreateEvent('webViewInternal.onLoadStop'), fields: [] }, 'newwindow': { @@ -105,7 +105,7 @@ var WEB_VIEW_EVENTS = { customHandler: function(handler, event, webViewEvent) { handler.handleNewWindowEvent(event, webViewEvent); }, - evt: CreateEvent('webview.onNewWindow'), + evt: CreateEvent('webViewInternal.onNewWindow'), fields: [ 'initialHeight', 'initialWidth', @@ -119,7 +119,7 @@ var WEB_VIEW_EVENTS = { customHandler: function(handler, event, webViewEvent) { handler.handlePermissionEvent(event, webViewEvent); }, - evt: CreateEvent('webview.onPermissionRequest'), + evt: CreateEvent('webViewInternal.onPermissionRequest'), fields: [ 'identifier', 'lastUnlockedBySelf', @@ -131,18 +131,18 @@ var WEB_VIEW_EVENTS = { ] }, 'responsive': { - evt: CreateEvent('webview.onResponsive'), + evt: CreateEvent('webViewInternal.onResponsive'), fields: ['processId'] }, 'sizechanged': { - evt: CreateEvent('webview.onSizeChanged'), + evt: CreateEvent('webViewInternal.onSizeChanged'), customHandler: function(handler, event, webViewEvent) { handler.handleSizeChangedEvent(event, webViewEvent); }, fields: ['oldHeight', 'oldWidth', 'newHeight', 'newWidth'] }, 'unresponsive': { - evt: CreateEvent('webview.onUnresponsive'), + evt: CreateEvent('webViewInternal.onUnresponsive'), fields: ['processId'] } }; @@ -201,7 +201,7 @@ WebViewEvents.prototype.setupWebRequestEvents = function() { if (!self[webRequestEvent.name]) { self[webRequestEvent.name] = new WebRequestEvent( - 'webview.' + webRequestEvent.name, + 'webViewInternal.' + 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( - 'webview.' + webRequestEvent.name, + 'webViewInternal.' + 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 webview.'; + 'Unable to attach the new window to the provided webViewInternal.'; 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 c927d2a4..05a3b8c 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('webView').WebView; +var WebView = require('webViewInternal').WebView; var WebViewInternal = require('webView').WebViewInternal; -var WebViewSchema = requireNative('schema_registry').GetSchema('webview'); +var WebViewSchema = requireNative('schema_registry').GetSchema('webViewInternal'); 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('webview.onFindReply'), + evt: CreateEvent('webViewInternal.onFindReply'), fields: [ 'searchText', 'numberOfMatches', @@ -46,7 +46,7 @@ var WEB_VIEW_EXPERIMENTAL_EVENTS = { ] }, 'zoomchange': { - evt: CreateEvent('webview.onZoomChange'), + evt: CreateEvent('webViewInternal.onZoomChange'), fields: ['oldZoomFactor', 'newZoomFactor'] } }; @@ -55,7 +55,7 @@ function GetUniqueSubEventName(eventName) { return eventName + "/" + idGeneratorNatives.GetNextId(); } -// This is the only "webview.onClicked" named event for this renderer. +// This is the only "webViewInternal.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('webview.onClicked'); +var ContextMenusEvent = CreateEvent('webViewInternal.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 = 'webview.onClicked'; + var eventName = 'webViewInternal.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/webview_custom_bindings.js b/chrome/renderer/resources/extensions/web_view_internal_custom_bindings.js index a7da243..6ab8d0d 100644 --- a/chrome/renderer/resources/extensions/webview_custom_bindings.js +++ b/chrome/renderer/resources/extensions/web_view_internal_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('webview'); +var binding = require('binding').Binding.create('webViewInternal'); 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 = 'webview.contextMenus'; + var ename = 'webViewInternal.contextMenus'; webviewContextMenus.event = new EventBindings.Event(ename); webviewContextMenus.getIdFromCreateProperties = function(prop) { diff --git a/chrome/renderer/resources/extensions/webview_request_custom_bindings.js b/chrome/renderer/resources/extensions/web_view_request_custom_bindings.js index f1aa3ea..62f7459 100644 --- a/chrome/renderer/resources/extensions/webview_request_custom_bindings.js +++ b/chrome/renderer/resources/extensions/web_view_request_custom_bindings.js @@ -1,4 +1,4 @@ -// Copyright 2013 The Chromium Authors. All rights reserved. +// 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. diff --git a/chrome/renderer/resources/renderer_resources.grd b/chrome/renderer/resources/renderer_resources.grd index 037447d..2f31503 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_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" /> + <include name="IDR_WEB_VIEW_REQUEST_CUSTOM_BINDINGS_JS" file="extensions\web_view_request_custom_bindings.js" type="BINDATA" /> <!-- Platform app support. --> <include name="IDR_INJECT_APP_TITLEBAR_JS" file="extensions\inject_app_titlebar.js" type="BINDATA" /> diff --git a/extensions/browser/extension_function_histogram_value.h b/extensions/browser/extension_function_histogram_value.h index e175cb4..bb15481 100644 --- a/extensions/browser/extension_function_histogram_value.h +++ b/extensions/browser/extension_function_histogram_value.h @@ -455,7 +455,7 @@ enum HistogramValue { COOKIES_GETALLCOOKIESTORES, MEDIAGALLERIESPRIVATE_ADDGALLERYWATCH, MEDIAGALLERIESPRIVATE_REMOVEGALLERYWATCH, - WEBVIEW_EXECUTESCRIPT, + DELETED_WEBVIEW_EXECUTESCRIPT, NOTIFICATIONS_UPDATE, NOTIFICATIONS_CLEAR, DELETED_SESSIONRESTORE_GETRECENTLYCLOSED, @@ -526,7 +526,7 @@ enum HistogramValue { SOCKET_MULTICAST_GET_JOINED_GROUPS, EXPERIMENTAL_ACCESSIBILITY_SETNATIVEACCESSIBILITYENABLED, RUNTIME_GETPLATFORMINFO, - WEBVIEW_INSERTCSS, + DELETED_WEBVIEW_INSERTCSS, METRICSPRIVATE_GETISCRASHRECORDINGENABLED, IDENTITYPRIVATE_GETSTRINGS, NOTIFICATIONS_GET_ALL, @@ -555,12 +555,12 @@ enum HistogramValue { DIAGNOSTICS_SENDPACKET, METRICSPRIVATE_GETFIELDTRIAL, FILEBROWSERPRIVATE_ZOOM, - WEBVIEW_GO, + DELETED_WEBVIEW_GO, WEBSTOREPRIVATE_ISININCOGNITOMODEFUNCTION, FILEBROWSERPRIVATE_REQUESTACCESSTOKEN, - WEBVIEW_STOP, - WEBVIEW_RELOAD, - WEBVIEW_TERMINATE, + DELETED_WEBVIEW_STOP, + DELETED_WEBVIEW_RELOAD, + DELETED_WEBVIEW_TERMINATE, TYPES_PRIVATE_CHROMEDIRECTSETTING_GET, TYPES_PRIVATE_CHROMEDIRECTSETTING_SET, TYPES_PRIVATE_CHROMEDIRECTSETTING_CLEAR, @@ -589,7 +589,7 @@ enum HistogramValue { LOGPRIVATE_GETHISTORICAL, VIRTUALKEYBOARDPRIVATE_MOVECURSOR, METRICSPRIVATE_GETVARIATIONPARAMS, - WEBVIEW_SETPERMISSION, + DELETED_WEBVIEW_SETPERMISSION, DESKTOPCAPTURE_CHOOSEDESKTOPMEDIA, APP_CURRENTWINDOWINTERNAL_SETSHAPE, PROCESSES_GETPROCESSINFO, @@ -609,7 +609,7 @@ enum HistogramValue { SOCKETS_UDP_GETJOINEDGROUPS, SIGNED_IN_DEVICES_GET, AUTOTESTPRIVATE_SIMULATEASANMEMORYBUG, - WEBVIEW_CLEARDATA, + DELETED_WEBVIEW_CLEARDATA, SESSIONS_GETRECENTLYCLOSED, SESSIONS_GETDEVICES, SESSIONS_RESTORE, @@ -639,7 +639,7 @@ enum HistogramValue { WEBRTCLOGGINGPRIVATE_STOP, WEBRTCLOGGINGPRIVATE_UPLOAD, WEBRTCLOGGINGPRIVATE_DISCARD, - WEBVIEW_OVERRIDEUSERAGENT, + DELETED_WEBVIEW_OVERRIDEUSERAGENT, PRINCIPALSPRIVATE_SHOWAVATARBUBBLE, PRINCIPALSPRIVATE_SIGNOUT, CAST_CHANNEL_OPEN, @@ -706,7 +706,7 @@ enum HistogramValue { FIRSTRUNPRIVATE_GETLOCALIZEDSTRINGS, FIRSTRUNPRIVATE_LAUNCHTUTORIAL, SOCKETS_UDP_SETPAUSED, - WEBVIEW_CAPTUREVISIBLEREGION, + DELETED_WEBVIEW_CAPTUREVISIBLEREGION, MEDIAGALLERIES_GETMETADATA, INPUT_IME_SENDKEYEVENTS, VIRTUALKEYBOARDPRIVATE_LOCKKEYBOARD, @@ -740,8 +740,8 @@ enum HistogramValue { HOTWORDPRIVATE_GETSTATUS, APP_CURRENTWINDOWINTERNAL_SETBADGEICON, APP_CURRENTWINDOWINTERNAL_CLEARBADGE, - WEBVIEW_SETZOOM, - WEBVIEW_GETZOOM, + DELETED_WEBVIEW_SETZOOM, + DELETED_WEBVIEW_GETZOOM, DEVELOPERPRIVATE_REQUESTFILESOURCE, DEVELOPERPRIVATE_OPENDEVTOOLS, ACTIVITYLOGPRIVATE_DELETEACTIVITIES, @@ -751,12 +751,12 @@ enum HistogramValue { SCREENLOCKPRIVATE_SETAUTHTYPE, SCREENLOCKPRIVATE_GETAUTHTYPE, SCREENLOCKPRIVATE_ACCEPTAUTHATTEMPT, - WEBVIEW_FIND, - WEBVIEW_STOPFINDING, - WEBVIEW_CONTEXTMENUSCREATE, - WEBVIEW_CONTEXTMENUSUPDATE, - WEBVIEW_CONTEXTMENUSREMOVE, - WEBVIEW_CONTEXTMENUSREMOVEALL, + DELETED_WEBVIEW_FIND, + DELETED_WEBVIEW_STOPFINDING, + DELETED_WEBVIEW_CONTEXTMENUSCREATE, + DELETED_WEBVIEW_CONTEXTMENUSUPDATE, + DELETED_WEBVIEW_CONTEXTMENUSREMOVE, + DELETED_WEBVIEW_CONTEXTMENUSREMOVEALL, AUTOMATIONINTERNAL_ENABLETAB, APP_CURRENTWINDOWINTERNAL_SETSIZECONSTRAINTS, BLUETOOTH_GETDEVICE, @@ -812,7 +812,7 @@ enum HistogramValue { DELETED_FILESYSTEMPROVIDERINTERNAL_GETMETADATAREQUESTEDERROR, BROWSER_OPENTAB, MANAGEMENT_CREATEAPPSHORTCUT, - WEBVIEW_SHOWCONTEXTMENU, + DELETED_WEBVIEW_SHOWCONTEXTMENU, WEBRTCLOGGINGPRIVATE_STARTRTPDUMP, WEBRTCLOGGINGPRIVATE_STOPRTPDUMP, AUTOMATIONINTERNAL_ENABLEDESKTOP, @@ -833,7 +833,7 @@ enum HistogramValue { FILESYSTEMPROVIDERINTERNAL_READFILEREQUESTEDSUCCESS, DELETED_FILESYSTEMPROVIDERINTERNAL_READFILEREQUESTEDERROR, NETWORKINGPRIVATE_GETNETWORKS, - WEBVIEW_SETNAME, + DELETED_WEBVIEW_SETNAME, ENTERPRISE_PLATFORMKEYSINTERNAL_GENERATEKEY, ENTERPRISE_PLATFORMKEYSINTERNAL_SIGN, ENTERPRISE_PLATFORMKEYSINTERNAL_GETTOKENS, @@ -845,7 +845,7 @@ enum HistogramValue { MANAGEMENT_SETLAUNCHTYPE, MANAGEMENT_GENERATEAPPFORLINK, DELETED_GUESTVIEWINTERNAL_ALLOCATEINSTANCEID, - WEBVIEW_NAVIGATE, + DELETED_WEBVIEW_NAVIGATE, INPUTMETHODPRIVATE_GETCURRENTINPUTMETHOD, INPUTMETHODPRIVATE_SETCURRENTINPUTMETHOD, INPUTMETHODPRIVATE_GETINPUTMETHODS, @@ -858,6 +858,27 @@ enum HistogramValue { FILESYSTEMPROVIDERINTERNAL_OPERATIONREQUESTEDERROR, FILESYSTEMPROVIDERINTERNAL_OPERATIONREQUESTEDSUCCESS, GUESTVIEWINTERNAL_CREATEGUEST, + WEBVIEWINTERNAL_CAPTUREVISIBLEREGION, + WEBVIEWINTERNAL_CONTEXTMENUSCREATE, + WEBVIEWINTERNAL_CONTEXTMENUSREMOVE, + WEBVIEWINTERNAL_CONTEXTMENUSREMOVEALL, + WEBVIEWINTERNAL_CONTEXTMENUSUPDATE, + WEBVIEWINTERNAL_CLEARDATA, + WEBVIEWINTERNAL_EXECUTESCRIPT, + WEBVIEWINTERNAL_FIND, + WEBVIEWINTERNAL_GETZOOM, + WEBVIEWINTERNAL_GO, + WEBVIEWINTERNAL_INSERTCSS, + WEBVIEWINTERNAL_NAVIGATE, + WEBVIEWINTERNAL_OVERRIDEUSERAGENT, + WEBVIEWINTERNAL_RELOAD, + WEBVIEWINTERNAL_SETNAME, + WEBVIEWINTERNAL_SETPERMISSION, + WEBVIEWINTERNAL_SETZOOM, + WEBVIEWINTERNAL_SHOWCONTEXTMENU, + WEBVIEWINTERNAL_STOP, + WEBVIEWINTERNAL_STOPFINDING, + WEBVIEWINTERNAL_TERMINATE, // Last entry: Add new entries above and ensure to update // tools/metrics/histograms/histograms/histograms.xml. ENUM_BOUNDARY diff --git a/tools/metrics/histograms/histograms.xml b/tools/metrics/histograms/histograms.xml index 8ff2149..00c2203 100644 --- a/tools/metrics/histograms/histograms.xml +++ b/tools/metrics/histograms/histograms.xml @@ -37506,7 +37506,7 @@ Therefore, the affected-histogram name has to have at least one dot in it. <int value="394" label="COOKIES_GETALLCOOKIESTORES"/> <int value="395" label="MEDIAGALLERIESPRIVATE_ADDGALLERYWATCH"/> <int value="396" label="MEDIAGALLERIESPRIVATE_REMOVEGALLERYWATCH"/> - <int value="397" label="WEBVIEW_EXECUTESCRIPT"/> + <int value="397" label="DELETED_WEBVIEW_EXECUTESCRIPT"/> <int value="398" label="NOTIFICATIONS_UPDATE"/> <int value="399" label="NOTIFICATIONS_CLEAR"/> <int value="400" label="DELETED_SESSIONRESTORE_GETRECENTLYCLOSED"/> @@ -37578,7 +37578,7 @@ Therefore, the affected-histogram name has to have at least one dot in it. <int value="466" label="EXPERIMENTAL_ACCESSIBILITY_SETNATIVEACCESSIBILITYENABLED"/> <int value="467" label="RUNTIME_GETPLATFORMINFO"/> - <int value="468" label="WEBVIEW_INSERTCSS"/> + <int value="468" label="DELETED_WEBVIEW_INSERTCSS"/> <int value="469" label="METRICSPRIVATE_GETISCRASHRECORDINGENABLED"/> <int value="470" label="IDENTITYPRIVATE_GETSTRINGS"/> <int value="471" label="NOTIFICATIONS_GET_ALL"/> @@ -37608,12 +37608,12 @@ Therefore, the affected-histogram name has to have at least one dot in it. <int value="494" label="DIAGNOSTICS_SENDPACKET"/> <int value="495" label="METRICSPRIVATE_GETFIELDTRIAL"/> <int value="496" label="FILEBROWSERPRIVATE_ZOOM"/> - <int value="497" label="WEBVIEW_GO"/> + <int value="497" label="DELETED_WEBVIEW_GO"/> <int value="498" label="WEBSTOREPRIVATE_ISININCOGNITOMODEFUNCTION"/> <int value="499" label="FILEBROWSERPRIVATE_REQUESTACCESSTOKEN"/> - <int value="500" label="WEBVIEW_STOP"/> - <int value="501" label="WEBVIEW_RELOAD"/> - <int value="502" label="WEBVIEW_TERMINATE"/> + <int value="500" label="DELETED_WEBVIEW_STOP"/> + <int value="501" label="DELETED_WEBVIEW_RELOAD"/> + <int value="502" label="DELETED_WEBVIEW_TERMINATE"/> <int value="503" label="TYPES_PRIVATE_CHROMEDIRECTSETTING_GET"/> <int value="504" label="TYPES_PRIVATE_CHROMEDIRECTSETTING_SET"/> <int value="505" label="TYPES_PRIVATE_CHROMEDIRECTSETTING_CLEAR"/> @@ -37644,7 +37644,7 @@ Therefore, the affected-histogram name has to have at least one dot in it. <int value="528" label="LOGPRIVATE_GETHISTORICAL"/> <int value="529" label="VIRTUALKEYBOARDPRIVATE_MOVECURSOR"/> <int value="530" label="METRICSPRIVATE_GETVARIATIONPARAMS"/> - <int value="531" label="WEBVIEW_SETPERMISSION"/> + <int value="531" label="DELETED_WEBVIEW_SETPERMISSION"/> <int value="532" label="DESKTOPCAPTURE_CHOOSEDESKTOPMEDIA"/> <int value="533" label="APP_CURRENTWINDOWINTERNAL_SETSHAPE"/> <int value="534" label="PROCESSES_GETPROCESSINFO"/> @@ -37664,7 +37664,7 @@ Therefore, the affected-histogram name has to have at least one dot in it. <int value="548" label="SOCKETS_UDP_GETJOINEDGROUPS"/> <int value="549" label="SIGNED_IN_DEVICES_GET"/> <int value="550" label="AUTOTESTPRIVATE_SIMULATEASANMEMORYBUG"/> - <int value="551" label="WEBVIEW_CLEARDATA"/> + <int value="551" label="DELETED_WEBVIEW_CLEARDATA"/> <int value="552" label="SESSIONS_GETRECENTLYCLOSED"/> <int value="553" label="SESSIONS_GETDEVICES"/> <int value="554" label="SESSIONS_RESTORE"/> @@ -37694,7 +37694,7 @@ Therefore, the affected-histogram name has to have at least one dot in it. <int value="578" label="WEBRTCLOGGINGPRIVATE_STOP"/> <int value="579" label="WEBRTCLOGGINGPRIVATE_UPLOAD"/> <int value="580" label="WEBRTCLOGGINGPRIVATE_DISCARD"/> - <int value="581" label="WEBVIEW_OVERRIDEUSERAGENT"/> + <int value="581" label="DELETED_WEBVIEW_OVERRIDEUSERAGENT"/> <int value="582" label="PRINCIPALSPRIVATE_SHOWAVATARBUBBLE"/> <int value="583" label="PRINCIPALSPRIVATE_SIGNOUT"/> <int value="584" label="CAST_CHANNEL_OPEN"/> @@ -37761,7 +37761,7 @@ Therefore, the affected-histogram name has to have at least one dot in it. <int value="645" label="FIRSTRUNPRIVATE_GETLOCALIZEDSTRINGS"/> <int value="646" label="FIRSTRUNPRIVATE_LAUNCHTUTORIAL"/> <int value="647" label="SOCKETS_UDP_SETPAUSED"/> - <int value="648" label="WEBVIEW_CAPTUREVISIBLEREGION"/> + <int value="648" label="DELETED_WEBVIEW_CAPTUREVISIBLEREGION"/> <int value="649" label="MEDIAGALLERIES_GETMETADATA"/> <int value="650" label="INPUT_IME_SENDKEYEVENTS"/> <int value="651" label="VIRTUALKEYBOARDPRIVATE_LOCKKEYBOARD"/> @@ -37796,8 +37796,8 @@ Therefore, the affected-histogram name has to have at least one dot in it. <int value="679" label="HOTWORDPRIVATE_GETSTATUS"/> <int value="680" label="APP_CURRENTWINDOWINTERNAL_SETBADGEICON"/> <int value="681" label="APP_CURRENTWINDOWINTERNAL_CLEARBADGE"/> - <int value="682" label="WEBVIEW_SETZOOM"/> - <int value="683" label="WEBVIEW_GETZOOM"/> + <int value="682" label="DELETED_WEBVIEW_SETZOOM"/> + <int value="683" label="DELETED_WEBVIEW_GETZOOM"/> <int value="684" label="DEVELOPERPRIVATE_REQUESTFILESOURCE"/> <int value="685" label="DEVELOPERPRIVATE_OPENDEVTOOLS"/> <int value="686" label="ACTIVITYLOGPRIVATE_DELETEACTIVITIES"/> @@ -37807,12 +37807,12 @@ Therefore, the affected-histogram name has to have at least one dot in it. <int value="690" label="SCREENLOCKPRIVATE_SETAUTHTYPE"/> <int value="691" label="SCREENLOCKPRIVATE_GETAUTHTYPE"/> <int value="692" label="SCREENLOCKPRIVATE_ACCEPTAUTHATTEMPT"/> - <int value="693" label="WEBVIEW_FIND"/> - <int value="694" label="WEBVIEW_STOPFINDING"/> - <int value="695" label="WEBVIEW_CONTEXTMENUSCREATE"/> - <int value="696" label="WEBVIEW_CONTEXTMENUSUPDATE"/> - <int value="697" label="WEBVIEW_CONTEXTMENUSREMOVE"/> - <int value="698" label="WEBVIEW_CONTEXTMENUSREMOVEALL"/> + <int value="693" label="DELETED_WEBVIEW_FIND"/> + <int value="694" label="DELETED_WEBVIEW_STOPFINDING"/> + <int value="695" label="DELETED_WEBVIEW_CONTEXTMENUSCREATE"/> + <int value="696" label="DELETED_WEBVIEW_CONTEXTMENUSUPDATE"/> + <int value="697" label="DELETED_WEBVIEW_CONTEXTMENUSREMOVE"/> + <int value="698" label="DELETED_WEBVIEW_CONTEXTMENUSREMOVEALL"/> <int value="699" label="AUTOMATIONINTERNAL_ENABLETAB"/> <int value="700" label="APP_CURRENTWINDOWINTERNAL_SETSIZECONSTRAINTS"/> <int value="701" label="BLUETOOTH_GETDEVICE"/> @@ -37871,7 +37871,7 @@ Therefore, the affected-histogram name has to have at least one dot in it. label="DELETED_FILESYSTEMPROVIDERINTERNAL_GETMETADATAREQUESTEDERROR"/> <int value="752" label="BROWSER_OPENTAB"/> <int value="753" label="MANAGEMENT_CREATEAPPSHORTCUT"/> - <int value="754" label="WEBVIEW_SHOWCONTEXTMENU"/> + <int value="754" label="DELETED_WEBVIEW_SHOWCONTEXTMENU"/> <int value="755" label="WEBRTCLOGGINGPRIVATE_STARTRTPDUMP"/> <int value="756" label="WEBRTCLOGGINGPRIVATE_STOPRTPDUMP"/> <int value="757" label="AUTOMATIONINTERNAL_ENABLEDESKTOP"/> @@ -37899,7 +37899,7 @@ Therefore, the affected-histogram name has to have at least one dot in it. <int value="773" label="DELETED_FILESYSTEMPROVIDERINTERNAL_READFILEREQUESTEDERROR"/> <int value="774" label="NETWORKINGPRIVATE_GETNETWORKS"/> - <int value="775" label="WEBVIEW_SETNAME"/> + <int value="775" label="DELETED_WEBVIEW_SETNAME"/> <int value="776" label="ENTERPRISE_PLATFORMKEYSINTERNAL_GENERATEKEY"/> <int value="777" label="ENTERPRISE_PLATFORMKEYSINTERNAL_SIGN"/> <int value="778" label="ENTERPRISE_PLATFORMKEYSINTERNAL_GETTOKENS"/> @@ -37911,7 +37911,7 @@ Therefore, the affected-histogram name has to have at least one dot in it. <int value="784" label="MANAGEMENT_SETLAUNCHTYPE"/> <int value="785" label="MANAGEMENT_GENERATEAPPFORLINK"/> <int value="786" label="GUESTVIEWINTERNAL_ALLOCATEINSTANCEID"/> - <int value="787" label="WEBVIEW_NAVIGATE"/> + <int value="787" label="DELETED_WEBVIEW_NAVIGATE"/> <int value="788" label="INPUTMETHODPRIVATE_GETCURRENTINPUTMETHOD"/> <int value="789" label="INPUTMETHODPRIVATE_SETCURRENTINPUTMETHOD"/> <int value="790" label="INPUTMETHODPRIVATE_GETINPUTMETHODS"/> @@ -37925,6 +37925,27 @@ Therefore, the affected-histogram name has to have at least one dot in it. <int value="798" label="FILESYSTEMPROVIDERINTERNAL_OPERATIONREQUESTEDSUCCESS"/> <int value="799" label="GUESTVIEWINTERNAL_CREATEGUEST"/> + <int value="800" label="WEBVIEWINTERNAL_CAPTUREVISIBLEREGION"/> + <int value="801" label="WEBVIEWINTERNAL_CONTEXTMENUSCREATE"/> + <int value="802" label="WEBVIEWINTERNAL_CONTEXTMENUSREMOVE"/> + <int value="803" label="WEBVIEWINTERNAL_CONTEXTMENUSREMOVEALL"/> + <int value="804" label="WEBVIEWINTERNAL_CONTEXTMENUSUPDATE"/> + <int value="805" label="WEBVIEWINTERNAL_CLEARDATA"/> + <int value="806" label="WEBVIEWINTERNAL_EXECUTESCRIPT"/> + <int value="807" label="WEBVIEWINTERNAL_FIND"/> + <int value="808" label="WEBVIEWINTERNAL_GETZOOM"/> + <int value="809" label="WEBVIEWINTERNAL_GO"/> + <int value="810" label="WEBVIEWINTERNAL_INSERTCSS"/> + <int value="811" label="WEBVIEWINTERNAL_NAVIGATE"/> + <int value="812" label="WEBVIEWINTERNAL_OVERRIDEUSERAGENT"/> + <int value="813" label="WEBVIEWINTERNAL_RELOAD"/> + <int value="814" label="WEBVIEWINTERNAL_SETNAME"/> + <int value="815" label="WEBVIEWINTERNAL_SETPERMISSION"/> + <int value="816" label="WEBVIEWINTERNAL_SETZOOM"/> + <int value="817" label="WEBVIEWINTERNAL_SHOWCONTEXTMENU"/> + <int value="818" label="WEBVIEWINTERNAL_STOP"/> + <int value="819" label="WEBVIEWINTERNAL_STOPFINDING"/> + <int value="820" label="WEBVIEWINTERNAL_TERMINATE"/> </enum> <enum name="ExtensionInstallCause" type="int"> |