Skip to content

Commit

Permalink
Move kExtensionProcess to src/extensions/common/switches.cc
Browse files Browse the repository at this point in the history
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
  • Loading branch information
jamescook@chromium.org committed Jan 16, 2014
1 parent 4796037 commit cd0f7af
Show file tree
Hide file tree
Showing 8 changed files with 20 additions and 17 deletions.
4 changes: 2 additions & 2 deletions apps/shell/shell_content_browser_client.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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;
Expand Down Expand Up @@ -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);
}
}

Expand Down
4 changes: 2 additions & 2 deletions chrome/browser/chrome_content_browser_client.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand Down Expand Up @@ -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();
Expand Down
3 changes: 0 additions & 3 deletions chrome/common/chrome_switches.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down
1 change: 0 additions & 1 deletion chrome/common/chrome_switches.h
Original file line number Diff line number Diff line change
Expand Up @@ -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[];
Expand Down
3 changes: 2 additions & 1 deletion chrome/renderer/chrome_content_renderer_client.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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*
Expand Down
12 changes: 7 additions & 5 deletions chrome/renderer/extensions/dispatcher.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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(
Expand Down Expand Up @@ -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");
}

Expand Down Expand Up @@ -1221,7 +1222,8 @@ void Dispatcher::DidCreateScriptContext(
// Same comment as above for <adview> 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 {
Expand Down Expand Up @@ -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<std::string> active_extensions = active_extension_ids_;
Expand Down
9 changes: 6 additions & 3 deletions extensions/common/switches.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions extensions/common/switches.h
Original file line number Diff line number Diff line change
Expand Up @@ -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[];
Expand Down

0 comments on commit cd0f7af

Please sign in to comment.