Chromium Code Reviews| 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> | |
| 10 | 9 |
| 11 #include "ash/ash_export.h" | 10 #include "ash/ash_export.h" |
| 12 #include "ash/common/session/session_state_observer.h" | 11 #include "ash/common/session/session_state_observer.h" |
| 13 #include "ash/common/shelf/shelf_types.h" | 12 #include "ash/common/shelf/shelf_types.h" |
| 14 #include "ash/common/shell_observer.h" | 13 #include "ash/common/shell_observer.h" |
| 15 #include "ash/common/system/status_area_widget.h" | |
| 16 #include "ash/common/wm/background_animator.h" | 14 #include "ash/common/wm/background_animator.h" |
| 17 #include "ash/common/wm/dock/docked_window_layout_manager_observer.h" | 15 #include "ash/common/wm/dock/docked_window_layout_manager_observer.h" |
| 18 #include "ash/common/wm/lock_state_observer.h" | 16 #include "ash/common/wm/lock_state_observer.h" |
| 19 #include "ash/common/wm/workspace/workspace_types.h" | 17 #include "ash/common/wm/workspace/workspace_types.h" |
| 20 #include "ash/shelf/shelf.h" | 18 #include "ash/common/wm_activation_observer.h" |
| 19 #include "ash/shelf/shelf_widget.h" | |
| 21 #include "ash/snap_to_pixel_layout_manager.h" | 20 #include "ash/snap_to_pixel_layout_manager.h" |
| 22 #include "ash/wm/gestures/shelf_gesture_handler.h" | 21 #include "ash/wm/gestures/shelf_gesture_handler.h" |
| 23 #include "base/compiler_specific.h" | |
| 24 #include "base/gtest_prod_util.h" | |
| 25 #include "base/logging.h" | |
| 26 #include "base/macros.h" | 22 #include "base/macros.h" |
| 27 #include "base/observer_list.h" | 23 #include "base/observer_list.h" |
| 28 #include "base/timer/timer.h" | 24 #include "base/timer/timer.h" |
| 29 #include "ui/gfx/geometry/insets.h" | 25 #include "ui/gfx/geometry/insets.h" |
| 30 #include "ui/gfx/geometry/rect.h" | 26 #include "ui/gfx/geometry/rect.h" |
| 31 #include "ui/keyboard/keyboard_controller.h" | |
| 32 #include "ui/keyboard/keyboard_controller_observer.h" | 27 #include "ui/keyboard/keyboard_controller_observer.h" |
| 33 #include "ui/wm/public/activation_change_observer.h" | |
| 34 | |
| 35 namespace aura { | |
| 36 class RootWindow; | |
| 37 } | |
| 38 | 28 |
| 39 namespace ui { | 29 namespace ui { |
| 40 class GestureEvent; | |
| 41 class ImplicitAnimationObserver; | 30 class ImplicitAnimationObserver; |
| 42 } | 31 } |
| 43 | 32 |
| 44 namespace ash { | 33 namespace ash { |
| 34 | |
| 45 class PanelLayoutManagerTest; | 35 class PanelLayoutManagerTest; |
| 46 class ScreenAsh; | |
| 47 class ShelfBezelEventFilter; | 36 class ShelfBezelEventFilter; |
| 48 class ShelfLayoutManagerObserver; | 37 class ShelfLayoutManagerObserver; |
| 49 class ShelfLayoutManagerTest; | 38 class ShelfLayoutManagerTest; |
| 50 class ShelfWidget; | 39 class ShelfWidget; |
| 51 class StatusAreaWidget; | |
| 52 class WorkspaceController; | 40 class WorkspaceController; |
| 53 FORWARD_DECLARE_TEST(AshPopupAlignmentDelegateTest, AutoHide); | |
| 54 FORWARD_DECLARE_TEST(WebNotificationTrayTest, PopupAndFullscreen); | |
| 55 | 41 |
| 56 // ShelfLayoutManager is the layout manager responsible for the shelf and | 42 // ShelfLayoutManager is the layout manager responsible for the shelf and |
| 57 // status widgets. The shelf is given the total available width and told the | 43 // status widgets. The shelf is given the total available width and told the |
| 58 // width of the status area. This allows the shelf to draw the background and | 44 // width of the status area. This allows the shelf to draw the background and |
| 59 // layout to the status area. | 45 // layout to the status area. |
| 60 // To respond to bounds changes in the status area StatusAreaLayoutManager works | 46 // To respond to bounds changes in the status area StatusAreaLayoutManager works |
| 61 // closely with ShelfLayoutManager. | 47 // closely with ShelfLayoutManager. |
| 62 // On mus, widget bounds management is handled by the window manager. | 48 // On mus, widget bounds management is handled by the window manager. |
| 63 class ASH_EXPORT ShelfLayoutManager | 49 class ASH_EXPORT ShelfLayoutManager |
| 64 : public ash::ShellObserver, | 50 : public ShellObserver, |
| 65 public aura::client::ActivationChangeObserver, | 51 public WmActivationObserver, |
| 66 public DockedWindowLayoutManagerObserver, | 52 public DockedWindowLayoutManagerObserver, |
| 67 public keyboard::KeyboardControllerObserver, | 53 public keyboard::KeyboardControllerObserver, |
| 68 public LockStateObserver, | 54 public LockStateObserver, |
| 69 public SnapToPixelLayoutManager, | 55 public SnapToPixelLayoutManager, |
| 70 public SessionStateObserver { | 56 public SessionStateObserver { |
| 71 public: | 57 public: |
| 72 explicit ShelfLayoutManager(ShelfWidget* shelf_widget); | 58 explicit ShelfLayoutManager(ShelfWidget* shelf_widget); |
| 73 ~ShelfLayoutManager() override; | 59 ~ShelfLayoutManager() override; |
| 74 | 60 |
| 75 void set_workspace_controller(WorkspaceController* controller) { | 61 void set_workspace_controller(WorkspaceController* controller) { |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 143 | 129 |
| 144 // Set an animation duration override for the show / hide animation of the | 130 // Set an animation duration override for the show / hide animation of the |
| 145 // shelf. Specifying 0 leads to use the default. | 131 // shelf. Specifying 0 leads to use the default. |
| 146 void SetAnimationDurationOverride(int duration_override_in_ms); | 132 void SetAnimationDurationOverride(int duration_override_in_ms); |
| 147 | 133 |
| 148 // Overridden from SnapLayoutManager: | 134 // Overridden from SnapLayoutManager: |
| 149 void OnWindowResized() override; | 135 void OnWindowResized() override; |
| 150 void SetChildBounds(aura::Window* child, | 136 void SetChildBounds(aura::Window* child, |
| 151 const gfx::Rect& requested_bounds) override; | 137 const gfx::Rect& requested_bounds) override; |
| 152 | 138 |
| 153 // Overridden from ash::ShellObserver: | 139 // Overridden from ShellObserver: |
| 154 void OnLockStateChanged(bool locked) override; | 140 void OnLockStateChanged(bool locked) override; |
| 155 void OnShelfAlignmentChanged(WmWindow* root_window) override; | 141 void OnShelfAlignmentChanged(WmWindow* root_window) override; |
| 156 void OnShelfAutoHideBehaviorChanged(WmWindow* root_window) override; | 142 void OnShelfAutoHideBehaviorChanged(WmWindow* root_window) override; |
| 157 void OnPinnedStateChanged(WmWindow* pinned_window) override; | 143 void OnPinnedStateChanged(WmWindow* pinned_window) override; |
| 158 | 144 |
| 159 // Overriden from aura::client::ActivationChangeObserver: | 145 // Overriden from WmActivationObserver: |
|
James Cook
2016/07/27 03:15:11
nit: "Overridden"
msw
2016/07/27 22:31:18
Done.
| |
| 160 void OnWindowActivated( | 146 void OnWindowActivated(WmWindow* gained_active, |
| 161 aura::client::ActivationChangeObserver::ActivationReason reason, | 147 WmWindow* lost_active) override; |
| 162 aura::Window* gained_active, | |
| 163 aura::Window* lost_active) override; | |
| 164 | 148 |
| 165 // Overridden from keyboard::KeyboardControllerObserver: | 149 // Overridden from keyboard::KeyboardControllerObserver: |
| 166 void OnKeyboardBoundsChanging(const gfx::Rect& new_bounds) override; | 150 void OnKeyboardBoundsChanging(const gfx::Rect& new_bounds) override; |
| 167 | 151 |
| 168 // Overridden from ash::LockStateObserver: | 152 // Overridden from LockStateObserver: |
| 169 void OnLockStateEvent(LockStateObserver::EventType event) override; | 153 void OnLockStateEvent(LockStateObserver::EventType event) override; |
| 170 | 154 |
| 171 // Overridden from ash::SessionStateObserver: | 155 // Overridden from SessionStateObserver: |
| 172 void SessionStateChanged(SessionStateDelegate::SessionState state) override; | 156 void SessionStateChanged(SessionStateDelegate::SessionState state) override; |
| 173 | 157 |
| 174 // TODO(msw): Remove these accessors, kept temporarily to simplify changes. | 158 // TODO(msw): Remove these accessors, kept temporarily to simplify changes. |
| 175 ShelfAlignment GetAlignment() const { return shelf_widget_->GetAlignment(); } | 159 ShelfAlignment GetAlignment() const { return shelf_widget_->GetAlignment(); } |
| 176 | 160 |
| 177 // TODO(harrym|oshima): These templates will be moved to a new Shelf class. | 161 // TODO(harrym|oshima): These templates will be moved to a new Shelf class. |
| 178 // A helper function for choosing values specific to a shelf alignment. | 162 // A helper function for choosing values specific to a shelf alignment. |
| 179 template <typename T> | 163 template <typename T> |
| 180 T SelectValueForShelfAlignment(T bottom, T left, T right) const { | 164 T SelectValueForShelfAlignment(T bottom, T left, T right) const { |
| 181 switch (GetAlignment()) { | 165 switch (GetAlignment()) { |
| (...skipping 18 matching lines...) Expand all Loading... | |
| 200 bool IsHorizontalAlignment() const; | 184 bool IsHorizontalAlignment() const; |
| 201 | 185 |
| 202 // Set the height of the ChromeVox panel, which takes away space from the | 186 // Set the height of the ChromeVox panel, which takes away space from the |
| 203 // available work area from the top of the screen. | 187 // available work area from the top of the screen. |
| 204 void SetChromeVoxPanelHeight(int height); | 188 void SetChromeVoxPanelHeight(int height); |
| 205 | 189 |
| 206 private: | 190 private: |
| 207 class AutoHideEventFilter; | 191 class AutoHideEventFilter; |
| 208 class RootWindowControllerObserverImpl; | 192 class RootWindowControllerObserverImpl; |
| 209 class UpdateShelfObserver; | 193 class UpdateShelfObserver; |
| 210 friend class AshPopupAlignmentDelegateTest; | |
| 211 friend class ash::ScreenAsh; | |
| 212 friend class PanelLayoutManagerTest; | 194 friend class PanelLayoutManagerTest; |
| 213 friend class ShelfLayoutManagerTest; | 195 friend class ShelfLayoutManagerTest; |
| 214 friend class ToastManagerTest; | |
| 215 FRIEND_TEST_ALL_PREFIXES(ash::AshPopupAlignmentDelegateTest, AutoHide); | |
| 216 FRIEND_TEST_ALL_PREFIXES(ash::WebNotificationTrayTest, PopupAndFullscreen); | |
| 217 | 196 |
| 218 struct TargetBounds { | 197 struct TargetBounds { |
| 219 TargetBounds(); | 198 TargetBounds(); |
| 220 ~TargetBounds(); | 199 ~TargetBounds(); |
| 221 | 200 |
| 222 float opacity; | 201 float opacity; |
| 223 float status_opacity; | 202 float status_opacity; |
| 224 gfx::Rect shelf_bounds_in_root; | 203 gfx::Rect shelf_bounds_in_root; |
| 225 gfx::Rect shelf_bounds_in_shelf; | 204 gfx::Rect shelf_bounds_in_shelf; |
| 226 gfx::Rect status_bounds_in_shelf; | 205 gfx::Rect status_bounds_in_shelf; |
| (...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 394 | 373 |
| 395 std::unique_ptr<RootWindowControllerObserverImpl> | 374 std::unique_ptr<RootWindowControllerObserverImpl> |
| 396 root_window_controller_observer_; | 375 root_window_controller_observer_; |
| 397 | 376 |
| 398 DISALLOW_COPY_AND_ASSIGN(ShelfLayoutManager); | 377 DISALLOW_COPY_AND_ASSIGN(ShelfLayoutManager); |
| 399 }; | 378 }; |
| 400 | 379 |
| 401 } // namespace ash | 380 } // namespace ash |
| 402 | 381 |
| 403 #endif // ASH_SHELF_SHELF_LAYOUT_MANAGER_H_ | 382 #endif // ASH_SHELF_SHELF_LAYOUT_MANAGER_H_ |
| OLD | NEW |