diff options
-rw-r--r-- | ash/ash_switches.cc | 10 | ||||
-rw-r--r-- | ash/ash_switches.h | 2 | ||||
-rw-r--r-- | chrome/app/generated_resources.grd | 8 | ||||
-rw-r--r-- | chrome/browser/about_flags.cc | 8 | ||||
-rw-r--r-- | chrome/browser/ui/ash/chrome_shell_delegate.cc | 14 | ||||
-rw-r--r-- | chrome/browser/ui/ash/chrome_shell_delegate.h | 3 | ||||
-rw-r--r-- | chrome/browser/ui/ash/chrome_shell_delegate_browsertest.cc | 16 | ||||
-rw-r--r-- | chrome/browser/ui/browser_browsertest.cc | 3 | ||||
-rw-r--r-- | chrome/browser/ui/views/frame/browser_non_client_frame_view_ash.cc | 6 | ||||
-rw-r--r-- | chrome/browser/ui/views/frame/browser_non_client_frame_view_ash_browsertest.cc | 14 | ||||
-rw-r--r-- | chrome/browser/ui/views/frame/browser_view.cc | 15 | ||||
-rw-r--r-- | chrome/browser/ui/views/immersive_mode_controller.cc | 12 | ||||
-rw-r--r-- | chrome/browser/ui/views/immersive_mode_controller.h | 4 | ||||
-rw-r--r-- | chrome/browser/ui/views/immersive_mode_controller_browsertest.cc | 23 |
14 files changed, 76 insertions, 62 deletions
diff --git a/ash/ash_switches.cc b/ash/ash_switches.cc index bc0877d..9a8fb94 100644 --- a/ash/ash_switches.cc +++ b/ash/ash_switches.cc @@ -45,6 +45,9 @@ const char kAshDisableDisplayChangeLimiter[] = // Disables boot animation v2, go back to v1. const char kAshDisableBootAnimation2[] = "ash-disable-boot-animation2"; +// Disables immersive fullscreen mode. +const char kAshDisableImmersiveMode[] = "ash-disable-immersive-mode"; + // Enable advanced gestures (e.g. for window management). const char kAshEnableAdvancedGestures[] = "ash-enable-advanced-gestures"; @@ -79,11 +82,8 @@ const char kAshEnableTrayDragging[] = "ash-enable-tray-dragging"; // "1024x768*2" sets the scale factor to 2 for a high DPI display. const char kAshHostWindowBounds[] = "ash-host-window-bounds"; -// Enables immersive mode. -const char kAshImmersiveMode[] = "ash-immersive-mode"; - -// Enables immersive mode and hides the small tab indicators at the top of the -// screen. +// Hides the small tab indicators at the top of the screen during immersive +// fullscreen mode. const char kAshImmersiveHideTabIndicators[] = "ash-immersive-hide-tab-indicators"; diff --git a/ash/ash_switches.h b/ash/ash_switches.h index 0a65d77..528195a 100644 --- a/ash/ash_switches.h +++ b/ash/ash_switches.h @@ -27,6 +27,7 @@ ASH_EXPORT extern const char kAshDisableAutoWindowPlacement[]; ASH_EXPORT extern const char kAshDisableDisplayChangeLimiter[]; ASH_EXPORT extern const char kAshDisablePerAppLauncher[]; ASH_EXPORT extern const char kAshDisableBootAnimation2[]; +ASH_EXPORT extern const char kAshDisableImmersiveMode[]; ASH_EXPORT extern const char kAshDisableNewLockAnimations[]; ASH_EXPORT extern const char kAshDisableLauncherPerDisplay[]; ASH_EXPORT extern const char kAshEnableAdvancedGestures[]; @@ -39,7 +40,6 @@ ASH_EXPORT extern const char kAshEnableOak[]; ASH_EXPORT extern const char kAshEnableTrayDragging[]; ASH_EXPORT extern const char kAshEnableWorkspaceScrubbing[]; ASH_EXPORT extern const char kAshHostWindowBounds[]; -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 e3bcd1d..6e15bd7 100644 --- a/chrome/app/generated_resources.grd +++ b/chrome/app/generated_resources.grd @@ -6635,11 +6635,11 @@ Keep your key file in a safe place. You will need it to create new versions of y <message name="IDS_FLAGS_ENABLE_WORKSPACE_SCRUBBING_DESCRIPTION" desc="Description for the flag to enable workspace scrubbing."> 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 mode + <message name="IDS_FLAGS_ASH_DISABLE_IMMERSIVE_MODE_NAME" desc="Title for the flag for immersive mode."> + Disable immersive fullscreen </message> - <message name="IDS_FLAGS_ASH_IMMERSIVE_MODE_DESCRIPTION" desc="Description for the flag to enable immersive mode."> - 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 name="IDS_FLAGS_ASH_DISABLE_IMMERSIVE_MODE_DESCRIPTION" desc="Description for the flag for immersive mode."> + Disables "immersive fullscreen" where the tab strip at the top and the app shelf at the bottom are still accessible in fullscreen. </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 557139f..9842634 100644 --- a/chrome/browser/about_flags.cc +++ b/chrome/browser/about_flags.cc @@ -1100,11 +1100,11 @@ const Experiment kExperiments[] = { kOsCrOS, SINGLE_VALUE_TYPE(ash::switches::kAshEnableWorkspaceScrubbing), }, - { "ash-immersive-mode", - IDS_FLAGS_ASH_IMMERSIVE_MODE_NAME, - IDS_FLAGS_ASH_IMMERSIVE_MODE_DESCRIPTION, + { "ash-disable-immersive-mode", + IDS_FLAGS_ASH_DISABLE_IMMERSIVE_MODE_NAME, + IDS_FLAGS_ASH_DISABLE_IMMERSIVE_MODE_DESCRIPTION, kOsCrOS, - SINGLE_VALUE_TYPE(ash::switches::kAshImmersiveMode), + SINGLE_VALUE_TYPE(ash::switches::kAshDisableImmersiveMode), }, #if defined(OS_LINUX) { "ash-enable-memory-monitor", diff --git a/chrome/browser/ui/ash/chrome_shell_delegate.cc b/chrome/browser/ui/ash/chrome_shell_delegate.cc index d91e568..b974f7b 100644 --- a/chrome/browser/ui/ash/chrome_shell_delegate.cc +++ b/chrome/browser/ui/ash/chrome_shell_delegate.cc @@ -58,6 +58,17 @@ ChromeShellDelegate::~ChromeShellDelegate() { instance_ = NULL; } +// static +bool ChromeShellDelegate::UseImmersiveFullscreen() { +#if defined(OS_CHROMEOS) + // Kiosk mode needs the whole screen. + CommandLine* command_line = CommandLine::ForCurrentProcess(); + return !command_line->HasSwitch(switches::kKioskMode) && + !command_line->HasSwitch(ash::switches::kAshDisableImmersiveMode); +#endif + return false; +} + bool ChromeShellDelegate::IsRunningInForcedAppMode() const { return chrome::IsRunningInForcedAppMode(); } @@ -96,8 +107,7 @@ void ChromeShellDelegate::ToggleMaximized() { // TODO(jamescook): If immersive mode replaces fullscreen, rename this // function and the interface to ToggleFullscreen. - if (CommandLine::ForCurrentProcess()-> - HasSwitch(ash::switches::kAshImmersiveMode)) { + if (UseImmersiveFullscreen()) { chrome::ToggleFullscreenMode(GetTargetBrowser()); return; } diff --git a/chrome/browser/ui/ash/chrome_shell_delegate.h b/chrome/browser/ui/ash/chrome_shell_delegate.h index d99511d..cac1031 100644 --- a/chrome/browser/ui/ash/chrome_shell_delegate.h +++ b/chrome/browser/ui/ash/chrome_shell_delegate.h @@ -31,6 +31,9 @@ class ChromeShellDelegate : public ash::ShellDelegate, static ChromeShellDelegate* instance() { return instance_; } + // Prefer the version in ImmersiveModeController. + static bool UseImmersiveFullscreen(); + ash::WindowPositioner* window_positioner() { return window_positioner_.get(); } diff --git a/chrome/browser/ui/ash/chrome_shell_delegate_browsertest.cc b/chrome/browser/ui/ash/chrome_shell_delegate_browsertest.cc index 63b8844..11ea795 100644 --- a/chrome/browser/ui/ash/chrome_shell_delegate_browsertest.cc +++ b/chrome/browser/ui/ash/chrome_shell_delegate_browsertest.cc @@ -4,9 +4,11 @@ #include "chrome/browser/ui/ash/chrome_shell_delegate.h" +#include "ash/ash_switches.h" #include "ash/shell.h" #include "ash/shell_delegate.h" #include "ash/wm/window_util.h" +#include "base/command_line.h" #include "chrome/browser/ui/browser.h" #include "chrome/browser/ui/browser_commands.h" #include "chrome/browser/ui/browser_finder.h" @@ -18,9 +20,21 @@ typedef InProcessBrowserTest ChromeShellDelegateBrowserTest; IN_PROC_BROWSER_TEST_F(ChromeShellDelegateBrowserTest, ToggleMaximized) { ash::ShellDelegate* shell_delegate = ash::Shell::GetInstance()->delegate(); ASSERT_TRUE(shell_delegate); + aura::Window* window = ash::wm::GetActiveWindow(); + ASSERT_TRUE(window); + + if (ChromeShellDelegate::UseImmersiveFullscreen()) { + // "ToggleMaximized" toggles immersive fullscreen. + EXPECT_FALSE(ash::wm::IsWindowMaximized(window)); + EXPECT_FALSE(ash::wm::IsWindowFullscreen(window)); + shell_delegate->ToggleMaximized(); + EXPECT_TRUE(ash::wm::IsWindowFullscreen(window)); + shell_delegate->ToggleMaximized(); + EXPECT_FALSE(ash::wm::IsWindowFullscreen(window)); + return; + } // When not in fullscreen, ShellDelegate::ToggleMaximized toggles Maximized. - aura::Window* window = ash::wm::GetActiveWindow(); EXPECT_FALSE(ash::wm::IsWindowMaximized(window)); shell_delegate->ToggleMaximized(); EXPECT_TRUE(ash::wm::IsWindowMaximized(window)); diff --git a/chrome/browser/ui/browser_browsertest.cc b/chrome/browser/ui/browser_browsertest.cc index b04b7d3..84177e0 100644 --- a/chrome/browser/ui/browser_browsertest.cc +++ b/chrome/browser/ui/browser_browsertest.cc @@ -1671,6 +1671,9 @@ IN_PROC_BROWSER_TEST_F(BrowserTest, FullscreenBookmarkBar) { EXPECT_TRUE(browser()->window()->IsFullscreen()); #if defined(OS_MACOSX) EXPECT_EQ(BookmarkBar::SHOW, browser()->bookmark_bar_state()); +#elif defined(OS_CHROMEOS) + // Immersive fullscreen behaves like Mac presentation mode. + EXPECT_EQ(BookmarkBar::SHOW, browser()->bookmark_bar_state()); #else EXPECT_EQ(BookmarkBar::HIDDEN, browser()->bookmark_bar_state()); #endif 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 307cfbc..a06fbc7 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,10 +4,8 @@ #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_properties.h" #include "chrome/browser/ui/browser.h" #include "chrome/browser/ui/views/avatar_menu_button.h" @@ -35,8 +33,6 @@ #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 @@ -190,7 +186,7 @@ void BrowserNonClientFrameViewAsh::GetWindowMask(const gfx::Size& size, } void BrowserNonClientFrameViewAsh::ResetWindowControls() { - if (CommandLine::ForCurrentProcess()->HasSwitch(kAshImmersiveMode)) { + if (ImmersiveModeController::UseImmersiveFullscreen()) { // 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. 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 f2aa71d..12d8934 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 @@ -17,19 +17,7 @@ using views::Widget; -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); -}; +typedef InProcessBrowserTest BrowserNonClientFrameViewAshTest; IN_PROC_BROWSER_TEST_F(BrowserNonClientFrameViewAshTest, WindowHeader) { // We know we're using Views, so static cast. diff --git a/chrome/browser/ui/views/frame/browser_view.cc b/chrome/browser/ui/views/frame/browser_view.cc index da7700d..079b838 100644 --- a/chrome/browser/ui/views/frame/browser_view.cc +++ b/chrome/browser/ui/views/frame/browser_view.cc @@ -121,7 +121,6 @@ #include "ui/views/window/dialog_delegate.h" #if defined(USE_ASH) -#include "ash/ash_switches.h" #include "ash/launcher/launcher.h" #include "ash/launcher/launcher_model.h" #include "ash/shell.h" @@ -248,14 +247,10 @@ bool ShouldSaveOrRestoreWindowPos() { // Returns whether immersive mode should replace fullscreen, which should only // occur for "browser-fullscreen" and not for "tab-fullscreen" (which has a URL // for the tab entering fullscreen). -bool UseImmersiveFullscreen(const GURL& url) { -#if defined(USE_ASH) +bool UseImmersiveFullscreenForUrl(const GURL& url) { bool is_browser_fullscreen = url.is_empty(); return is_browser_fullscreen && - CommandLine::ForCurrentProcess()->HasSwitch( - ash::switches::kAshImmersiveMode); -#endif - return false; + ImmersiveModeController::UseImmersiveFullscreen(); } } // namespace @@ -868,7 +863,7 @@ void BrowserView::UpdateFullscreenExitBubbleContent( // Immersive mode has no exit bubble because it has a visible strip at the // top that gives the user a hover target. // TODO(jamescook): Figure out what to do with mouse-lock. - if (bubble_type == FEB_TYPE_NONE || UseImmersiveFullscreen(url)) { + if (bubble_type == FEB_TYPE_NONE || UseImmersiveFullscreenForUrl(url)) { fullscreen_bubble_.reset(); } else if (fullscreen_bubble_.get()) { fullscreen_bubble_->UpdateContent(url, bubble_type); @@ -2390,7 +2385,7 @@ void BrowserView::ProcessFullscreen(bool fullscreen, } // Enable immersive before the browser refreshes its list of enabled commands. - if (UseImmersiveFullscreen(url)) + if (UseImmersiveFullscreenForUrl(url)) immersive_mode_controller_->SetEnabled(fullscreen); browser_->WindowFullscreenStateChanged(); @@ -2398,7 +2393,7 @@ void BrowserView::ProcessFullscreen(bool fullscreen, if (fullscreen) { if (!chrome::IsRunningInAppMode() && type != FOR_METRO && - !UseImmersiveFullscreen(url)) { + !UseImmersiveFullscreenForUrl(url)) { fullscreen_bubble_.reset(new FullscreenExitBubbleViews( GetWidget(), browser_.get(), url, bubble_type)); } diff --git a/chrome/browser/ui/views/immersive_mode_controller.cc b/chrome/browser/ui/views/immersive_mode_controller.cc index 669393f..5f7c8e3 100644 --- a/chrome/browser/ui/views/immersive_mode_controller.cc +++ b/chrome/browser/ui/views/immersive_mode_controller.cc @@ -9,6 +9,7 @@ #include "chrome/browser/ui/views/frame/contents_container.h" #include "chrome/browser/ui/views/tabs/tab_strip.h" #include "chrome/browser/ui/views/toolbar_view.h" +#include "chrome/common/chrome_switches.h" #include "ui/compositor/compositor_observer.h" #include "ui/compositor/scoped_layer_animation_settings.h" #include "ui/gfx/screen.h" @@ -359,6 +360,17 @@ void ImmersiveModeController::Init() { #endif } +// static +bool ImmersiveModeController::UseImmersiveFullscreen() { +#if defined(OS_CHROMEOS) + // Kiosk mode needs the whole screen. + CommandLine* command_line = CommandLine::ForCurrentProcess(); + return !command_line->HasSwitch(switches::kKioskMode) && + !command_line->HasSwitch(ash::switches::kAshDisableImmersiveMode); +#endif + return false; +} + void ImmersiveModeController::SetEnabled(bool enabled) { if (enabled_ == enabled) return; diff --git a/chrome/browser/ui/views/immersive_mode_controller.h b/chrome/browser/ui/views/immersive_mode_controller.h index f7f9f44..5a48b94 100644 --- a/chrome/browser/ui/views/immersive_mode_controller.h +++ b/chrome/browser/ui/views/immersive_mode_controller.h @@ -33,6 +33,10 @@ class ImmersiveModeController : public ui::EventHandler, // Must initialize after browser view has a Widget and native window. void Init(); + // Returns true if immersive mode should be used for fullscreen based on + // command line flags. + static bool UseImmersiveFullscreen(); + // Enables or disables immersive mode. void SetEnabled(bool enabled); bool enabled() const { return enabled_; } diff --git a/chrome/browser/ui/views/immersive_mode_controller_browsertest.cc b/chrome/browser/ui/views/immersive_mode_controller_browsertest.cc index 00ef4fc..9a8c761 100644 --- a/chrome/browser/ui/views/immersive_mode_controller_browsertest.cc +++ b/chrome/browser/ui/views/immersive_mode_controller_browsertest.cc @@ -33,15 +33,10 @@ gfx::Rect GetRectInWidget(views::View* view) { typedef InProcessBrowserTest ImmersiveModeControllerTest; -// TODO(jamescook): If immersive mode becomes popular on Ash, consider porting +// TODO(jamescook): If immersive mode becomes popular on CrOS, consider porting // it to other Aura platforms (win_aura, linux_aura). http://crbug.com/163931 -#if !defined(USE_ASH) -#define MAYBE_ImmersiveMode DISABLED_ImmersiveMode -#else -#define MAYBE_ImmersiveMode ImmersiveMode -#endif - -IN_PROC_BROWSER_TEST_F(ImmersiveModeControllerTest, MAYBE_ImmersiveMode) { +#if defined(OS_CHROMEOS) +IN_PROC_BROWSER_TEST_F(ImmersiveModeControllerTest, ImmersiveMode) { ui::LayerAnimator::set_disable_animations_for_test(true); BrowserView* browser_view = static_cast<BrowserView*>(browser()->window()); @@ -210,14 +205,8 @@ IN_PROC_BROWSER_TEST_F(ImmersiveModeControllerTest, MAYBE_ImmersiveMode) { controller->StartRevealForTest(); } -#if defined(USE_ASH) -// Ash-specific immersive mode tests. -IN_PROC_BROWSER_TEST_F(ImmersiveModeControllerTest, ImmersiveAsh) { -#if defined(OS_WIN) - // Not running in Ash, so this doesn't doesn't make sense. - if (!ash::Shell::HasInstance()) - return; -#endif +// Shelf-specific immersive mode tests. +IN_PROC_BROWSER_TEST_F(ImmersiveModeControllerTest, ImmersiveShelf) { ui::LayerAnimator::set_disable_animations_for_test(true); BrowserView* browser_view = static_cast<BrowserView*>(browser()->window()); @@ -266,4 +255,4 @@ IN_PROC_BROWSER_TEST_F(ImmersiveModeControllerTest, ImmersiveAsh) { EXPECT_FALSE(immersive_controller->enabled()); } -#endif // defined(USE_ASH) +#endif // defined(OS_CHROMEOS) |