diff options
author | rharrison@chromium.org <rharrison@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-05-23 10:33:51 +0000 |
---|---|---|
committer | rharrison@chromium.org <rharrison@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-05-23 10:33:51 +0000 |
commit | a4c5eb7e3f3787e50d1c7588e6f6a24ba475a0e4 (patch) | |
tree | a6d634c463c23c644176dafa087b18ddaaded77c /ash/shelf | |
parent | 034c7b8754fc2b1313cb860ff48cd9a7f1a1375e (diff) | |
download | chromium_src-a4c5eb7e3f3787e50d1c7588e6f6a24ba475a0e4.zip chromium_src-a4c5eb7e3f3787e50d1c7588e6f6a24ba475a0e4.tar.gz chromium_src-a4c5eb7e3f3787e50d1c7588e6f6a24ba475a0e4.tar.bz2 |
This CL modifies the check that prevents shelf gestures from working in
fullscreen mode so that it allows gestures during immersive mode.
This also modifies the drag completion behaviour to keep the shelf in the
correct state while immersive.
BUG=chromium:224301
BUG=chromium:230039
TEST=Tested that swipe in/out works in immersive mode.
Tested that transitioning between immersive and non-immersive doesn't break
the shelf.
Tested that swiping doesn't work in traditional fullscreen mode.
Review URL: https://chromiumcodereview.appspot.com/14740012
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@201733 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ash/shelf')
-rw-r--r-- | ash/shelf/shelf_layout_manager.cc | 34 | ||||
-rw-r--r-- | ash/shelf/shelf_layout_manager.h | 4 |
2 files changed, 26 insertions, 12 deletions
diff --git a/ash/shelf/shelf_layout_manager.cc b/ash/shelf/shelf_layout_manager.cc index 0bcbf0a..cf3e9b3 100644 --- a/ash/shelf/shelf_layout_manager.cc +++ b/ash/shelf/shelf_layout_manager.cc @@ -294,21 +294,15 @@ void ShelfLayoutManager::UpdateVisibilityState() { WorkspaceWindowState window_state(workspace_controller_->GetWindowState()); switch (window_state) { case WORKSPACE_WINDOW_STATE_FULL_SCREEN: - { - aura::Window* fullscreen_window = - GetRootWindowController(root_window_)->GetFullscreenWindow(); - if (fullscreen_window->GetProperty(kFullscreenUsesMinimalChromeKey)) { - DCHECK_NE(auto_hide_behavior_, SHELF_AUTO_HIDE_ALWAYS_HIDDEN); + if (FullscreenWithMinimalChrome()) { SetState(SHELF_AUTO_HIDE); } else { SetState(SHELF_HIDDEN); } break; - } case WORKSPACE_WINDOW_STATE_MAXIMIZED: SetState(CalculateShelfVisibility()); break; - case WORKSPACE_WINDOW_STATE_WINDOW_OVERLAPS_SHELF: case WORKSPACE_WINDOW_STATE_DEFAULT: SetState(CalculateShelfVisibility()); @@ -438,17 +432,21 @@ void ShelfLayoutManager::CompleteGestureDrag(const ui::GestureEvent& gesture) { CancelGestureDrag(); return; } - + if (shelf_) { + shelf_->Deactivate(); + shelf_->status_area_widget()->Deactivate(); + } gesture_drag_auto_hide_state_ = gesture_drag_auto_hide_state_ == SHELF_AUTO_HIDE_SHOWN ? SHELF_AUTO_HIDE_HIDDEN : SHELF_AUTO_HIDE_SHOWN; - if (shelf_) - shelf_->Deactivate(); - shelf_->status_area_widget()->Deactivate(); if (gesture_drag_auto_hide_state_ == SHELF_AUTO_HIDE_HIDDEN && auto_hide_behavior_ != SHELF_AUTO_HIDE_BEHAVIOR_ALWAYS) { gesture_drag_status_ = GESTURE_DRAG_NONE; - SetAutoHideBehavior(SHELF_AUTO_HIDE_BEHAVIOR_ALWAYS); + if (!FullscreenWithMinimalChrome()) { + SetAutoHideBehavior(SHELF_AUTO_HIDE_BEHAVIOR_ALWAYS); + } else { + UpdateVisibilityState(); + } } else if (gesture_drag_auto_hide_state_ == SHELF_AUTO_HIDE_SHOWN && auto_hide_behavior_ != SHELF_AUTO_HIDE_BEHAVIOR_NEVER) { gesture_drag_status_ = GESTURE_DRAG_NONE; @@ -517,6 +515,18 @@ bool ShelfLayoutManager::IsHorizontalAlignment() const { alignment_ == SHELF_ALIGNMENT_TOP; } +bool ShelfLayoutManager::FullscreenWithMinimalChrome() const { + RootWindowController* controller = GetRootWindowController(root_window_); + if (!controller) + return false; + aura::Window* window = controller->GetFullscreenWindow(); + if (!window) + return false; + if (!window->GetProperty(kFullscreenUsesMinimalChromeKey)) + return false; + return true; +} + // static ShelfLayoutManager* ShelfLayoutManager::ForLauncher(aura::Window* window) { ShelfWidget* shelf = RootWindowController::ForLauncher(window)->shelf(); diff --git a/ash/shelf/shelf_layout_manager.h b/ash/shelf/shelf_layout_manager.h index d074e65..e2018f8 100644 --- a/ash/shelf/shelf_layout_manager.h +++ b/ash/shelf/shelf_layout_manager.h @@ -184,6 +184,10 @@ class ASH_EXPORT ShelfLayoutManager : // Is the shelf's alignment horizontal? bool IsHorizontalAlignment() const; + // Tests if the browser is currently in fullscreen mode with minimal + // Chrome. When minimal Chrome is present the shelf should be displayed. + bool FullscreenWithMinimalChrome() const; + // Returns a ShelfLayoutManager on the display which has a launcher for // given |window|. See RootWindowController::ForLauncher for more info. static ShelfLayoutManager* ForLauncher(aura::Window* window); |