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