OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "ash/shelf/shelf_layout_manager.h" | 5 #include "ash/shelf/shelf_layout_manager.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <cmath> | 8 #include <cmath> |
9 #include <cstring> | 9 #include <cstring> |
10 #include <string> | 10 #include <string> |
(...skipping 375 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
386 } | 386 } |
387 | 387 |
388 void ShelfLayoutManager::RemoveObserver(ShelfLayoutManagerObserver* observer) { | 388 void ShelfLayoutManager::RemoveObserver(ShelfLayoutManagerObserver* observer) { |
389 observers_.RemoveObserver(observer); | 389 observers_.RemoveObserver(observer); |
390 } | 390 } |
391 | 391 |
392 //////////////////////////////////////////////////////////////////////////////// | 392 //////////////////////////////////////////////////////////////////////////////// |
393 // ShelfLayoutManager, Gesture functions: | 393 // ShelfLayoutManager, Gesture functions: |
394 | 394 |
395 void ShelfLayoutManager::OnGestureEdgeSwipe(const ui::GestureEvent& gesture) { | 395 void ShelfLayoutManager::OnGestureEdgeSwipe(const ui::GestureEvent& gesture) { |
396 // Edge swipe should exit fullscreen, show the tray, and disable auto-hide. | 396 WorkspaceWindowState window_state(workspace_controller_->GetWindowState()); |
397 | 397 if (window_state == WORKSPACE_WINDOW_STATE_FULL_SCREEN) { |
398 if (workspace_controller_->GetWindowState() == | 398 const aura::Window* fullscreen_window = GetRootWindowController( |
399 WORKSPACE_WINDOW_STATE_FULL_SCREEN) { | 399 root_window_)->GetWindowForFullscreenMode(); |
400 accelerators::ToggleFullscreen(); | 400 if (wm::GetWindowState(fullscreen_window)->hide_shelf_when_fullscreen()) |
| 401 return; |
| 402 } else if (CalculateShelfVisibility() == SHELF_VISIBLE) { |
| 403 // If the shelf is permanently visible, don't make an effort to display it. |
| 404 return; |
401 } | 405 } |
402 | 406 |
403 ShelfVisibilityState visibility = CalculateShelfVisibility(); | 407 gesture_drag_auto_hide_state_ = SHELF_AUTO_HIDE_SHOWN; |
404 if (visibility == SHELF_AUTO_HIDE && | 408 gesture_drag_status_ = GESTURE_DRAG_COMPLETE_IN_PROGRESS; |
405 CalculateAutoHideState(visibility) == SHELF_AUTO_HIDE_HIDDEN) { | 409 SetState(SHELF_AUTO_HIDE); |
406 SetState(SHELF_VISIBLE); | 410 gesture_drag_status_ = GESTURE_DRAG_NONE; |
407 SetAutoHideBehavior(SHELF_AUTO_HIDE_BEHAVIOR_NEVER); | |
408 } | |
409 } | 411 } |
410 | 412 |
411 void ShelfLayoutManager::StartGestureDrag(const ui::GestureEvent& gesture) { | 413 void ShelfLayoutManager::StartGestureDrag(const ui::GestureEvent& gesture) { |
412 gesture_drag_status_ = GESTURE_DRAG_IN_PROGRESS; | 414 gesture_drag_status_ = GESTURE_DRAG_IN_PROGRESS; |
413 gesture_drag_amount_ = 0.f; | 415 gesture_drag_amount_ = 0.f; |
414 gesture_drag_auto_hide_state_ = visibility_state() == SHELF_AUTO_HIDE ? | 416 gesture_drag_auto_hide_state_ = visibility_state() == SHELF_AUTO_HIDE ? |
415 auto_hide_state() : SHELF_AUTO_HIDE_SHOWN; | 417 auto_hide_state() : SHELF_AUTO_HIDE_SHOWN; |
416 UpdateShelfBackground(BACKGROUND_CHANGE_ANIMATE); | 418 UpdateShelfBackground(BACKGROUND_CHANGE_ANIMATE); |
417 } | 419 } |
418 | 420 |
(...skipping 737 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1156 SHELF_HIDDEN); | 1158 SHELF_HIDDEN); |
1157 TargetBounds target_bounds; | 1159 TargetBounds target_bounds; |
1158 CalculateTargetBounds(state_, &target_bounds); | 1160 CalculateTargetBounds(state_, &target_bounds); |
1159 UpdateBoundsAndOpacity(target_bounds, true, NULL); | 1161 UpdateBoundsAndOpacity(target_bounds, true, NULL); |
1160 UpdateVisibilityState(); | 1162 UpdateVisibilityState(); |
1161 } | 1163 } |
1162 } | 1164 } |
1163 | 1165 |
1164 } // namespace internal | 1166 } // namespace internal |
1165 } // namespace ash | 1167 } // namespace ash |
OLD | NEW |