summaryrefslogtreecommitdiffstats
path: root/ash
diff options
context:
space:
mode:
authorpkotwicz@chromium.org <pkotwicz@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-04-30 17:49:20 +0000
committerpkotwicz@chromium.org <pkotwicz@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-04-30 17:49:20 +0000
commit700849ffe63508dc0868271f257ada11bcdf2791 (patch)
tree95fe7b776d78e4a75108ac2515e2f69653ef7db1 /ash
parent982970e2cc90dba47e0cc264fea7a46988ddfd8b (diff)
downloadchromium_src-700849ffe63508dc0868271f257ada11bcdf2791.zip
chromium_src-700849ffe63508dc0868271f257ada11bcdf2791.tar.gz
chromium_src-700849ffe63508dc0868271f257ada11bcdf2791.tar.bz2
Hide the tab indicators and the shelf when in immersive + tab fullscreen.
BUG=234447, 233271 Test=ImmersiveModeControllerAshTest.TabAndBrowserFullscreen, RootWindowController.GetFullscreenWindow Review URL: https://chromiumcodereview.appspot.com/14340007 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@197400 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ash')
-rw-r--r--ash/root_window_controller.cc9
-rw-r--r--ash/root_window_controller.h7
-rw-r--r--ash/root_window_controller_unittest.cc43
-rw-r--r--ash/shelf/shelf_layout_manager.cc18
-rw-r--r--ash/wm/window_properties.cc2
-rw-r--r--ash/wm/window_properties.h9
-rw-r--r--ash/wm/window_util.cc12
-rw-r--r--ash/wm/window_util.h3
8 files changed, 50 insertions, 53 deletions
diff --git a/ash/root_window_controller.cc b/ash/root_window_controller.cc
index 3dbc7a9..81117d9 100644
--- a/ash/root_window_controller.cc
+++ b/ash/root_window_controller.cc
@@ -35,6 +35,7 @@
#include "ash/wm/system_modal_container_layout_manager.h"
#include "ash/wm/toplevel_window_event_handler.h"
#include "ash/wm/window_properties.h"
+#include "ash/wm/window_util.h"
#include "ash/wm/workspace_controller.h"
#include "base/command_line.h"
#include "base/time.h"
@@ -445,14 +446,14 @@ void RootWindowController::UpdateShelfVisibility() {
shelf_->shelf_layout_manager()->UpdateVisibilityState();
}
-bool RootWindowController::IsImmersiveMode() const {
+aura::Window* RootWindowController::GetFullscreenWindow() const {
aura::Window* container = workspace_controller_->GetActiveWorkspaceWindow();
for (size_t i = 0; i < container->children().size(); ++i) {
aura::Window* child = container->children()[i];
- if (child->IsVisible() && child->GetProperty(kImmersiveModeKey))
- return true;
+ if (ash::wm::IsWindowFullscreen(child))
+ return child;
}
- return false;
+ return NULL;
}
void RootWindowController::InitKeyboard() {
diff --git a/ash/root_window_controller.h b/ash/root_window_controller.h
index 45c2807..f8855a7 100644
--- a/ash/root_window_controller.h
+++ b/ash/root_window_controller.h
@@ -169,9 +169,10 @@ class ASH_EXPORT RootWindowController {
// Force the shelf to query for it's current visibility state.
void UpdateShelfVisibility();
- // Returns true if the active workspace is in immersive mode. Exposed here
- // so clients of Ash don't need to know the details of workspace management.
- bool IsImmersiveMode() const;
+ // Returns the window, if any, which is in fullscreen mode in the active
+ // workspace. Exposed here so clients of Ash don't need to know the details
+ // of workspace management.
+ aura::Window* GetFullscreenWindow() const;
private:
// Creates each of the special window containers that holds windows of various
diff --git a/ash/root_window_controller_unittest.cc b/ash/root_window_controller_unittest.cc
index c5bd68d..55b3ed2 100644
--- a/ash/root_window_controller_unittest.cc
+++ b/ash/root_window_controller_unittest.cc
@@ -372,31 +372,34 @@ TEST_F(RootWindowControllerTest, ModalContainerNotLoggedInLoggedIn) {
session_modal_widget->GetNativeView()));
}
-// Ensure a workspace with two windows reports immersive mode even if only
-// one has the property set.
-TEST_F(RootWindowControllerTest, ImmersiveMode) {
+// Test that GetFullscreenWindow() returns a fullscreen window only if the
+// fullscreen window is in the active workspace.
+TEST_F(RootWindowControllerTest, GetFullscreenWindow) {
UpdateDisplay("600x600");
internal::RootWindowController* controller =
Shell::GetInstance()->GetPrimaryRootWindowController();
- // Open a maximized window.
- Widget* w1 = CreateTestWidget(gfx::Rect(0, 1, 250, 251));
+ Widget* w1 = CreateTestWidget(gfx::Rect(0, 0, 100, 100));
w1->Maximize();
-
- // Immersive mode off by default.
- EXPECT_FALSE(controller->IsImmersiveMode());
-
- // Enter immersive mode.
- w1->GetNativeWindow()->SetProperty(ash::internal::kImmersiveModeKey, true);
- EXPECT_TRUE(controller->IsImmersiveMode());
-
- // Add a child, like a print window. Still in immersive mode.
- Widget* w2 =
- Widget::CreateWindowWithParentAndBounds(NULL,
- w1->GetNativeWindow(),
- gfx::Rect(0, 1, 150, 151));
- w2->Show();
- EXPECT_TRUE(controller->IsImmersiveMode());
+ Widget* w2 = CreateTestWidget(gfx::Rect(0, 0, 100, 100));
+ w2->SetFullscreen(true);
+ // |w3| is a transient child of |w2|.
+ Widget* w3 = Widget::CreateWindowWithParentAndBounds(NULL,
+ w2->GetNativeWindow(), gfx::Rect(0, 0, 100, 100));
+
+ // Test that GetFullscreenWindow() finds the fullscreen window when one of
+ // its transient children is active.
+ w3->Activate();
+ EXPECT_EQ(w2->GetNativeWindow(), controller->GetFullscreenWindow());
+
+ // Activate the maximized window's workspace. GetFullscreenWindow() should
+ // fail because the fullscreen window's workspace is no longer active.
+ w1->Activate();
+ EXPECT_FALSE(controller->GetFullscreenWindow());
+
+ // If the fullscreen window is active, GetFullscreenWindow() should find it.
+ w2->Activate();
+ EXPECT_EQ(w2->GetNativeWindow(), controller->GetFullscreenWindow());
}
} // namespace test
diff --git a/ash/shelf/shelf_layout_manager.cc b/ash/shelf/shelf_layout_manager.cc
index 977655f..fa4e47f 100644
--- a/ash/shelf/shelf_layout_manager.cc
+++ b/ash/shelf/shelf_layout_manager.cc
@@ -19,6 +19,7 @@
#include "ash/system/status_area_widget.h"
#include "ash/wm/property_util.h"
#include "ash/wm/window_cycle_controller.h"
+#include "ash/wm/window_properties.h"
#include "ash/wm/window_util.h"
#include "ash/wm/workspace_controller.h"
#include "ash/wm/workspace/workspace_animations.h"
@@ -276,18 +277,21 @@ void ShelfLayoutManager::UpdateVisibilityState() {
// TODO(zelidrag): Verify shelf drag animation still shows on the device
// when we are in SHELF_AUTO_HIDE_ALWAYS_HIDDEN.
SetState(CalculateShelfVisibilityWhileDragging());
- } else if (GetRootWindowController(root_window_)->IsImmersiveMode()) {
- // The user choosing immersive mode indicates he or she wants to maximize
- // screen real-estate for content, so always auto-hide the shelf.
- DCHECK_NE(auto_hide_behavior_, SHELF_AUTO_HIDE_ALWAYS_HIDDEN);
- SetState(SHELF_AUTO_HIDE);
} else {
WorkspaceWindowState window_state(workspace_controller_->GetWindowState());
switch (window_state) {
case WORKSPACE_WINDOW_STATE_FULL_SCREEN:
- SetState(SHELF_HIDDEN);
+ {
+ aura::Window* fullscreen_window =
+ GetRootWindowController(root_window_)->GetFullscreenWindow();
+ if (fullscreen_window->GetProperty(kFullscreenUsesMinimalChromeKey)) {
+ DCHECK_NE(auto_hide_behavior_, SHELF_AUTO_HIDE_ALWAYS_HIDDEN);
+ SetState(SHELF_AUTO_HIDE);
+ } else {
+ SetState(SHELF_HIDDEN);
+ }
break;
-
+ }
case WORKSPACE_WINDOW_STATE_MAXIMIZED:
SetState(CalculateShelfVisibility());
break;
diff --git a/ash/wm/window_properties.cc b/ash/wm/window_properties.cc
index 8b0ed34..21f205a 100644
--- a/ash/wm/window_properties.cc
+++ b/ash/wm/window_properties.cc
@@ -22,9 +22,9 @@ DEFINE_OWNED_WINDOW_PROPERTY_KEY(ash::internal::AlwaysOnTopController,
NULL);
DEFINE_WINDOW_PROPERTY_KEY(bool, kContinueDragAfterReparent, false);
DEFINE_WINDOW_PROPERTY_KEY(bool, kCyclingThroughWorkspacesKey, false);
+DEFINE_WINDOW_PROPERTY_KEY(bool, kFullscreenUsesMinimalChromeKey, false);
DEFINE_WINDOW_PROPERTY_KEY(bool, kIgnoreSoloWindowFramePainterPolicy, false);
DEFINE_WINDOW_PROPERTY_KEY(bool, kIgnoredByShelfKey, false);
-DEFINE_WINDOW_PROPERTY_KEY(bool, kImmersiveModeKey, false);
DEFINE_WINDOW_PROPERTY_KEY(bool, kPanelAttachedKey, true);
DEFINE_WINDOW_PROPERTY_KEY(
ui::WindowShowState, kRestoreShowStateKey, ui::SHOW_STATE_DEFAULT);
diff --git a/ash/wm/window_properties.h b/ash/wm/window_properties.h
index 21d7ae9..7847b62 100644
--- a/ash/wm/window_properties.h
+++ b/ash/wm/window_properties.h
@@ -38,6 +38,12 @@ extern const aura::WindowProperty<bool>* const kContinueDragAfterReparent;
ASH_EXPORT extern const aura::WindowProperty<bool>* const
kCyclingThroughWorkspacesKey;
+// A property key to indicate whether there is any chrome at all that cannot be
+// hidden when the window is fullscreen. This is unrelated to whether the full
+// chrome can be revealed by hovering the mouse at the top of the screen.
+ASH_EXPORT extern const aura::WindowProperty<bool>* const
+ kFullscreenUsesMinimalChromeKey;
+
// A property key to disable the frame painter policy for solo windows.
// It is only available for root windows.
ASH_EXPORT extern const aura::WindowProperty<bool>* const
@@ -48,9 +54,6 @@ ASH_EXPORT extern const aura::WindowProperty<bool>* const
extern const aura::WindowProperty<bool>* const
kIgnoredByShelfKey;
-// True if this is a browser window in immersive mode.
-ASH_EXPORT extern const aura::WindowProperty<bool>* const kImmersiveModeKey;
-
// True if this window is an attached panel.
ASH_EXPORT extern const aura::WindowProperty<bool>* const kPanelAttachedKey;
diff --git a/ash/wm/window_util.cc b/ash/wm/window_util.cc
index b85824f..f11b3bc 100644
--- a/ash/wm/window_util.cc
+++ b/ash/wm/window_util.cc
@@ -50,18 +50,6 @@ aura::Window* GetActivatableWindow(aura::Window* window) {
return views::corewm::GetActivatableWindow(window);
}
-bool IsActiveWindowFullscreen() {
- aura::Window* window = GetActiveWindow();
- while (window) {
- if (window->GetProperty(aura::client::kShowStateKey) ==
- ui::SHOW_STATE_FULLSCREEN) {
- return true;
- }
- window = window->parent();
- }
- return false;
-}
-
bool CanActivateWindow(aura::Window* window) {
return views::corewm::CanActivateWindow(window);
}
diff --git a/ash/wm/window_util.h b/ash/wm/window_util.h
index cf7b0e7..1ffeb7d 100644
--- a/ash/wm/window_util.h
+++ b/ash/wm/window_util.h
@@ -43,9 +43,6 @@ ASH_EXPORT bool CanActivateWindow(aura::Window* window);
// this is probably what you're looking for.
ASH_EXPORT aura::Window* GetActivatableWindow(aura::Window* window);
-// Returns true if the active window or one its ancestors is fullscreen.
-ASH_EXPORT bool IsActiveWindowFullscreen();
-
// Returns true if |window| can be maximized.
ASH_EXPORT bool CanMaximizeWindow(const aura::Window* window);