diff options
author | thakis@chromium.org <thakis@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-10-19 23:49:14 +0000 |
---|---|---|
committer | thakis@chromium.org <thakis@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-10-19 23:49:14 +0000 |
commit | 1af1dfeff5d142a28b69906ac544be6675e6bf7a (patch) | |
tree | 6632302596e91b37cf740f52eefed41d9e2233de | |
parent | 8bbc466e17e93268b724bae1732e33a0b34c28c8 (diff) | |
download | chromium_src-1af1dfeff5d142a28b69906ac544be6675e6bf7a.zip chromium_src-1af1dfeff5d142a28b69906ac544be6675e6bf7a.tar.gz chromium_src-1af1dfeff5d142a28b69906ac544be6675e6bf7a.tar.bz2 |
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
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@63137 0039d316-1c4b-4281-b951-d872f2087c98
-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 b61f0ce..5167109 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 }, { @@ -81,14 +83,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 }, { @@ -139,7 +141,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 }, // FIXME(scheib): Add Flags entry for WebGL, @@ -251,6 +253,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 @@ -260,15 +264,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); } @@ -321,9 +316,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 38f27a6..2babe90 100644 --- a/chrome/browser/browser_about_handler.cc +++ b/chrome/browser/browser_about_handler.cc @@ -260,8 +260,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 || @@ -1087,13 +1085,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 149da5b..8ed538f 100644 --- a/chrome/browser/dom_ui/dom_ui_factory.cc +++ b/chrome/browser/dom_ui/dom_ui_factory.cc @@ -133,7 +133,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) @@ -274,7 +274,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 a5957c3..0b65bf0 100644 --- a/chrome/browser/prefs/browser_prefs.cc +++ b/chrome/browser/prefs/browser_prefs.cc @@ -120,8 +120,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); |