From cd0f7afb4971045ad47a15bcdcbf74c87c27c573 Mon Sep 17 00:00:00 2001 From: "jamescook@chromium.org" Date: Thu, 16 Jan 2014 23:50:39 +0000 Subject: [PATCH] Move kExtensionProcess to src/extensions/common/switches.cc app_shell needs it and it should be in the src/extensions module anyhow. BUG=none TEST=compiles TBR=miket@chromium.org Review URL: https://codereview.chromium.org/136473004 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@245380 0039d316-1c4b-4281-b951-d872f2087c98 --- apps/shell/shell_content_browser_client.cc | 4 ++-- chrome/browser/chrome_content_browser_client.cc | 4 ++-- chrome/common/chrome_switches.cc | 3 --- chrome/common/chrome_switches.h | 1 - chrome/renderer/chrome_content_renderer_client.cc | 3 ++- chrome/renderer/extensions/dispatcher.cc | 12 +++++++----- extensions/common/switches.cc | 9 ++++++--- extensions/common/switches.h | 1 + 8 files changed, 20 insertions(+), 17 deletions(-) diff --git a/apps/shell/shell_content_browser_client.cc b/apps/shell/shell_content_browser_client.cc index 589028ce858452..4217301495cb82 100644 --- a/apps/shell/shell_content_browser_client.cc +++ b/apps/shell/shell_content_browser_client.cc @@ -10,7 +10,6 @@ #include "base/command_line.h" #include "chrome/browser/extensions/extension_protocols.h" #include "chrome/browser/extensions/extension_resource_protocols.h" -#include "chrome/common/chrome_switches.h" #include "content/public/browser/browser_thread.h" #include "content/public/browser/render_process_host.h" #include "content/public/browser/site_instance.h" @@ -21,6 +20,7 @@ #include "extensions/browser/info_map.h" #include "extensions/common/constants.h" #include "extensions/common/extension.h" +#include "extensions/common/switches.h" #include "url/gurl.h" using content::BrowserThread; @@ -128,7 +128,7 @@ void ShellContentBrowserClient::AppendExtraCommandLineSwitches( // TODO(jamescook): Should we check here if the process is in the extension // service process map, or can we assume all renderers are extension // renderers? - command_line->AppendSwitch(switches::kExtensionProcess); + command_line->AppendSwitch(extensions::switches::kExtensionProcess); } } diff --git a/chrome/browser/chrome_content_browser_client.cc b/chrome/browser/chrome_content_browser_client.cc index 0da0a1e9c0b3e8..d97d2de5a1f23c 100644 --- a/chrome/browser/chrome_content_browser_client.cc +++ b/chrome/browser/chrome_content_browser_client.cc @@ -503,7 +503,7 @@ breakpad::CrashHandlerHostLinux* CreateCrashHandlerHost( } int GetCrashSignalFD(const CommandLine& command_line) { - if (command_line.HasSwitch(switches::kExtensionProcess)) { + if (command_line.HasSwitch(extensions::switches::kExtensionProcess)) { static breakpad::CrashHandlerHostLinux* crash_handler = NULL; if (!crash_handler) crash_handler = CreateCrashHandlerHost("extension"); @@ -1459,7 +1459,7 @@ void ChromeContentBrowserClient::AppendExtraCommandLineSwitches( if (extension_service) { extensions::ProcessMap* process_map = extension_service->process_map(); if (process_map && process_map->Contains(process->GetID())) - command_line->AppendSwitch(switches::kExtensionProcess); + command_line->AppendSwitch(extensions::switches::kExtensionProcess); } PrefService* prefs = profile->GetPrefs(); diff --git a/chrome/common/chrome_switches.cc b/chrome/common/chrome_switches.cc index dfcccd2a0223cf..42afea7a82c589 100644 --- a/chrome/common/chrome_switches.cc +++ b/chrome/common/chrome_switches.cc @@ -841,9 +841,6 @@ const char kEnableWebSocketOverSpdy[] = "enable-websocket-over-spdy"; // numbers. const char kExplicitlyAllowedPorts[] = "explicitly-allowed-ports"; -// Marks a renderer as extension process. -const char kExtensionProcess[] = "extension-process"; - // Turns on extension install verification if it would not otherwise have been // turned on. const char kExtensionsInstallVerification[] = "extensions-install-verification"; diff --git a/chrome/common/chrome_switches.h b/chrome/common/chrome_switches.h index d45ffbf35fd670..1b71d9e26cc6ee 100644 --- a/chrome/common/chrome_switches.h +++ b/chrome/common/chrome_switches.h @@ -236,7 +236,6 @@ extern const char kEnableUserAlternateProtocolPorts[]; extern const char kEnableWatchdog[]; extern const char kEnableWebSocketOverSpdy[]; extern const char kExplicitlyAllowedPorts[]; -extern const char kExtensionProcess[]; extern const char kExtensionsInstallVerification[]; extern const char kExtensionsNotWebstore[]; extern const char kExtensionsUpdateFrequency[]; diff --git a/chrome/renderer/chrome_content_renderer_client.cc b/chrome/renderer/chrome_content_renderer_client.cc index 5981a342a3b3a1..e17d630e91af5c 100644 --- a/chrome/renderer/chrome_content_renderer_client.cc +++ b/chrome/renderer/chrome_content_renderer_client.cc @@ -81,6 +81,7 @@ #include "extensions/common/extension.h" #include "extensions/common/extension_set.h" #include "extensions/common/extension_urls.h" +#include "extensions/common/switches.h" #include "grit/generated_resources.h" #include "grit/locale_settings.h" #include "grit/renderer_resources.h" @@ -1389,7 +1390,7 @@ bool ChromeContentRendererClient::ShouldEnableSiteIsolationPolicy() const { // SiteIsolationPolicy for a renderer process that does not have the extension // flag on. CommandLine* command_line = CommandLine::ForCurrentProcess(); - return !command_line->HasSwitch(switches::kExtensionProcess); + return !command_line->HasSwitch(extensions::switches::kExtensionProcess); } blink::WebWorkerPermissionClientProxy* diff --git a/chrome/renderer/extensions/dispatcher.cc b/chrome/renderer/extensions/dispatcher.cc index 98af97c65ca42c..6b55b5a5ea7a44 100644 --- a/chrome/renderer/extensions/dispatcher.cc +++ b/chrome/renderer/extensions/dispatcher.cc @@ -82,6 +82,7 @@ #include "extensions/common/manifest_handlers/sandboxed_page_info.h" #include "extensions/common/permissions/permission_set.h" #include "extensions/common/permissions/permissions_data.h" +#include "extensions/common/switches.h" #include "extensions/common/view_type.h" #include "grit/common_resources.h" #include "grit/renderer_resources.h" @@ -460,8 +461,8 @@ Dispatcher::Dispatcher() v8_schema_registry_(new V8SchemaRegistry) { const CommandLine& command_line = *(CommandLine::ForCurrentProcess()); is_extension_process_ = - command_line.HasSwitch(switches::kExtensionProcess) || - command_line.HasSwitch(switches::kSingleProcess); + command_line.HasSwitch(extensions::switches::kExtensionProcess) || + command_line.HasSwitch(::switches::kSingleProcess); if (is_extension_process_) { RenderThread::Get()->SetIdleNotificationDelayInMs( @@ -1179,7 +1180,7 @@ void Dispatcher::DidCreateScriptContext( is_within_platform_app && GetCurrentChannel() <= chrome::VersionInfo::CHANNEL_DEV && CommandLine::ForCurrentProcess()->HasSwitch( - switches::kEnableAppWindowControls)) { + ::switches::kEnableAppWindowControls)) { module_system->Require("windowControls"); } @@ -1221,7 +1222,8 @@ void Dispatcher::DidCreateScriptContext( // Same comment as above for tag. if (context_type == Feature::BLESSED_EXTENSION_CONTEXT && is_within_platform_app) { - if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kEnableAdview)) { + if (CommandLine::ForCurrentProcess()->HasSwitch( + ::switches::kEnableAdview)) { if (extension->HasAPIPermission(APIPermission::kAdView)) { module_system->Require("adView"); } else { @@ -1474,7 +1476,7 @@ void Dispatcher::OnUpdateUserScripts( void Dispatcher::UpdateActiveExtensions() { // In single-process mode, the browser process reports the active extensions. - if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kSingleProcess)) + if (CommandLine::ForCurrentProcess()->HasSwitch(::switches::kSingleProcess)) return; std::set active_extensions = active_extension_ids_; diff --git a/extensions/common/switches.cc b/extensions/common/switches.cc index 2c6a39be27d744..32f364590d1755 100644 --- a/extensions/common/switches.cc +++ b/extensions/common/switches.cc @@ -9,7 +9,7 @@ namespace extensions { namespace switches { // Allows non-https URL for background_page for hosted apps. -const char kAllowHTTPBackgroundPage[] = "allow-http-background-page"; +const char kAllowHTTPBackgroundPage[] = "allow-http-background-page"; // Allows the browser to load extensions that lack a modern manifest when that // would otherwise be forbidden. @@ -39,11 +39,14 @@ const char kErrorConsole[] = "error-console"; // The time in milliseconds that an extension event page can be idle before it // is shut down. -const char kEventPageIdleTime[] = "event-page-idle-time"; +const char kEventPageIdleTime[] = "event-page-idle-time"; // The time in milliseconds that an extension event page has between being // notified of its impending unload and that unload happening. -const char kEventPageSuspendingTime[] = "event-page-unloading-time"; +const char kEventPageSuspendingTime[] = "event-page-unloading-time"; + +// Marks a renderer as extension process. +const char kExtensionProcess[] = "extension-process"; // Enables extensions running scripts on chrome:// URLs. // Extensions still need to explicitly request access to chrome:// URLs in the diff --git a/extensions/common/switches.h b/extensions/common/switches.h index c249cc0f6fbd21..e6c3bb993c9f84 100644 --- a/extensions/common/switches.h +++ b/extensions/common/switches.h @@ -20,6 +20,7 @@ extern const char kEnableOverrideBookmarksUI[]; extern const char kErrorConsole[]; extern const char kEventPageIdleTime[]; extern const char kEventPageSuspendingTime[]; +extern const char kExtensionProcess[]; extern const char kExtensionsOnChromeURLs[]; extern const char kForceDevModeHighlighting[]; extern const char kGlobalCommands[];