Commit c70d2d70 authored by Xi Cheng's avatar Xi Cheng Committed by Commit Bot

Clean up chrome_switches.{h,cc} and move to lib "non_code_constants"

This CL consists of the following changes:
1) Remove function PowerOverlayEnabled() which is not used.
2) Remove function ExtensionsDisabled() which is not used.
3) Move ExtensionsDisabled(base::CommandLine) to chrome_extensions_browser_client.cc,
   which is the only call site.
4) Move chrome_switches.{h,cc} to lib "non_code_constants", as they don't contain any
   functions now.

After this change, including "chrome_switches.h" (and "chrome_constants.h")
only requires a dependence on lib "non_code_constants", rather than lib
"constants" which is overkill.

This applies to notification_helper which only includes "chrome_switches.h"
and "chrome_constants.h" under chrome/common.

Bug: 734095
Change-Id: I3be5ffff70e9f594989c2058dca0ef109eabf085
Reviewed-on: https://chromium-review.googlesource.com/930368Reviewed-by: default avatarScott Violet <sky@chromium.org>
Commit-Queue: Xi Cheng <chengx@chromium.org>
Cr-Commit-Position: refs/heads/master@{#538941}
parent d4e8300b
...@@ -77,6 +77,11 @@ namespace { ...@@ -77,6 +77,11 @@ namespace {
// new chrome update. // new chrome update.
bool g_did_chrome_update_for_testing = false; bool g_did_chrome_update_for_testing = false;
bool ExtensionsDisabled(const base::CommandLine& command_line) {
return command_line.HasSwitch(switches::kDisableExtensions) ||
command_line.HasSwitch(switches::kDisableExtensionsExcept);
}
} // namespace } // namespace
ChromeExtensionsBrowserClient::ChromeExtensionsBrowserClient() { ChromeExtensionsBrowserClient::ChromeExtensionsBrowserClient() {
...@@ -96,7 +101,7 @@ bool ChromeExtensionsBrowserClient::AreExtensionsDisabled( ...@@ -96,7 +101,7 @@ bool ChromeExtensionsBrowserClient::AreExtensionsDisabled(
const base::CommandLine& command_line, const base::CommandLine& command_line,
content::BrowserContext* context) { content::BrowserContext* context) {
Profile* profile = static_cast<Profile*>(context); Profile* profile = static_cast<Profile*>(context);
return switches::ExtensionsDisabled(command_line) || return ExtensionsDisabled(command_line) ||
profile->GetPrefs()->GetBoolean(prefs::kDisableExtensions); profile->GetPrefs()->GetBoolean(prefs::kDisableExtensions);
} }
......
...@@ -524,6 +524,8 @@ static_library("non_code_constants") { ...@@ -524,6 +524,8 @@ static_library("non_code_constants") {
"chrome_constants.cc", "chrome_constants.cc",
"chrome_constants.h", "chrome_constants.h",
"chrome_icon_resources_win.h", "chrome_icon_resources_win.h",
"chrome_switches.cc",
"chrome_switches.h",
"env_vars.cc", "env_vars.cc",
"env_vars.h", "env_vars.h",
] ]
...@@ -531,6 +533,13 @@ static_library("non_code_constants") { ...@@ -531,6 +533,13 @@ static_library("non_code_constants") {
deps = [ deps = [
":version_header", ":version_header",
"//base", "//base",
"//ppapi/features",
]
public_deps = [
":features",
"//printing/features",
"//ui/base:ui_features",
] ]
} }
...@@ -546,8 +555,6 @@ static_library("constants") { ...@@ -546,8 +555,6 @@ static_library("constants") {
"chrome_paths_mac.mm", "chrome_paths_mac.mm",
"chrome_paths_win.cc", "chrome_paths_win.cc",
"chrome_result_codes.h", "chrome_result_codes.h",
"chrome_switches.cc",
"chrome_switches.h",
"pref_font_script_names-inl.h", "pref_font_script_names-inl.h",
"pref_font_webkit_names.h", "pref_font_webkit_names.h",
"pref_names.cc", "pref_names.cc",
......
...@@ -4,12 +4,6 @@ ...@@ -4,12 +4,6 @@
#include "chrome/common/chrome_switches.h" #include "chrome/common/chrome_switches.h"
#include "base/base_switches.h"
#include "base/command_line.h"
#include "build/build_config.h"
#include "ppapi/features/features.h"
#include "printing/features/features.h"
namespace switches { namespace switches {
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
...@@ -1000,22 +994,6 @@ const char kEnableNewAppMenuIcon[] = "enable-new-app-menu-icon"; ...@@ -1000,22 +994,6 @@ const char kEnableNewAppMenuIcon[] = "enable-new-app-menu-icon";
const char kUseSystemDefaultPrinter[] = "use-system-default-printer"; const char kUseSystemDefaultPrinter[] = "use-system-default-printer";
#endif #endif
bool ExtensionsDisabled(const base::CommandLine& command_line) {
return command_line.HasSwitch(switches::kDisableExtensions) ||
command_line.HasSwitch(switches::kDisableExtensionsExcept);
}
bool ExtensionsDisabled() {
return ExtensionsDisabled(*base::CommandLine::ForCurrentProcess());
}
#if defined(OS_CHROMEOS)
bool PowerOverlayEnabled() {
return base::CommandLine::ForCurrentProcess()->HasSwitch(
::switches::kEnablePowerOverlay);
}
#endif
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
// DO NOT ADD YOUR VERY NICE FLAGS TO THE BOTTOM OF THIS FILE. // DO NOT ADD YOUR VERY NICE FLAGS TO THE BOTTOM OF THIS FILE.
// //
......
...@@ -18,10 +18,6 @@ ...@@ -18,10 +18,6 @@
// installer where dependencies should be limited. Instead, have files // installer where dependencies should be limited. Instead, have files
// directly include your switch file. // directly include your switch file.
namespace base {
class CommandLine;
}
namespace switches { namespace switches {
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
...@@ -329,13 +325,6 @@ extern const char kEnableNewAppMenuIcon[]; ...@@ -329,13 +325,6 @@ extern const char kEnableNewAppMenuIcon[];
extern const char kUseSystemDefaultPrinter[]; extern const char kUseSystemDefaultPrinter[];
#endif #endif
bool ExtensionsDisabled(const base::CommandLine& command_line);
bool ExtensionsDisabled();
#if defined(OS_CHROMEOS)
bool PowerOverlayEnabled();
#endif
// DON'T ADD RANDOM STUFF HERE. Put it in the main section above in // DON'T ADD RANDOM STUFF HERE. Put it in the main section above in
// alphabetical order, or in one of the ifdefs (also in order in each section). // alphabetical order, or in one of the ifdefs (also in order in each section).
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment