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/common/shelf/shelf_layout_manager.h" | 5 #include "ash/common/shelf/shelf_layout_manager.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <cmath> | 8 #include <cmath> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
11 #include "ash/animation/animation_change_type.h" | 11 #include "ash/animation/animation_change_type.h" |
12 #include "ash/common/material_design/material_design_controller.h" | |
13 #include "ash/common/session/session_controller.h" | 12 #include "ash/common/session/session_controller.h" |
14 #include "ash/common/session/session_state_delegate.h" | 13 #include "ash/common/session/session_state_delegate.h" |
15 #include "ash/common/shelf/shelf_constants.h" | 14 #include "ash/common/shelf/shelf_constants.h" |
16 #include "ash/common/shelf/shelf_layout_manager_observer.h" | 15 #include "ash/common/shelf/shelf_layout_manager_observer.h" |
17 #include "ash/common/shelf/shelf_widget.h" | 16 #include "ash/common/shelf/shelf_widget.h" |
18 #include "ash/common/shelf/wm_shelf.h" | 17 #include "ash/common/shelf/wm_shelf.h" |
19 #include "ash/common/system/status_area_widget.h" | 18 #include "ash/common/system/status_area_widget.h" |
20 #include "ash/common/wm/fullscreen_window_finder.h" | 19 #include "ash/common/wm/fullscreen_window_finder.h" |
21 #include "ash/common/wm/mru_window_tracker.h" | 20 #include "ash/common/wm/mru_window_tracker.h" |
22 #include "ash/common/wm/window_state.h" | 21 #include "ash/common/wm/window_state.h" |
(...skipping 1005 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1028 } | 1027 } |
1029 | 1028 |
1030 float ShelfLayoutManager::ComputeTargetOpacity(const State& state) { | 1029 float ShelfLayoutManager::ComputeTargetOpacity(const State& state) { |
1031 if (gesture_drag_status_ == GESTURE_DRAG_IN_PROGRESS || | 1030 if (gesture_drag_status_ == GESTURE_DRAG_IN_PROGRESS || |
1032 state.visibility_state == SHELF_VISIBLE) { | 1031 state.visibility_state == SHELF_VISIBLE) { |
1033 return 1.0f; | 1032 return 1.0f; |
1034 } | 1033 } |
1035 // In Chrome OS Material Design, when shelf is hidden during auto hide state, | 1034 // In Chrome OS Material Design, when shelf is hidden during auto hide state, |
1036 // target bounds are also hidden. So the window can extend to the edge of | 1035 // target bounds are also hidden. So the window can extend to the edge of |
1037 // screen. | 1036 // screen. |
1038 if (ash::MaterialDesignController::IsImmersiveModeMaterial()) { | 1037 return (state.visibility_state == SHELF_AUTO_HIDE && |
1039 return (state.visibility_state == SHELF_AUTO_HIDE && | 1038 state.auto_hide_state == SHELF_AUTO_HIDE_SHOWN) |
1040 state.auto_hide_state == SHELF_AUTO_HIDE_SHOWN) | 1039 ? 1.0f |
1041 ? 1.0f | 1040 : 0.0f; |
1042 : 0.0f; | |
1043 } | |
1044 return (state.visibility_state == SHELF_AUTO_HIDE) ? 1.0f : 0.0f; | |
1045 } | 1041 } |
1046 | 1042 |
1047 bool ShelfLayoutManager::IsShelfHiddenForFullscreen() const { | 1043 bool ShelfLayoutManager::IsShelfHiddenForFullscreen() const { |
1048 const WmWindow* fullscreen_window = wm::GetWindowForFullscreenMode( | 1044 const WmWindow* fullscreen_window = wm::GetWindowForFullscreenMode( |
1049 WmLookup::Get()->GetWindowForWidget(shelf_widget_)); | 1045 WmLookup::Get()->GetWindowForWidget(shelf_widget_)); |
1050 return fullscreen_window && | 1046 return fullscreen_window && |
1051 fullscreen_window->GetWindowState()->hide_shelf_when_fullscreen(); | 1047 fullscreen_window->GetWindowState()->hide_shelf_when_fullscreen(); |
1052 } | 1048 } |
1053 | 1049 |
1054 //////////////////////////////////////////////////////////////////////////////// | 1050 //////////////////////////////////////////////////////////////////////////////// |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1139 gesture_drag_status_ = GESTURE_DRAG_NONE; | 1135 gesture_drag_status_ = GESTURE_DRAG_NONE; |
1140 } | 1136 } |
1141 | 1137 |
1142 void ShelfLayoutManager::CancelGestureDrag() { | 1138 void ShelfLayoutManager::CancelGestureDrag() { |
1143 gesture_drag_status_ = GESTURE_DRAG_CANCEL_IN_PROGRESS; | 1139 gesture_drag_status_ = GESTURE_DRAG_CANCEL_IN_PROGRESS; |
1144 UpdateVisibilityState(); | 1140 UpdateVisibilityState(); |
1145 gesture_drag_status_ = GESTURE_DRAG_NONE; | 1141 gesture_drag_status_ = GESTURE_DRAG_NONE; |
1146 } | 1142 } |
1147 | 1143 |
1148 } // namespace ash | 1144 } // namespace ash |
OLD | NEW |