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/wm_shelf.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/dock/docked_window_layout_manager_observer.h" | |
15 #include "ash/common/wm/lock_state_observer.h" | 14 #include "ash/common/wm/lock_state_observer.h" |
16 #include "ash/common/wm/wm_snap_to_pixel_layout_manager.h" | 15 #include "ash/common/wm/wm_snap_to_pixel_layout_manager.h" |
17 #include "ash/common/wm/workspace/workspace_types.h" | 16 #include "ash/common/wm/workspace/workspace_types.h" |
18 #include "ash/public/cpp/shelf_types.h" | 17 #include "ash/public/cpp/shelf_types.h" |
19 #include "base/macros.h" | 18 #include "base/macros.h" |
20 #include "base/observer_list.h" | 19 #include "base/observer_list.h" |
21 #include "base/timer/timer.h" | 20 #include "base/timer/timer.h" |
22 #include "ui/gfx/geometry/insets.h" | 21 #include "ui/gfx/geometry/insets.h" |
23 #include "ui/gfx/geometry/rect.h" | 22 #include "ui/gfx/geometry/rect.h" |
24 #include "ui/keyboard/keyboard_controller_observer.h" | 23 #include "ui/keyboard/keyboard_controller_observer.h" |
(...skipping 16 matching lines...) Expand all Loading... |
41 // ShelfLayoutManager is the layout manager responsible for the shelf and | 40 // ShelfLayoutManager is the layout manager responsible for the shelf and |
42 // status widgets. The shelf is given the total available width and told the | 41 // status widgets. The shelf is given the total available width and told the |
43 // width of the status area. This allows the shelf to draw the background and | 42 // width of the status area. This allows the shelf to draw the background and |
44 // layout to the status area. | 43 // layout to the status area. |
45 // To respond to bounds changes in the status area StatusAreaLayoutManager works | 44 // To respond to bounds changes in the status area StatusAreaLayoutManager works |
46 // closely with ShelfLayoutManager. | 45 // closely with ShelfLayoutManager. |
47 // On mus, widget bounds management is handled by the window manager. | 46 // On mus, widget bounds management is handled by the window manager. |
48 class ASH_EXPORT ShelfLayoutManager | 47 class ASH_EXPORT ShelfLayoutManager |
49 : public ShellObserver, | 48 : public ShellObserver, |
50 public aura::client::ActivationChangeObserver, | 49 public aura::client::ActivationChangeObserver, |
51 public DockedWindowLayoutManagerObserver, | |
52 public keyboard::KeyboardControllerObserver, | 50 public keyboard::KeyboardControllerObserver, |
53 public LockStateObserver, | 51 public LockStateObserver, |
54 public wm::WmSnapToPixelLayoutManager, | 52 public wm::WmSnapToPixelLayoutManager, |
55 public SessionStateObserver { | 53 public SessionStateObserver { |
56 public: | 54 public: |
57 ShelfLayoutManager(ShelfWidget* shelf_widget, WmShelf* wm_shelf); | 55 ShelfLayoutManager(ShelfWidget* shelf_widget, WmShelf* wm_shelf); |
58 ~ShelfLayoutManager() override; | 56 ~ShelfLayoutManager() override; |
59 | 57 |
60 bool updating_bounds() const { return updating_bounds_; } | 58 bool updating_bounds() const { return updating_bounds_; } |
61 | 59 |
62 // Clears internal data for shutdown process. | 60 // Clears internal data for shutdown process. |
63 void PrepareForShutdown(); | 61 void PrepareForShutdown(); |
64 | 62 |
65 // Returns whether the shelf and its contents (shelf, status) are visible | 63 // Returns whether the shelf and its contents (shelf, status) are visible |
66 // on the screen. | 64 // on the screen. |
67 bool IsVisible() const; | 65 bool IsVisible() const; |
68 | 66 |
69 // Returns the ideal bounds of the shelf assuming it is visible. | 67 // Returns the ideal bounds of the shelf assuming it is visible. |
70 gfx::Rect GetIdealBounds(); | 68 gfx::Rect GetIdealBounds(); |
71 | 69 |
72 // Returns the preferred size of the shelf for the target visibility state. | 70 // Returns the preferred size of the shelf for the target visibility state. |
73 gfx::Size GetPreferredSize(); | 71 gfx::Size GetPreferredSize(); |
74 | 72 |
75 // Returns the docked area bounds. | |
76 const gfx::Rect& dock_bounds() const { return dock_bounds_; } | |
77 | |
78 // Returns the bounds within the root window not occupied by the shelf nor the | 73 // Returns the bounds within the root window not occupied by the shelf nor the |
79 // virtual keyboard. | 74 // virtual keyboard. |
80 const gfx::Rect& user_work_area_bounds() const { | 75 const gfx::Rect& user_work_area_bounds() const { |
81 return user_work_area_bounds_; | 76 return user_work_area_bounds_; |
82 } | 77 } |
83 | 78 |
84 // Stops any animations and sets the bounds of the shelf and status widgets. | 79 // Stops any animations and sets the bounds of the shelf and status widgets. |
85 void LayoutShelfAndUpdateBounds(bool change_work_area); | 80 void LayoutShelfAndUpdateBounds(bool change_work_area); |
86 | 81 |
87 // Stops any animations, sets the bounds of the shelf and status widgets, and | 82 // Stops any animations, sets the bounds of the shelf and status widgets, and |
(...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
261 // Returns the AutoHideState. This value is determined from the shelf and | 256 // Returns the AutoHideState. This value is determined from the shelf and |
262 // tray. | 257 // tray. |
263 ShelfAutoHideState CalculateAutoHideState( | 258 ShelfAutoHideState CalculateAutoHideState( |
264 ShelfVisibilityState visibility_state) const; | 259 ShelfVisibilityState visibility_state) const; |
265 | 260 |
266 // Returns true if |window| is a descendant of the shelf. | 261 // Returns true if |window| is a descendant of the shelf. |
267 bool IsShelfWindow(WmWindow* window); | 262 bool IsShelfWindow(WmWindow* window); |
268 | 263 |
269 int GetWorkAreaInsets(const State& state, int size) const; | 264 int GetWorkAreaInsets(const State& state, int size) const; |
270 | 265 |
271 // Overridden from DockedWindowLayoutManagerObserver: | |
272 void OnDockBoundsChanging( | |
273 const gfx::Rect& dock_bounds, | |
274 DockedWindowLayoutManagerObserver::Reason reason) override; | |
275 | |
276 // Called when the LoginUI changes from visible to invisible. | 266 // Called when the LoginUI changes from visible to invisible. |
277 void UpdateShelfVisibilityAfterLoginUIChange(); | 267 void UpdateShelfVisibilityAfterLoginUIChange(); |
278 | 268 |
279 // Compute |target_bounds| opacity based on gesture and shelf visibility. | 269 // Compute |target_bounds| opacity based on gesture and shelf visibility. |
280 float ComputeTargetOpacity(const State& state); | 270 float ComputeTargetOpacity(const State& state); |
281 | 271 |
282 // Returns true if there is a fullscreen window open that causes the shelf | 272 // Returns true if there is a fullscreen window open that causes the shelf |
283 // to be hidden. | 273 // to be hidden. |
284 bool IsShelfHiddenForFullscreen() const; | 274 bool IsShelfHiddenForFullscreen() const; |
285 | 275 |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
333 | 323 |
334 // Manage the auto-hide state during the gesture. | 324 // Manage the auto-hide state during the gesture. |
335 ShelfAutoHideState gesture_drag_auto_hide_state_; | 325 ShelfAutoHideState gesture_drag_auto_hide_state_; |
336 | 326 |
337 // Used to delay updating shelf background. | 327 // Used to delay updating shelf background. |
338 UpdateShelfObserver* update_shelf_observer_; | 328 UpdateShelfObserver* update_shelf_observer_; |
339 | 329 |
340 // The bounds of the keyboard. | 330 // The bounds of the keyboard. |
341 gfx::Rect keyboard_bounds_; | 331 gfx::Rect keyboard_bounds_; |
342 | 332 |
343 // The bounds of the dock. | |
344 gfx::Rect dock_bounds_; | |
345 | |
346 // The bounds within the root window not occupied by the shelf nor the virtual | 333 // The bounds within the root window not occupied by the shelf nor the virtual |
347 // keyboard. | 334 // keyboard. |
348 gfx::Rect user_work_area_bounds_; | 335 gfx::Rect user_work_area_bounds_; |
349 | 336 |
350 // The height of the ChromeVox panel at the top of the screen, which | 337 // The height of the ChromeVox panel at the top of the screen, which |
351 // needs to be removed from the available work area. | 338 // needs to be removed from the available work area. |
352 int chromevox_panel_height_; | 339 int chromevox_panel_height_; |
353 | 340 |
354 // The show hide animation duration override or 0 for default. | 341 // The show hide animation duration override or 0 for default. |
355 int duration_override_in_ms_; | 342 int duration_override_in_ms_; |
356 | 343 |
357 // The current shelf background. Should not be assigned to directly, use | 344 // The current shelf background. Should not be assigned to directly, use |
358 // MaybeUpdateShelfBackground() instead. | 345 // MaybeUpdateShelfBackground() instead. |
359 ShelfBackgroundType shelf_background_type_; | 346 ShelfBackgroundType shelf_background_type_; |
360 | 347 |
361 DISALLOW_COPY_AND_ASSIGN(ShelfLayoutManager); | 348 DISALLOW_COPY_AND_ASSIGN(ShelfLayoutManager); |
362 }; | 349 }; |
363 | 350 |
364 } // namespace ash | 351 } // namespace ash |
365 | 352 |
366 #endif // ASH_COMMON_SHELF_SHELF_LAYOUT_MANAGER_H_ | 353 #endif // ASH_COMMON_SHELF_SHELF_LAYOUT_MANAGER_H_ |
OLD | NEW |