diff options
author | jamescook@chromium.org <jamescook@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-02-05 17:47:28 +0000 |
---|---|---|
committer | jamescook@chromium.org <jamescook@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-02-05 17:47:28 +0000 |
commit | 50f9ad57874b74ebcffe92cd044a5ba1846a5f58 (patch) | |
tree | d53d96e5aedb7a96e07b0d652a2bb9ebaebe80e7 | |
parent | 7fbb534651b0c1827558198a6f8d898b659e5960 (diff) | |
download | chromium_src-50f9ad57874b74ebcffe92cd044a5ba1846a5f58.zip chromium_src-50f9ad57874b74ebcffe92cd044a5ba1846a5f58.tar.gz chromium_src-50f9ad57874b74ebcffe92cd044a5ba1846a5f58.tar.bz2 |
ash: Turn immersive mode off by default for M26
* Add back the --ash-immersive-mode flag
* Change about:flags to just turn immersive mode on/off
* Convert --ash-immersive-hide-tab-indicators as a command-line only flag
BUG=174060
TEST=browser_tests BrowserNonClientFrameViewAsh unit_tests ImmersiveModeController
Review URL: https://codereview.chromium.org/12194022
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@180720 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r-- | ash/ash_switches.cc | 6 | ||||
-rw-r--r-- | ash/ash_switches.h | 1 | ||||
-rw-r--r-- | chrome/app/generated_resources.grd | 7 | ||||
-rw-r--r-- | chrome/browser/about_flags.cc | 10 | ||||
-rw-r--r-- | chrome/browser/ui/views/frame/browser_non_client_frame_view_ash.cc | 61 | ||||
-rw-r--r-- | chrome/browser/ui/views/frame/browser_non_client_frame_view_ash_browsertest.cc | 16 |
6 files changed, 59 insertions, 42 deletions
diff --git a/ash/ash_switches.cc b/ash/ash_switches.cc index 1b9299e..150799a 100644 --- a/ash/ash_switches.cc +++ b/ash/ash_switches.cc @@ -76,7 +76,11 @@ const char kAshEnablePerAppLauncher[] = "ash-enable-per-app-launcher"; // Enables showing the tray bubble by dragging on the shelf. const char kAshEnableTrayDragging[] = "ash-enable-tray-dragging"; -// Hides the small tab indicators at the top of the screen. +// Enables immersive mode. +const char kAshImmersiveMode[] = "ash-immersive-mode"; + +// Enables immersive mode and hides the small tab indicators at the top of the +// screen. const char kAshImmersiveHideTabIndicators[] = "ash-immersive-hide-tab-indicators"; diff --git a/ash/ash_switches.h b/ash/ash_switches.h index 95bee8d..3a06eb1 100644 --- a/ash/ash_switches.h +++ b/ash/ash_switches.h @@ -39,6 +39,7 @@ ASH_EXPORT extern const char kAshEnableOak[]; ASH_EXPORT extern const char kAshEnablePerAppLauncher[]; ASH_EXPORT extern const char kAshEnableTrayDragging[]; ASH_EXPORT extern const char kAshEnableWorkspaceScrubbing[]; +ASH_EXPORT extern const char kAshImmersiveMode[]; ASH_EXPORT extern const char kAshImmersiveHideTabIndicators[]; ASH_EXPORT extern const char kAshSecondaryDisplayLayout[]; ASH_EXPORT extern const char kAshTouchHud[]; diff --git a/chrome/app/generated_resources.grd b/chrome/app/generated_resources.grd index 45fe36d..dfc4aec 100644 --- a/chrome/app/generated_resources.grd +++ b/chrome/app/generated_resources.grd @@ -6775,13 +6775,10 @@ Keep your key file in a safe place. You will need it to create new versions of y Enables workspace switching via 3 finger vertical scroll. </message> <message name="IDS_FLAGS_ASH_IMMERSIVE_MODE_NAME" desc="Title for the flag to set the immersive mode style."> - Immersive window style + Immersive mode </message> <message name="IDS_FLAGS_ASH_IMMERSIVE_MODE_DESCRIPTION" desc="Description for the flag to enable immersive mode."> - Sets the style of an "immersive mode" for browser windows that gives more space to web content. Activate immersive mode by maximizing a window then clicking on the button in the top right corner. - </message> - <message name="IDS_FLAGS_ASH_IMMERSIVE_HIDE_TAB_INDICATORS" desc="Description a selection in the immersive mode popup menu."> - Hide tab indicators + Adds an "immersive mode" for browser windows that gives more space to web content. Activate immersive mode by maximizing a window then clicking on the button in the top right corner. </message> <message name="IDS_FLAGS_ENABLE_MEMORY_MONITOR_NAME" desc="Title for the flag to enable advanced gestures."> Enable memory monitor diff --git a/chrome/browser/about_flags.cc b/chrome/browser/about_flags.cc index 2ee017b..db431a8 100644 --- a/chrome/browser/about_flags.cc +++ b/chrome/browser/about_flags.cc @@ -230,14 +230,6 @@ const Experiment::Choice kChromeCaptivePortalDetectionChoices[] = { }; #endif -#if defined(USE_ASH) -const Experiment::Choice kAshImmersiveModeChoices[] = { - { IDS_GENERIC_EXPERIMENT_CHOICE_DEFAULT, "", ""}, - { IDS_FLAGS_ASH_IMMERSIVE_HIDE_TAB_INDICATORS, - ash::switches::kAshImmersiveHideTabIndicators, ""} -}; -#endif - // RECORDING USER METRICS FOR FLAGS: // ----------------------------------------------------------------------------- // The first line of the experiment is the internal name. If you'd like to @@ -1112,7 +1104,7 @@ const Experiment kExperiments[] = { IDS_FLAGS_ASH_IMMERSIVE_MODE_NAME, IDS_FLAGS_ASH_IMMERSIVE_MODE_DESCRIPTION, kOsCrOS, - MULTI_VALUE_TYPE(kAshImmersiveModeChoices), + SINGLE_VALUE_TYPE(ash::switches::kAshImmersiveMode), }, #if defined(OS_LINUX) { "ash-enable-memory-monitor", diff --git a/chrome/browser/ui/views/frame/browser_non_client_frame_view_ash.cc b/chrome/browser/ui/views/frame/browser_non_client_frame_view_ash.cc index 190ead2..2b330d8 100644 --- a/chrome/browser/ui/views/frame/browser_non_client_frame_view_ash.cc +++ b/chrome/browser/ui/views/frame/browser_non_client_frame_view_ash.cc @@ -4,8 +4,10 @@ #include "chrome/browser/ui/views/frame/browser_non_client_frame_view_ash.h" +#include "ash/ash_switches.h" #include "ash/wm/frame_painter.h" #include "ash/wm/workspace/frame_maximize_button.h" +#include "base/command_line.h" #include "chrome/browser/themes/theme_service.h" #include "chrome/browser/ui/browser.h" #include "chrome/browser/ui/views/avatar_menu_button.h" @@ -33,6 +35,8 @@ #include "ui/views/widget/widget.h" #include "ui/views/widget/widget_delegate.h" +using ash::switches::kAshImmersiveMode; + namespace { // The avatar ends 2 px above the bottom of the tabstrip (which, given the @@ -117,16 +121,18 @@ void BrowserNonClientFrameViewAsh::Init() { frame_painter_->Init(frame(), window_icon_, size_button_, close_button_, size_button_behavior); - // Button to toggle immersive mode. - immersive_button_ = new views::ToggleImageButton(this); - immersive_button_->SetAccessibleName( - l10n_util::GetStringUTF16(IDS_ACCNAME_IMMERSIVE)); - immersive_button_->SetTooltipText( - l10n_util::GetStringUTF16(IDS_TOOLTIP_IMMERSIVE)); - immersive_button_->SetImageAlignment(views::ImageButton::ALIGN_LEFT, - views::ImageButton::ALIGN_BOTTOM); - AddChildView(immersive_button_); - frame_painter_->AddImmersiveButton(immersive_button_); + if (CommandLine::ForCurrentProcess()->HasSwitch(kAshImmersiveMode)) { + // Button to toggle immersive mode. + immersive_button_ = new views::ToggleImageButton(this); + immersive_button_->SetAccessibleName( + l10n_util::GetStringUTF16(IDS_ACCNAME_IMMERSIVE)); + immersive_button_->SetTooltipText( + l10n_util::GetStringUTF16(IDS_TOOLTIP_IMMERSIVE)); + immersive_button_->SetImageAlignment(views::ImageButton::ALIGN_LEFT, + views::ImageButton::ALIGN_BOTTOM); + AddChildView(immersive_button_); + frame_painter_->AddImmersiveButton(immersive_button_); + } } /////////////////////////////////////////////////////////////////////////////// @@ -197,21 +203,23 @@ void BrowserNonClientFrameViewAsh::GetWindowMask(const gfx::Size& size, } void BrowserNonClientFrameViewAsh::ResetWindowControls() { - // Hide the caption buttons in immersive mode because it's confusing when - // the user hovers or clicks in the top-right of the screen and hits one. - // Only show them during a reveal. - ImmersiveModeController* controller = - browser_view()->immersive_mode_controller(); - if (controller->enabled()) { - bool revealed = controller->IsRevealed(); - immersive_button_->SetVisible(revealed); - size_button_->SetVisible(revealed); - close_button_->SetVisible(revealed); - } else { - // Only show immersive button for maximized windows. - immersive_button_->SetVisible(frame()->IsMaximized()); - size_button_->SetVisible(true); - close_button_->SetVisible(true); + if (CommandLine::ForCurrentProcess()->HasSwitch(kAshImmersiveMode)) { + // Hide the caption buttons in immersive mode because it's confusing when + // the user hovers or clicks in the top-right of the screen and hits one. + // Only show them during a reveal. + ImmersiveModeController* controller = + browser_view()->immersive_mode_controller(); + if (controller->enabled()) { + bool revealed = controller->IsRevealed(); + immersive_button_->SetVisible(revealed); + size_button_->SetVisible(revealed); + close_button_->SetVisible(revealed); + } else { + // Only show immersive button for maximized windows. + immersive_button_->SetVisible(frame()->IsMaximized()); + size_button_->SetVisible(true); + close_button_->SetVisible(true); + } } size_button_->SetState(views::CustomButton::STATE_NORMAL); @@ -319,7 +327,8 @@ void BrowserNonClientFrameViewAsh::ButtonPressed(views::Button* sender, // |this| may be deleted - some windows delete their frames on maximize. } else if (sender == close_button_) { frame()->Close(); - } else if (sender == immersive_button_) { + } else if (CommandLine::ForCurrentProcess()->HasSwitch(kAshImmersiveMode) && + sender == immersive_button_) { // Toggle immersive mode. ImmersiveModeController* controller = browser_view()->immersive_mode_controller(); diff --git a/chrome/browser/ui/views/frame/browser_non_client_frame_view_ash_browsertest.cc b/chrome/browser/ui/views/frame/browser_non_client_frame_view_ash_browsertest.cc index da5b29f..3248fbf 100644 --- a/chrome/browser/ui/views/frame/browser_non_client_frame_view_ash_browsertest.cc +++ b/chrome/browser/ui/views/frame/browser_non_client_frame_view_ash_browsertest.cc @@ -5,6 +5,8 @@ #include "chrome/browser/ui/views/frame/browser_non_client_frame_view_ash.h" #include "ash/ash_constants.h" +#include "ash/ash_switches.h" +#include "base/command_line.h" #include "chrome/browser/ui/browser.h" #include "chrome/browser/ui/views/frame/browser_view.h" #include "chrome/browser/ui/views/immersive_mode_controller.h" @@ -15,7 +17,19 @@ using views::Widget; -typedef InProcessBrowserTest BrowserNonClientFrameViewAshTest; +class BrowserNonClientFrameViewAshTest : public InProcessBrowserTest { + public: + BrowserNonClientFrameViewAshTest() {} + virtual ~BrowserNonClientFrameViewAshTest() {} + + // content::BrowserTestBase overrides: + virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE { + command_line->AppendSwitch(ash::switches::kAshImmersiveMode); + } + + private: + DISALLOW_COPY_AND_ASSIGN(BrowserNonClientFrameViewAshTest); +}; IN_PROC_BROWSER_TEST_F(BrowserNonClientFrameViewAshTest, WindowHeader) { // We know we're using Views, so static cast. |