From 1af1dfeff5d142a28b69906ac544be6675e6bf7a Mon Sep 17 00:00:00 2001 From: "thakis@chromium.org" Date: Tue, 19 Oct 2010 23:49:14 +0000 Subject: 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 --- chrome/browser/about_flags.cc | 28 ++++++++++------------------ chrome/browser/about_flags.h | 3 --- chrome/browser/about_flags_unittest.cc | 15 --------------- chrome/browser/browser_about_handler.cc | 14 +++++--------- chrome/browser/dom_ui/dom_ui_factory.cc | 4 ++-- chrome/browser/prefs/browser_prefs.cc | 3 +-- 6 files changed, 18 insertions(+), 49 deletions(-) (limited to 'chrome') 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 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("About Pages\n"); html.append("

List of About pages