diff options
-rw-r--r-- | ash/shelf/shelf_layout_manager.cc | 34 | ||||
-rw-r--r-- | ash/shelf/shelf_layout_manager.h | 4 | ||||
-rw-r--r-- | ash/wm/gestures/shelf_gesture_handler.cc | 16 |
3 files changed, 36 insertions, 18 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); diff --git a/ash/wm/gestures/shelf_gesture_handler.cc b/ash/wm/gestures/shelf_gesture_handler.cc index aba69fd..2d3e9b9 100644 --- a/ash/wm/gestures/shelf_gesture_handler.cc +++ b/ash/wm/gestures/shelf_gesture_handler.cc @@ -12,6 +12,7 @@ #include "ash/shell.h" #include "ash/system/status_area_widget.h" #include "ash/wm/gestures/tray_gesture_handler.h" +#include "ash/wm/window_properties.h" #include "ash/wm/window_util.h" #include "ui/aura/window.h" #include "ui/compositor/layer.h" @@ -37,14 +38,17 @@ bool ShelfGestureHandler::ProcessGestureEvent(const ui::GestureEvent& event) { return false; } - // The gesture are disabled for fullscreen windows. - aura::Window* active = wm::GetActiveWindow(); - if (active && wm::IsWindowFullscreen(active)) + // TODO(oshima): Find the root window controller from event's location. + RootWindowController* controller = Shell::GetPrimaryRootWindowController(); + + ShelfLayoutManager* shelf = controller->GetShelfLayoutManager(); + + // The gesture are disabled for fullscreen windows that are not in immersive + // mode. + aura::Window* fullscreen = controller->GetFullscreenWindow(); + if (fullscreen && !shelf->FullscreenWithMinimalChrome()) return false; - // TODO(oshima): Find the root window controller from event's location. - ShelfLayoutManager* shelf = - Shell::GetPrimaryRootWindowController()->GetShelfLayoutManager(); if (event.type() == ui::ET_GESTURE_SCROLL_BEGIN) { drag_in_progress_ = true; shelf->StartGestureDrag(event); |