Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(3626)

Unified Diff: ash/shelf/shelf_layout_manager.cc

Issue 14740012: Enable shelf gestures in immersive mode (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Responded to pkotwicz's comments Created 7 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: ash/shelf/shelf_layout_manager.cc
diff --git a/ash/shelf/shelf_layout_manager.cc b/ash/shelf/shelf_layout_manager.cc
index a441ab3d1a3ff03c01888a4d925a310ab340ca7c..6d2916ad97cb092d62797551ee92d636540f3bcb 100644
--- a/ash/shelf/shelf_layout_manager.cc
+++ b/ash/shelf/shelf_layout_manager.cc
@@ -296,21 +296,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 (IsInImmersiveMode()) {
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());
@@ -440,17 +434,20 @@ void ShelfLayoutManager::CompleteGestureDrag(const ui::GestureEvent& gesture) {
CancelGestureDrag();
return;
}
-
- 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();
James Cook 2013/05/22 12:04:22 Won't this line crash is shelf_ is NULL? Either y
rharrison 2013/05/22 20:20:02 Done.
+ gesture_drag_auto_hide_state_ =
+ gesture_drag_auto_hide_state_ == SHELF_AUTO_HIDE_SHOWN ?
+ SHELF_AUTO_HIDE_HIDDEN : SHELF_AUTO_HIDE_SHOWN;
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 (!IsInImmersiveMode()) {
+ 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;
@@ -960,5 +957,18 @@ gfx::Insets ShelfLayoutManager::GetInsetsForAlignment(int distance) const {
return gfx::Insets();
}
+bool ShelfLayoutManager::IsInImmersiveMode() 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;
+}
+
+
} // namespace internal
} // namespace ash

Powered by Google App Engine
This is Rietveld 408576698