| 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_COMMON_SHELF_SHELF_LAYOUT_MANAGER_H_ | 5 #ifndef ASH_COMMON_SHELF_SHELF_LAYOUT_MANAGER_H_ |
| 6 #define ASH_COMMON_SHELF_SHELF_LAYOUT_MANAGER_H_ | 6 #define ASH_COMMON_SHELF_SHELF_LAYOUT_MANAGER_H_ |
| 7 | 7 |
| 8 #include <memory> | 8 #include <memory> |
| 9 | 9 |
| 10 #include "ash/ash_export.h" | 10 #include "ash/ash_export.h" |
| 11 #include "ash/common/session/session_state_observer.h" | 11 #include "ash/common/session/session_state_observer.h" |
| 12 #include "ash/common/shelf/shelf_widget.h" | 12 #include "ash/common/shelf/wm_shelf.h" |
| 13 #include "ash/common/shell_observer.h" | 13 #include "ash/common/shell_observer.h" |
| 14 #include "ash/common/wm/background_animator.h" | 14 #include "ash/common/wm/background_animator.h" |
| 15 #include "ash/common/wm/dock/docked_window_layout_manager_observer.h" | 15 #include "ash/common/wm/dock/docked_window_layout_manager_observer.h" |
| 16 #include "ash/common/wm/lock_state_observer.h" | 16 #include "ash/common/wm/lock_state_observer.h" |
| 17 #include "ash/common/wm/wm_snap_to_pixel_layout_manager.h" | 17 #include "ash/common/wm/wm_snap_to_pixel_layout_manager.h" |
| 18 #include "ash/common/wm/workspace/workspace_types.h" | 18 #include "ash/common/wm/workspace/workspace_types.h" |
| 19 #include "ash/common/wm_activation_observer.h" | 19 #include "ash/common/wm_activation_observer.h" |
| 20 #include "ash/public/cpp/shelf_types.h" | 20 #include "ash/public/cpp/shelf_types.h" |
| 21 #include "base/macros.h" | 21 #include "base/macros.h" |
| 22 #include "base/observer_list.h" | 22 #include "base/observer_list.h" |
| 23 #include "base/timer/timer.h" | 23 #include "base/timer/timer.h" |
| 24 #include "ui/gfx/geometry/insets.h" | 24 #include "ui/gfx/geometry/insets.h" |
| 25 #include "ui/gfx/geometry/rect.h" | 25 #include "ui/gfx/geometry/rect.h" |
| 26 #include "ui/keyboard/keyboard_controller_observer.h" | 26 #include "ui/keyboard/keyboard_controller_observer.h" |
| 27 | 27 |
| 28 namespace ui { | 28 namespace ui { |
| 29 class ImplicitAnimationObserver; | 29 class ImplicitAnimationObserver; |
| 30 class MouseEvent; |
| 30 } | 31 } |
| 31 | 32 |
| 32 namespace ash { | 33 namespace ash { |
| 33 | 34 |
| 34 class PanelLayoutManagerTest; | 35 class PanelLayoutManagerTest; |
| 35 class ShelfLayoutManagerObserver; | 36 class ShelfLayoutManagerObserver; |
| 36 class ShelfLayoutManagerTest; | 37 class ShelfLayoutManagerTest; |
| 37 class ShelfWidget; | 38 class ShelfWidget; |
| 38 class WmShelf; | 39 class WmShelf; |
| 39 | 40 |
| (...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 142 // Overridden from keyboard::KeyboardControllerObserver: | 143 // Overridden from keyboard::KeyboardControllerObserver: |
| 143 void OnKeyboardBoundsChanging(const gfx::Rect& new_bounds) override; | 144 void OnKeyboardBoundsChanging(const gfx::Rect& new_bounds) override; |
| 144 void OnKeyboardClosed() override; | 145 void OnKeyboardClosed() override; |
| 145 | 146 |
| 146 // Overridden from LockStateObserver: | 147 // Overridden from LockStateObserver: |
| 147 void OnLockStateEvent(LockStateObserver::EventType event) override; | 148 void OnLockStateEvent(LockStateObserver::EventType event) override; |
| 148 | 149 |
| 149 // Overridden from SessionStateObserver: | 150 // Overridden from SessionStateObserver: |
| 150 void SessionStateChanged(session_manager::SessionState state) override; | 151 void SessionStateChanged(session_manager::SessionState state) override; |
| 151 | 152 |
| 152 // TODO(msw): Remove these accessors, kept temporarily to simplify changes. | |
| 153 ShelfAlignment GetAlignment() const { return shelf_widget_->GetAlignment(); } | |
| 154 | |
| 155 // TODO(harrym|oshima): These templates will be moved to a new Shelf class. | 153 // TODO(harrym|oshima): These templates will be moved to a new Shelf class. |
| 156 // A helper function for choosing values specific to a shelf alignment. | 154 // A helper function for choosing values specific to a shelf alignment. |
| 157 template <typename T> | 155 template <typename T> |
| 158 T SelectValueForShelfAlignment(T bottom, T left, T right) const { | 156 T SelectValueForShelfAlignment(T bottom, T left, T right) const { |
| 159 switch (GetAlignment()) { | 157 switch (wm_shelf_->GetAlignment()) { |
| 160 case SHELF_ALIGNMENT_BOTTOM: | 158 case SHELF_ALIGNMENT_BOTTOM: |
| 161 case SHELF_ALIGNMENT_BOTTOM_LOCKED: | 159 case SHELF_ALIGNMENT_BOTTOM_LOCKED: |
| 162 return bottom; | 160 return bottom; |
| 163 case SHELF_ALIGNMENT_LEFT: | 161 case SHELF_ALIGNMENT_LEFT: |
| 164 return left; | 162 return left; |
| 165 case SHELF_ALIGNMENT_RIGHT: | 163 case SHELF_ALIGNMENT_RIGHT: |
| 166 return right; | 164 return right; |
| 167 } | 165 } |
| 168 NOTREACHED(); | 166 NOTREACHED(); |
| 169 return right; | 167 return right; |
| 170 } | 168 } |
| 171 | 169 |
| 172 template <typename T> | 170 template <typename T> |
| 173 T PrimaryAxisValue(T horizontal, T vertical) const { | 171 T PrimaryAxisValue(T horizontal, T vertical) const { |
| 174 return IsHorizontalAlignment() ? horizontal : vertical; | 172 return wm_shelf_->IsHorizontalAlignment() ? horizontal : vertical; |
| 175 } | 173 } |
| 176 | 174 |
| 177 // Is the shelf's alignment horizontal? | |
| 178 bool IsHorizontalAlignment() const; | |
| 179 | |
| 180 // Returns how the shelf background should be painted. | 175 // Returns how the shelf background should be painted. |
| 181 ShelfBackgroundType GetShelfBackgroundType() const; | 176 ShelfBackgroundType GetShelfBackgroundType() const; |
| 182 | 177 |
| 183 // Set the height of the ChromeVox panel, which takes away space from the | 178 // Set the height of the ChromeVox panel, which takes away space from the |
| 184 // available work area from the top of the screen. | 179 // available work area from the top of the screen. |
| 185 void SetChromeVoxPanelHeight(int height); | 180 void SetChromeVoxPanelHeight(int height); |
| 186 | 181 |
| 187 private: | 182 private: |
| 188 class UpdateShelfObserver; | 183 class UpdateShelfObserver; |
| 189 friend class PanelLayoutManagerTest; | 184 friend class PanelLayoutManagerTest; |
| (...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 361 // The current shelf background. Should not be assigned to directly, use | 356 // The current shelf background. Should not be assigned to directly, use |
| 362 // MaybeUpdateShelfBackground() instead. | 357 // MaybeUpdateShelfBackground() instead. |
| 363 ShelfBackgroundType shelf_background_type_; | 358 ShelfBackgroundType shelf_background_type_; |
| 364 | 359 |
| 365 DISALLOW_COPY_AND_ASSIGN(ShelfLayoutManager); | 360 DISALLOW_COPY_AND_ASSIGN(ShelfLayoutManager); |
| 366 }; | 361 }; |
| 367 | 362 |
| 368 } // namespace ash | 363 } // namespace ash |
| 369 | 364 |
| 370 #endif // ASH_COMMON_SHELF_SHELF_LAYOUT_MANAGER_H_ | 365 #endif // ASH_COMMON_SHELF_SHELF_LAYOUT_MANAGER_H_ |
| OLD | NEW |