diff options
author | hanxi <hanxi@chromium.org> | 2014-09-23 15:48:09 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2014-09-23 22:48:33 +0000 |
commit | 8ff718bbef88fcdc4de31f7cbd1325dff589ea32 (patch) | |
tree | 7a50b09783f2267c59cae91b67eb461d98e147eb | |
parent | 486805cdd18a55efdff5eb081642abe4de580b31 (diff) | |
download | chromium_src-8ff718bbef88fcdc4de31f7cbd1325dff589ea32.zip chromium_src-8ff718bbef88fcdc4de31f7cbd1325dff589ea32.tar.gz chromium_src-8ff718bbef88fcdc4de31f7cbd1325dff589ea32.tar.bz2 |
Move web_request_internal_custom_bindings.js and web_request_custom_bindings.js
to //extensions.
BUG=352293
Review URL: https://codereview.chromium.org/594653003
Cr-Commit-Position: refs/heads/master@{#296289}
-rw-r--r-- | chrome/chrome_renderer.gypi | 2 | ||||
-rw-r--r-- | chrome/renderer/chrome_content_renderer_client.cc | 2 | ||||
-rw-r--r-- | chrome/renderer/extensions/chrome_extensions_dispatcher_delegate.cc | 11 | ||||
-rw-r--r-- | chrome/renderer/extensions/chrome_extensions_dispatcher_delegate.h | 6 | ||||
-rw-r--r-- | chrome/renderer/resources/renderer_resources.grd | 2 | ||||
-rw-r--r-- | extensions/extensions.gyp | 2 | ||||
-rw-r--r-- | extensions/renderer/BUILD.gn | 2 | ||||
-rw-r--r-- | extensions/renderer/dispatcher.cc | 10 | ||||
-rw-r--r-- | extensions/renderer/dispatcher.h | 5 | ||||
-rw-r--r-- | extensions/renderer/dispatcher_delegate.h | 4 | ||||
-rw-r--r-- | extensions/renderer/resources/extensions_renderer_resources.grd | 4 | ||||
-rw-r--r-- | extensions/renderer/resources/web_request_custom_bindings.js (renamed from chrome/renderer/resources/extensions/web_request_custom_bindings.js) | 0 | ||||
-rw-r--r-- | extensions/renderer/resources/web_request_internal_custom_bindings.js (renamed from chrome/renderer/resources/extensions/web_request_internal_custom_bindings.js) | 0 |
13 files changed, 22 insertions, 28 deletions
diff --git a/chrome/chrome_renderer.gypi b/chrome/chrome_renderer.gypi index 229fdab..270d68f 100644 --- a/chrome/chrome_renderer.gypi +++ b/chrome/chrome_renderer.gypi @@ -170,11 +170,9 @@ 'renderer/resources/extensions/system_indicator_custom_bindings.js', 'renderer/resources/extensions/tts_custom_bindings.js', 'renderer/resources/extensions/tts_engine_custom_bindings.js', - 'renderer/resources/extensions/web_request_custom_bindings.js', 'renderer/resources/extensions/web_view.js', 'renderer/resources/extensions/web_view_events.js', 'renderer/resources/extensions/web_view_experimental.js', - 'renderer/resources/extensions/web_view_internal_custom_bindings.js', ], 'chrome_renderer_non_android_sources': [ 'renderer/prerender/prerender_media_load_deferrer.cc', diff --git a/chrome/renderer/chrome_content_renderer_client.cc b/chrome/renderer/chrome_content_renderer_client.cc index 25ee700..3f1740e 100644 --- a/chrome/renderer/chrome_content_renderer_client.cc +++ b/chrome/renderer/chrome_content_renderer_client.cc @@ -1422,7 +1422,7 @@ void ChromeContentRendererClient::SetSpellcheck(SpellCheck* spellcheck) { // static bool ChromeContentRendererClient::WasWebRequestUsedBySomeExtensions() { #if defined(ENABLE_EXTENSIONS) - return g_current_client->extension_dispatcher_delegate_ + return g_current_client->extension_dispatcher_ ->WasWebRequestUsedBySomeExtensions(); #else return false; diff --git a/chrome/renderer/extensions/chrome_extensions_dispatcher_delegate.cc b/chrome/renderer/extensions/chrome_extensions_dispatcher_delegate.cc index 75768e6..b65b153 100644 --- a/chrome/renderer/extensions/chrome_extensions_dispatcher_delegate.cc +++ b/chrome/renderer/extensions/chrome_extensions_dispatcher_delegate.cc @@ -51,8 +51,7 @@ using extensions::NativeHandler; -ChromeExtensionsDispatcherDelegate::ChromeExtensionsDispatcherDelegate() - : webrequest_used_(false) { +ChromeExtensionsDispatcherDelegate::ChromeExtensionsDispatcherDelegate() { } ChromeExtensionsDispatcherDelegate::~ChromeExtensionsDispatcherDelegate() { @@ -212,9 +211,6 @@ void ChromeExtensionsDispatcherDelegate::PopulateSourceMap( source_map->RegisterSource("tabs", IDR_TABS_CUSTOM_BINDINGS_JS); source_map->RegisterSource("tts", IDR_TTS_CUSTOM_BINDINGS_JS); source_map->RegisterSource("ttsEngine", IDR_TTS_ENGINE_CUSTOM_BINDINGS_JS); - source_map->RegisterSource("webRequest", IDR_WEB_REQUEST_CUSTOM_BINDINGS_JS); - source_map->RegisterSource("webRequestInternal", - IDR_WEB_REQUEST_INTERNAL_CUSTOM_BINDINGS_JS); #if defined(ENABLE_WEBRTC) source_map->RegisterSource("cast.streaming.rtpStream", IDR_CAST_STREAMING_RTP_STREAM_CUSTOM_BINDINGS_JS); @@ -346,8 +342,3 @@ void ChromeExtensionsDispatcherDelegate::UpdateTabSpecificPermissions( origin_set, extensions::URLPatternSet())); } - -void ChromeExtensionsDispatcherDelegate::HandleWebRequestAPIUsage( - bool webrequest_used) { - webrequest_used_ = webrequest_used; -} diff --git a/chrome/renderer/extensions/chrome_extensions_dispatcher_delegate.h b/chrome/renderer/extensions/chrome_extensions_dispatcher_delegate.h index 0c0799f..faf2540 100644 --- a/chrome/renderer/extensions/chrome_extensions_dispatcher_delegate.h +++ b/chrome/renderer/extensions/chrome_extensions_dispatcher_delegate.h @@ -13,8 +13,6 @@ class ChromeExtensionsDispatcherDelegate ChromeExtensionsDispatcherDelegate(); virtual ~ChromeExtensionsDispatcherDelegate(); - bool WasWebRequestUsedBySomeExtensions() const { return webrequest_used_; } - private: // extensions::DispatcherDelegate implementation. virtual scoped_ptr<extensions::ScriptContext> CreateScriptContext( @@ -47,10 +45,6 @@ class ChromeExtensionsDispatcherDelegate int tab_id, const std::string& extension_id, const extensions::URLPatternSet& origin_set) OVERRIDE; - virtual void HandleWebRequestAPIUsage(bool webrequest_used) OVERRIDE; - - // Status of webrequest usage. - bool webrequest_used_; DISALLOW_COPY_AND_ASSIGN(ChromeExtensionsDispatcherDelegate); }; diff --git a/chrome/renderer/resources/renderer_resources.grd b/chrome/renderer/resources/renderer_resources.grd index b086e85..ff13977 100644 --- a/chrome/renderer/resources/renderer_resources.grd +++ b/chrome/renderer/resources/renderer_resources.grd @@ -84,8 +84,6 @@ <include name="IDR_TAG_WATCHER_JS" file="extensions\tag_watcher.js" type="BINDATA" /> <include name="IDR_TTS_CUSTOM_BINDINGS_JS" file="extensions\tts_custom_bindings.js" type="BINDATA" /> <include name="IDR_TTS_ENGINE_CUSTOM_BINDINGS_JS" file="extensions\tts_engine_custom_bindings.js" type="BINDATA" /> - <include name="IDR_WEB_REQUEST_CUSTOM_BINDINGS_JS" file="extensions\web_request_custom_bindings.js" type="BINDATA" /> - <include name="IDR_WEB_REQUEST_INTERNAL_CUSTOM_BINDINGS_JS" file="extensions\web_request_internal_custom_bindings.js" type="BINDATA" /> <include name="IDR_WEBSTORE_CUSTOM_BINDINGS_JS" file="extensions\webstore_custom_bindings.js" type="BINDATA" /> <include name="IDR_WEB_VIEW_REQUEST_CUSTOM_BINDINGS_JS" file="extensions\web_view_request_custom_bindings.js" type="BINDATA" /> diff --git a/extensions/extensions.gyp b/extensions/extensions.gyp index 26ac0f1..4205b78 100644 --- a/extensions/extensions.gyp +++ b/extensions/extensions.gyp @@ -874,6 +874,8 @@ 'renderer/resources/uncaught_exception_handler.js', 'renderer/resources/unload_event.js', 'renderer/resources/utils.js', + 'renderer/resources/web_request_custom_bindings.js', + 'renderer/resources/web_request_internal_custom_bindings.js', 'renderer/runtime_custom_bindings.cc', 'renderer/runtime_custom_bindings.h', 'renderer/safe_builtins.cc', diff --git a/extensions/renderer/BUILD.gn b/extensions/renderer/BUILD.gn index 22dbbb0..80ff8d2 100644 --- a/extensions/renderer/BUILD.gn +++ b/extensions/renderer/BUILD.gn @@ -106,6 +106,8 @@ source_set("renderer") { "resources/uncaught_exception_handler.js", "resources/unload_event.js", "resources/utils.js", + "resources/web_request_custom_bindings.js", + "resources/web_request_internal_custom_bindings.js", "runtime_custom_bindings.cc", "runtime_custom_bindings.h", "safe_builtins.cc", diff --git a/extensions/renderer/dispatcher.cc b/extensions/renderer/dispatcher.cc index 80ee4ec..913146c 100644 --- a/extensions/renderer/dispatcher.cc +++ b/extensions/renderer/dispatcher.cc @@ -185,7 +185,8 @@ Dispatcher::Dispatcher(DispatcherDelegate* delegate) source_map_(&ResourceBundle::GetSharedInstance()), v8_schema_registry_(new V8SchemaRegistry), is_webkit_initialized_(false), - user_script_set_manager_observer_(this) { + user_script_set_manager_observer_(this), + webrequest_used_(false) { const CommandLine& command_line = *(CommandLine::ForCurrentProcess()); is_extension_process_ = command_line.HasSwitch(extensions::switches::kExtensionProcess) || @@ -531,6 +532,11 @@ std::vector<std::pair<std::string, int> > Dispatcher::GetJsResources() { IDR_UNCAUGHT_EXCEPTION_HANDLER_JS)); resources.push_back(std::make_pair("unload_event", IDR_UNLOAD_EVENT_JS)); resources.push_back(std::make_pair("utils", IDR_UTILS_JS)); + resources.push_back(std::make_pair("webRequest", + IDR_WEB_REQUEST_CUSTOM_BINDINGS_JS)); + resources.push_back( + std::make_pair("webRequestInternal", + IDR_WEB_REQUEST_INTERNAL_CUSTOM_BINDINGS_JS)); // Note: webView not webview so that this doesn't interfere with the // chrome.webview API bindings. resources.push_back(std::make_pair("webView", IDR_WEB_VIEW_JS)); @@ -982,7 +988,7 @@ void Dispatcher::OnUpdateTabSpecificPermissions( } void Dispatcher::OnUsingWebRequestAPI(bool webrequest_used) { - delegate_->HandleWebRequestAPIUsage(webrequest_used); + webrequest_used_ = webrequest_used; } void Dispatcher::OnUserScriptsUpdated( diff --git a/extensions/renderer/dispatcher.h b/extensions/renderer/dispatcher.h index 418f406..91af795 100644 --- a/extensions/renderer/dispatcher.h +++ b/extensions/renderer/dispatcher.h @@ -148,6 +148,8 @@ class Dispatcher : public content::RenderProcessObserver, RequestSender* request_sender, V8SchemaRegistry* v8_schema_registry); + bool WasWebRequestUsedBySomeExtensions() const { return webrequest_used_; } + private: friend class ::ChromeRenderViewTest; FRIEND_TEST_ALL_PREFIXES(RendererPermissionsPolicyDelegateTest, @@ -311,6 +313,9 @@ class Dispatcher : public content::RenderProcessObserver, ScopedObserver<UserScriptSetManager, UserScriptSetManager::Observer> user_script_set_manager_observer_; + // Status of webrequest usage. + bool webrequest_used_; + DISALLOW_COPY_AND_ASSIGN(Dispatcher); }; diff --git a/extensions/renderer/dispatcher_delegate.h b/extensions/renderer/dispatcher_delegate.h index 3a3ca76..2f2f39d 100644 --- a/extensions/renderer/dispatcher_delegate.h +++ b/extensions/renderer/dispatcher_delegate.h @@ -83,10 +83,6 @@ class DispatcherDelegate { int tab_id, const std::string& extension_id, const extensions::URLPatternSet& origin_set) {} - - // Allows the delegate to respond to reports from the browser about WebRequest - // API usage from within this process. - virtual void HandleWebRequestAPIUsage(bool webrequest_used) {} }; } // namespace extensions diff --git a/extensions/renderer/resources/extensions_renderer_resources.grd b/extensions/renderer/resources/extensions_renderer_resources.grd index 3f5d610..5f8715d 100644 --- a/extensions/renderer/resources/extensions_renderer_resources.grd +++ b/extensions/renderer/resources/extensions_renderer_resources.grd @@ -40,15 +40,17 @@ <!-- Custom bindings for APIs. --> <include name="IDR_APP_RUNTIME_CUSTOM_BINDINGS_JS" file="app_runtime_custom_bindings.js" type="BINDATA" /> <include name="IDR_APP_WINDOW_CUSTOM_BINDINGS_JS" file="app_window_custom_bindings.js" type="BINDATA" /> + <include name="IDR_BINDING_JS" file="binding.js" type="BINDATA" /> <include name="IDR_CONTEXT_MENUS_CUSTOM_BINDINGS_JS" file="context_menus_custom_bindings.js" type="BINDATA" /> <include name="IDR_EXTENSION_CUSTOM_BINDINGS_JS" file="extension_custom_bindings.js" type="BINDATA" /> <include name="IDR_GREASEMONKEY_API_JS" file="greasemonkey_api.js" type="BINDATA" /> <include name="IDR_I18N_CUSTOM_BINDINGS_JS" file="i18n_custom_bindings.js" type="BINDATA" /> <include name="IDR_PERMISSIONS_CUSTOM_BINDINGS_JS" file="permissions_custom_bindings.js" type="BINDATA" /> <include name="IDR_RUNTIME_CUSTOM_BINDINGS_JS" file="runtime_custom_bindings.js" type="BINDATA" /> + <include name="IDR_WEB_REQUEST_CUSTOM_BINDINGS_JS" file="web_request_custom_bindings.js" type="BINDATA" /> + <include name="IDR_WEB_REQUEST_INTERNAL_CUSTOM_BINDINGS_JS" file="web_request_internal_custom_bindings.js" type="BINDATA" /> <include name="IDR_WINDOW_CONTROLS_JS" file="window_controls.js" type="BINDATA" /> <include name="IDR_WINDOW_CONTROLS_TEMPLATE_HTML" file="window_controls_template.html" type="BINDATA" /> - <include name="IDR_BINDING_JS" file="binding.js" type="BINDATA" /> <!-- Custom types for APIs. --> <include name="IDR_STORAGE_AREA_JS" file="storage_area.js" type="BINDATA" /> diff --git a/chrome/renderer/resources/extensions/web_request_custom_bindings.js b/extensions/renderer/resources/web_request_custom_bindings.js index 045fe96..045fe96 100644 --- a/chrome/renderer/resources/extensions/web_request_custom_bindings.js +++ b/extensions/renderer/resources/web_request_custom_bindings.js diff --git a/chrome/renderer/resources/extensions/web_request_internal_custom_bindings.js b/extensions/renderer/resources/web_request_internal_custom_bindings.js index 76460ee..76460ee 100644 --- a/chrome/renderer/resources/extensions/web_request_internal_custom_bindings.js +++ b/extensions/renderer/resources/web_request_internal_custom_bindings.js |