| 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 if (visibility_state() == SHELF_AUTO_HIDE) { |
| 397 | 397 gesture_drag_auto_hide_state_ = SHELF_AUTO_HIDE_SHOWN; |
| 398 if (workspace_controller_->GetWindowState() == | 398 gesture_drag_status_ = GESTURE_DRAG_COMPLETE_IN_PROGRESS; |
| 399 WORKSPACE_WINDOW_STATE_FULL_SCREEN) { | 399 UpdateVisibilityState(); |
| 400 accelerators::ToggleFullscreen(); | 400 gesture_drag_status_ = GESTURE_DRAG_NONE; |
| 401 } | |
| 402 | |
| 403 ShelfVisibilityState visibility = CalculateShelfVisibility(); | |
| 404 if (visibility == SHELF_AUTO_HIDE && | |
| 405 CalculateAutoHideState(visibility) == SHELF_AUTO_HIDE_HIDDEN) { | |
| 406 SetState(SHELF_VISIBLE); | |
| 407 SetAutoHideBehavior(SHELF_AUTO_HIDE_BEHAVIOR_NEVER); | |
| 408 } | 401 } |
| 409 } | 402 } |
| 410 | 403 |
| 411 void ShelfLayoutManager::StartGestureDrag(const ui::GestureEvent& gesture) { | 404 void ShelfLayoutManager::StartGestureDrag(const ui::GestureEvent& gesture) { |
| 412 gesture_drag_status_ = GESTURE_DRAG_IN_PROGRESS; | 405 gesture_drag_status_ = GESTURE_DRAG_IN_PROGRESS; |
| 413 gesture_drag_amount_ = 0.f; | 406 gesture_drag_amount_ = 0.f; |
| 414 gesture_drag_auto_hide_state_ = visibility_state() == SHELF_AUTO_HIDE ? | 407 gesture_drag_auto_hide_state_ = visibility_state() == SHELF_AUTO_HIDE ? |
| 415 auto_hide_state() : SHELF_AUTO_HIDE_SHOWN; | 408 auto_hide_state() : SHELF_AUTO_HIDE_SHOWN; |
| 416 UpdateShelfBackground(BACKGROUND_CHANGE_ANIMATE); | 409 UpdateShelfBackground(BACKGROUND_CHANGE_ANIMATE); |
| 417 } | 410 } |
| (...skipping 738 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1156 SHELF_HIDDEN); | 1149 SHELF_HIDDEN); |
| 1157 TargetBounds target_bounds; | 1150 TargetBounds target_bounds; |
| 1158 CalculateTargetBounds(state_, &target_bounds); | 1151 CalculateTargetBounds(state_, &target_bounds); |
| 1159 UpdateBoundsAndOpacity(target_bounds, true, NULL); | 1152 UpdateBoundsAndOpacity(target_bounds, true, NULL); |
| 1160 UpdateVisibilityState(); | 1153 UpdateVisibilityState(); |
| 1161 } | 1154 } |
| 1162 } | 1155 } |
| 1163 | 1156 |
| 1164 } // namespace internal | 1157 } // namespace internal |
| 1165 } // namespace ash | 1158 } // namespace ash |
| OLD | NEW |