| OLD | NEW |
| 1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 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 #ifndef ASH_SHELF_SHELF_LAYOUT_MANAGER_H_ | 5 #ifndef ASH_SHELF_SHELF_LAYOUT_MANAGER_H_ |
| 6 #define ASH_SHELF_SHELF_LAYOUT_MANAGER_H_ | 6 #define ASH_SHELF_SHELF_LAYOUT_MANAGER_H_ |
| 7 | 7 |
| 8 #include <memory> | 8 #include <memory> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| 11 #include "ash/ash_export.h" | 11 #include "ash/ash_export.h" |
| 12 #include "ash/common/shelf/shelf_types.h" |
| 12 #include "ash/common/wm/background_animator.h" | 13 #include "ash/common/wm/background_animator.h" |
| 13 #include "ash/common/wm/dock/docked_window_layout_manager_observer.h" | 14 #include "ash/common/wm/dock/docked_window_layout_manager_observer.h" |
| 14 #include "ash/common/wm/workspace/workspace_types.h" | 15 #include "ash/common/wm/workspace/workspace_types.h" |
| 15 #include "ash/session/session_state_observer.h" | 16 #include "ash/session/session_state_observer.h" |
| 16 #include "ash/shelf/shelf.h" | 17 #include "ash/shelf/shelf.h" |
| 17 #include "ash/shelf/shelf_types.h" | |
| 18 #include "ash/shell_observer.h" | 18 #include "ash/shell_observer.h" |
| 19 #include "ash/snap_to_pixel_layout_manager.h" | 19 #include "ash/snap_to_pixel_layout_manager.h" |
| 20 #include "ash/system/status_area_widget.h" | 20 #include "ash/system/status_area_widget.h" |
| 21 #include "ash/wm/gestures/shelf_gesture_handler.h" | 21 #include "ash/wm/gestures/shelf_gesture_handler.h" |
| 22 #include "ash/wm/lock_state_observer.h" | 22 #include "ash/wm/lock_state_observer.h" |
| 23 #include "base/compiler_specific.h" | 23 #include "base/compiler_specific.h" |
| 24 #include "base/gtest_prod_util.h" | 24 #include "base/gtest_prod_util.h" |
| 25 #include "base/logging.h" | 25 #include "base/logging.h" |
| 26 #include "base/macros.h" | 26 #include "base/macros.h" |
| 27 #include "base/observer_list.h" | 27 #include "base/observer_list.h" |
| (...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 176 aura::Window* gained_active, | 176 aura::Window* gained_active, |
| 177 aura::Window* lost_active) override; | 177 aura::Window* lost_active) override; |
| 178 | 178 |
| 179 // Overridden from ash::LockStateObserver: | 179 // Overridden from ash::LockStateObserver: |
| 180 void OnLockStateEvent(LockStateObserver::EventType event) override; | 180 void OnLockStateEvent(LockStateObserver::EventType event) override; |
| 181 | 181 |
| 182 // Overridden from ash::SessionStateObserver: | 182 // Overridden from ash::SessionStateObserver: |
| 183 void SessionStateChanged(SessionStateDelegate::SessionState state) override; | 183 void SessionStateChanged(SessionStateDelegate::SessionState state) override; |
| 184 | 184 |
| 185 // TODO(msw): Remove these accessors, kept temporarily to simplify changes. | 185 // TODO(msw): Remove these accessors, kept temporarily to simplify changes. |
| 186 wm::ShelfAlignment GetAlignment() const { | 186 ShelfAlignment GetAlignment() const { return shelf_widget_->GetAlignment(); } |
| 187 return shelf_widget_->GetAlignment(); | |
| 188 } | |
| 189 | 187 |
| 190 // TODO(harrym|oshima): These templates will be moved to a new Shelf class. | 188 // TODO(harrym|oshima): These templates will be moved to a new Shelf class. |
| 191 // A helper function for choosing values specific to a shelf alignment. | 189 // A helper function for choosing values specific to a shelf alignment. |
| 192 template <typename T> | 190 template <typename T> |
| 193 T SelectValueForShelfAlignment(T bottom, T left, T right) const { | 191 T SelectValueForShelfAlignment(T bottom, T left, T right) const { |
| 194 switch (GetAlignment()) { | 192 switch (GetAlignment()) { |
| 195 case wm::SHELF_ALIGNMENT_BOTTOM: | 193 case SHELF_ALIGNMENT_BOTTOM: |
| 196 case wm::SHELF_ALIGNMENT_BOTTOM_LOCKED: | 194 case SHELF_ALIGNMENT_BOTTOM_LOCKED: |
| 197 return bottom; | 195 return bottom; |
| 198 case wm::SHELF_ALIGNMENT_LEFT: | 196 case SHELF_ALIGNMENT_LEFT: |
| 199 return left; | 197 return left; |
| 200 case wm::SHELF_ALIGNMENT_RIGHT: | 198 case SHELF_ALIGNMENT_RIGHT: |
| 201 return right; | 199 return right; |
| 202 } | 200 } |
| 203 NOTREACHED(); | 201 NOTREACHED(); |
| 204 return right; | 202 return right; |
| 205 } | 203 } |
| 206 | 204 |
| 207 template<typename T> | 205 template<typename T> |
| 208 T PrimaryAxisValue(T horizontal, T vertical) const { | 206 T PrimaryAxisValue(T horizontal, T vertical) const { |
| 209 return IsHorizontalAlignment() ? horizontal : vertical; | 207 return IsHorizontalAlignment() ? horizontal : vertical; |
| 210 } | 208 } |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 285 void CalculateTargetBounds(const State& state, TargetBounds* target_bounds); | 283 void CalculateTargetBounds(const State& state, TargetBounds* target_bounds); |
| 286 | 284 |
| 287 // Updates the target bounds if a gesture-drag is in progress. This is only | 285 // Updates the target bounds if a gesture-drag is in progress. This is only |
| 288 // used by |CalculateTargetBounds()|. | 286 // used by |CalculateTargetBounds()|. |
| 289 void UpdateTargetBoundsForGesture(TargetBounds* target_bounds) const; | 287 void UpdateTargetBoundsForGesture(TargetBounds* target_bounds) const; |
| 290 | 288 |
| 291 // Updates the background of the shelf. | 289 // Updates the background of the shelf. |
| 292 void UpdateShelfBackground(BackgroundAnimatorChangeType type); | 290 void UpdateShelfBackground(BackgroundAnimatorChangeType type); |
| 293 | 291 |
| 294 // Returns how the shelf background is painted. | 292 // Returns how the shelf background is painted. |
| 295 wm::ShelfBackgroundType GetShelfBackgroundType() const; | 293 ShelfBackgroundType GetShelfBackgroundType() const; |
| 296 | 294 |
| 297 // Updates the auto hide state immediately. | 295 // Updates the auto hide state immediately. |
| 298 void UpdateAutoHideStateNow(); | 296 void UpdateAutoHideStateNow(); |
| 299 | 297 |
| 300 // Stops the auto hide timer and clears | 298 // Stops the auto hide timer and clears |
| 301 // |mouse_over_shelf_when_auto_hide_timer_started_|. | 299 // |mouse_over_shelf_when_auto_hide_timer_started_|. |
| 302 void StopAutoHideTimer(); | 300 void StopAutoHideTimer(); |
| 303 | 301 |
| 304 // Returns the bounds of an additional region which can trigger showing the | 302 // Returns the bounds of an additional region which can trigger showing the |
| 305 // shelf. This region exists to make it easier to trigger showing the shelf | 303 // shelf. This region exists to make it easier to trigger showing the shelf |
| (...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 407 | 405 |
| 408 std::unique_ptr<RootWindowControllerObserverImpl> | 406 std::unique_ptr<RootWindowControllerObserverImpl> |
| 409 root_window_controller_observer_; | 407 root_window_controller_observer_; |
| 410 | 408 |
| 411 DISALLOW_COPY_AND_ASSIGN(ShelfLayoutManager); | 409 DISALLOW_COPY_AND_ASSIGN(ShelfLayoutManager); |
| 412 }; | 410 }; |
| 413 | 411 |
| 414 } // namespace ash | 412 } // namespace ash |
| 415 | 413 |
| 416 #endif // ASH_SHELF_SHELF_LAYOUT_MANAGER_H_ | 414 #endif // ASH_SHELF_SHELF_LAYOUT_MANAGER_H_ |
| OLD | NEW |