diff options
author | thakis@chromium.org <thakis@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-10-26 23:17:58 +0000 |
---|---|---|
committer | thakis@chromium.org <thakis@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-10-26 23:17:58 +0000 |
commit | 21063ac24126d4c48ff66088ad605ab9d165160f (patch) | |
tree | f1ea9e9fd7aa56e84a1d8cc4185cb7445a27e7f3 /chrome | |
parent | b9ecb594f53864cd29eea40267463174be04fd6c (diff) | |
download | chromium_src-21063ac24126d4c48ff66088ad605ab9d165160f.zip chromium_src-21063ac24126d4c48ff66088ad605ab9d165160f.tar.gz chromium_src-21063ac24126d4c48ff66088ad605ab9d165160f.tar.bz2 |
Merge 63137 - Enable about:flags in ChromeOS, part 1
BUG=57634
TEST=Go to about:flags in ChromeOS. It should appear.
Review URL: http://codereview.chromium.org/3896001
TBR=thakis@chromium.org
Review URL: http://codereview.chromium.org/4178002
git-svn-id: svn://svn.chromium.org/chrome/branches/552/src@63973 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome')
-rw-r--r-- | chrome/browser/about_flags.cc | 28 | ||||
-rw-r--r-- | chrome/browser/about_flags.h | 3 | ||||
-rw-r--r-- | chrome/browser/about_flags_unittest.cc | 15 | ||||
-rw-r--r-- | chrome/browser/browser_about_handler.cc | 14 | ||||
-rw-r--r-- | chrome/browser/dom_ui/dom_ui_factory.cc | 4 | ||||
-rw-r--r-- | chrome/browser/prefs/browser_prefs.cc | 3 |
6 files changed, 18 insertions, 49 deletions
diff --git a/chrome/browser/about_flags.cc b/chrome/browser/about_flags.cc index 13998a1d..b20a054 100644 --- a/chrome/browser/about_flags.cc +++ b/chrome/browser/about_flags.cc @@ -22,9 +22,9 @@ namespace about_flags { namespace { -enum { kOsMac = 1 << 0, kOsWin = 1 << 1, kOsLinux = 1 << 2 }; +enum { kOsMac = 1 << 0, kOsWin = 1 << 1, kOsLinux = 1 << 2 , kOsCrOS = 1 << 3 }; -unsigned kOsAll = kOsMac | kOsWin | kOsLinux; +unsigned kOsAll = kOsMac | kOsWin | kOsLinux | kOsCrOS; struct Experiment { // The internal name of the experiment. This is never shown to the user. @@ -65,6 +65,8 @@ const Experiment kExperiments[] = { "vertical-tabs", // Do not change; see above. IDS_FLAGS_SIDE_TABS_NAME, IDS_FLAGS_SIDE_TABS_DESCRIPTION, + // TODO(thakis): Move sidetabs to about:flags on ChromeOS + // http://crbug.com/57634 kOsWin, switches::kEnableVerticalTabs }, @@ -72,7 +74,7 @@ const Experiment kExperiments[] = { "tabbed-options", // Do not change; see above. IDS_FLAGS_TABBED_OPTIONS_NAME, IDS_FLAGS_TABBED_OPTIONS_DESCRIPTION, - kOsAll, + kOsWin | kOsLinux | kOsMac, // Enabled by default on CrOS. switches::kEnableTabbedOptions }, { @@ -88,14 +90,14 @@ const Experiment kExperiments[] = { #if defined(OS_WIN) // Windows only supports host functionality at the moment. IDS_FLAGS_REMOTING_HOST_DESCRIPTION, -#elif defined(OS_LINUX) +#elif defined(OS_LINUX) // Also true for CrOS. // Linux only supports client functionality at the moment. IDS_FLAGS_REMOTING_CLIENT_DESCRIPTION, #else // On other platforms, this lab isn't available at all. 0, #endif - kOsWin | kOsLinux, + kOsWin | kOsLinux | kOsCrOS, switches::kEnableRemoting }, { @@ -144,7 +146,7 @@ const Experiment kExperiments[] = { "gpu-canvas-2d", // Do not change; see above IDS_FLAGS_ACCELERATED_CANVAS_2D_NAME, IDS_FLAGS_ACCELERATED_CANVAS_2D_DESCRIPTION, - kOsWin | kOsLinux, + kOsWin | kOsLinux | kOsCrOS, switches::kEnableAccelerated2dCanvas }, { @@ -254,6 +256,8 @@ int GetCurrentPlatform() { return kOsMac; #elif defined(OS_WIN) return kOsWin; +#elif defined(OS_CHROMEOS) // Needs to be before the OS_LINUX check. + return kOsCrOS; #elif defined(OS_LINUX) return kOsLinux; #else @@ -263,15 +267,6 @@ int GetCurrentPlatform() { } // namespace -bool IsEnabled() { -#if defined(OS_CHROMEOS) - // TODO(thakis): Port about:flags to chromeos -- http://crbug.com/57634 - return false; -#else - return true; -#endif -} - void ConvertFlagsToSwitches(PrefService* prefs, CommandLine* command_line) { FlagsState::instance()->ConvertFlagsToSwitches(prefs, command_line); } @@ -324,9 +319,6 @@ namespace { void FlagsState::ConvertFlagsToSwitches( PrefService* prefs, CommandLine* command_line) { - if (!IsEnabled()) - return; - if (command_line->HasSwitch(switches::kNoExperiments)) return; diff --git a/chrome/browser/about_flags.h b/chrome/browser/about_flags.h index ad6eefb..81b0c2a 100644 --- a/chrome/browser/about_flags.h +++ b/chrome/browser/about_flags.h @@ -16,9 +16,6 @@ class PrefService; namespace about_flags { -// Returns if Flags is enabled (it isn't for ChromeOS at the moment). -bool IsEnabled(); - // Reads the Labs |prefs| (called "Labs" for historical reasons) and adds the // commandline flags belonging to the active experiments to |command_line|. void ConvertFlagsToSwitches(PrefService* prefs, CommandLine* command_line); diff --git a/chrome/browser/about_flags_unittest.cc b/chrome/browser/about_flags_unittest.cc index a18f10f..4372f48 100644 --- a/chrome/browser/about_flags_unittest.cc +++ b/chrome/browser/about_flags_unittest.cc @@ -29,18 +29,12 @@ class AboutFlagsTest : public ::testing::Test { }; TEST_F(AboutFlagsTest, ChangeNeedsRestart) { - if (!IsEnabled()) - return; - EXPECT_FALSE(IsRestartNeededToCommitChanges()); SetExperimentEnabled(&prefs_, kFlags1, true); EXPECT_TRUE(IsRestartNeededToCommitChanges()); } TEST_F(AboutFlagsTest, AddTwoFlagsRemoveOne) { - if (!IsEnabled()) - return; - // Add two experiments, check they're there. SetExperimentEnabled(&prefs_, kFlags1, true); SetExperimentEnabled(&prefs_, kFlags2, true); @@ -70,9 +64,6 @@ TEST_F(AboutFlagsTest, AddTwoFlagsRemoveOne) { } TEST_F(AboutFlagsTest, AddTwoFlagsRemoveBoth) { - if (!IsEnabled()) - return; - // Add two experiments, check the pref exists. SetExperimentEnabled(&prefs_, kFlags1, true); SetExperimentEnabled(&prefs_, kFlags2, true); @@ -88,9 +79,6 @@ TEST_F(AboutFlagsTest, AddTwoFlagsRemoveBoth) { } TEST_F(AboutFlagsTest, ConvertFlagsToSwitches) { - if (!IsEnabled()) - return; - SetExperimentEnabled(&prefs_, kFlags1, true); CommandLine command_line(CommandLine::ARGUMENTS_ONLY); @@ -106,9 +94,6 @@ TEST_F(AboutFlagsTest, ConvertFlagsToSwitches) { } TEST_F(AboutFlagsTest, RemoveFlagSwitches) { - if (!IsEnabled()) - return; - std::map<std::string, CommandLine::StringType> switch_list; switch_list[kFlag1CommandLine] = CommandLine::StringType(); switch_list[switches::kFlagSwitchesBegin] = CommandLine::StringType(); diff --git a/chrome/browser/browser_about_handler.cc b/chrome/browser/browser_about_handler.cc index c1c4a64..f79692e 100644 --- a/chrome/browser/browser_about_handler.cc +++ b/chrome/browser/browser_about_handler.cc @@ -259,8 +259,6 @@ std::string AboutAbout() { html.append("<html><head><title>About Pages</title></head><body>\n"); html.append("<h2>List of About pages</h2><ul>\n"); for (size_t i = 0; i < arraysize(kAllAboutPaths); i++) { - if (kAllAboutPaths[i] == kFlagsPath && !about_flags::IsEnabled()) - continue; if (kAllAboutPaths[i] == kAppCacheInternalsPath || kAllAboutPaths[i] == kBlobInternalsPath || kAllAboutPaths[i] == kCachePath || @@ -1178,13 +1176,11 @@ bool WillHandleBrowserAboutURL(GURL* url, Profile* profile) { return true; } - if (about_flags::IsEnabled()) { - // Rewrite about:flags and about:vaporware to chrome://flags/. - if (LowerCaseEqualsASCII(url->spec(), chrome::kAboutFlagsURL) || - LowerCaseEqualsASCII(url->spec(), chrome::kAboutVaporwareURL)) { - *url = GURL(chrome::kChromeUIFlagsURL); - return true; - } + // Rewrite about:flags and about:vaporware to chrome://flags/. + if (LowerCaseEqualsASCII(url->spec(), chrome::kAboutFlagsURL) || + LowerCaseEqualsASCII(url->spec(), chrome::kAboutVaporwareURL)) { + *url = GURL(chrome::kChromeUIFlagsURL); + return true; } // Rewrite about:net-internals/* URLs to chrome://net-internals/* diff --git a/chrome/browser/dom_ui/dom_ui_factory.cc b/chrome/browser/dom_ui/dom_ui_factory.cc index 88a3b4f..16c7563 100644 --- a/chrome/browser/dom_ui/dom_ui_factory.cc +++ b/chrome/browser/dom_ui/dom_ui_factory.cc @@ -128,7 +128,7 @@ static DOMUIFactoryFunction GetDOMUIFactoryFunction(Profile* profile, return &NewDOMUI<HistoryUI>; if (url.host() == chrome::kChromeUIHistory2Host) return &NewDOMUI<HistoryUI2>; - if (about_flags::IsEnabled() && url.host() == chrome::kChromeUIFlagsHost) + if (url.host() == chrome::kChromeUIFlagsHost) return &NewDOMUI<FlagsUI>; #if defined(TOUCH_UI) if (url.host() == chrome::kChromeUIKeyboardHost) @@ -266,7 +266,7 @@ RefCountedMemory* DOMUIFactory::GetFaviconResourceBytes(Profile* profile, if (page_url.host() == chrome::kChromeUIHistory2Host) return HistoryUI2::GetFaviconResourceBytes(); - if (about_flags::IsEnabled() && page_url.host() == chrome::kChromeUIFlagsHost) + if (page_url.host() == chrome::kChromeUIFlagsHost) return FlagsUI::GetFaviconResourceBytes(); if (page_url.host() == chrome::kChromeUISettingsHost) diff --git a/chrome/browser/prefs/browser_prefs.cc b/chrome/browser/prefs/browser_prefs.cc index 8b12441..61d5ce5a 100644 --- a/chrome/browser/prefs/browser_prefs.cc +++ b/chrome/browser/prefs/browser_prefs.cc @@ -119,8 +119,7 @@ void RegisterUserPrefs(PrefService* user_prefs) { TemplateURLPrepopulateData::RegisterUserPrefs(user_prefs); ExtensionDOMUI::RegisterUserPrefs(user_prefs); ExtensionsUI::RegisterUserPrefs(user_prefs); - if (about_flags::IsEnabled()) - FlagsUI::RegisterUserPrefs(user_prefs); + FlagsUI::RegisterUserPrefs(user_prefs); NewTabUI::RegisterUserPrefs(user_prefs); PluginsUI::RegisterUserPrefs(user_prefs); ProfileImpl::RegisterUserPrefs(user_prefs); |