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 #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 "ash/ash_export.h" | 8 #include "ash/ash_export.h" |
9 #include "ash/launcher/launcher.h" | 9 #include "ash/launcher/launcher.h" |
10 #include "ash/shelf/background_animator.h" | 10 #include "ash/shelf/background_animator.h" |
11 #include "ash/shelf/shelf_types.h" | 11 #include "ash/shelf/shelf_types.h" |
12 #include "ash/shell_observer.h" | 12 #include "ash/shell_observer.h" |
13 #include "ash/system/status_area_widget.h" | 13 #include "ash/system/status_area_widget.h" |
14 #include "base/basictypes.h" | 14 #include "base/basictypes.h" |
15 #include "base/compiler_specific.h" | 15 #include "base/compiler_specific.h" |
16 #include "base/logging.h" | 16 #include "base/logging.h" |
17 #include "base/observer_list.h" | 17 #include "base/observer_list.h" |
18 #include "base/timer.h" | 18 #include "base/timer.h" |
19 #include "ui/aura/client/activation_change_observer.h" | 19 #include "ui/aura/client/activation_change_observer.h" |
20 #include "ui/aura/layout_manager.h" | 20 #include "ui/aura/layout_manager.h" |
21 #include "ui/gfx/insets.h" | 21 #include "ui/gfx/insets.h" |
22 #include "ui/gfx/rect.h" | 22 #include "ui/gfx/rect.h" |
| 23 #include "ui/keyboard/keyboard_controller.h" |
23 | 24 |
24 namespace aura { | 25 namespace aura { |
25 class RootWindow; | 26 class RootWindow; |
26 } | 27 } |
27 | 28 |
28 namespace ui { | 29 namespace ui { |
29 class GestureEvent; | 30 class GestureEvent; |
30 } | 31 } |
31 | 32 |
32 namespace ash { | 33 namespace ash { |
33 class ScreenAsh; | 34 class ScreenAsh; |
34 class ShelfWidget; | 35 class ShelfWidget; |
35 namespace internal { | 36 namespace internal { |
36 | 37 |
37 class ShelfLayoutManagerTest; | 38 class ShelfLayoutManagerTest; |
38 class StatusAreaWidget; | 39 class StatusAreaWidget; |
39 class WorkspaceController; | 40 class WorkspaceController; |
40 | 41 |
41 // ShelfLayoutManager is the layout manager responsible for the launcher and | 42 // ShelfLayoutManager is the layout manager responsible for the launcher and |
42 // status widgets. The launcher is given the total available width and told the | 43 // status widgets. The launcher is given the total available width and told the |
43 // width of the status area. This allows the launcher to draw the background and | 44 // width of the status area. This allows the launcher to draw the background and |
44 // layout to the status area. | 45 // layout to the status area. |
45 // To respond to bounds changes in the status area StatusAreaLayoutManager works | 46 // To respond to bounds changes in the status area StatusAreaLayoutManager works |
46 // closely with ShelfLayoutManager. | 47 // closely with ShelfLayoutManager. |
47 class ASH_EXPORT ShelfLayoutManager : | 48 class ASH_EXPORT ShelfLayoutManager : |
48 public aura::LayoutManager, | 49 public aura::LayoutManager, |
49 public ash::ShellObserver, | 50 public ash::ShellObserver, |
50 public aura::client::ActivationChangeObserver { | 51 public aura::client::ActivationChangeObserver, |
| 52 public keyboard::KeyboardController::Observer { |
51 public: | 53 public: |
52 | 54 |
53 // TODO(rharrison): Move this observer out of ash::internal:: | 55 // TODO(rharrison): Move this observer out of ash::internal:: |
54 // namespace. Tracked in crosbug.com/223936 | 56 // namespace. Tracked in crosbug.com/223936 |
55 class ASH_EXPORT Observer { | 57 class ASH_EXPORT Observer { |
56 public: | 58 public: |
57 // Called when the target ShelfLayoutManager will be deleted. | 59 // Called when the target ShelfLayoutManager will be deleted. |
58 virtual void WillDeleteShelf() {} | 60 virtual void WillDeleteShelf() {} |
59 | 61 |
60 // Called when the visibility change is scheduled. | 62 // Called when the visibility change is scheduled. |
(...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
270 ShelfVisibilityState visibility_state) const; | 272 ShelfVisibilityState visibility_state) const; |
271 | 273 |
272 // Updates the hit test bounds override for launcher and status area. | 274 // Updates the hit test bounds override for launcher and status area. |
273 void UpdateHitTestBounds(); | 275 void UpdateHitTestBounds(); |
274 | 276 |
275 // Returns true if |window| is a descendant of the shelf. | 277 // Returns true if |window| is a descendant of the shelf. |
276 bool IsShelfWindow(aura::Window* window); | 278 bool IsShelfWindow(aura::Window* window); |
277 | 279 |
278 int GetWorkAreaSize(const State& state, int size) const; | 280 int GetWorkAreaSize(const State& state, int size) const; |
279 | 281 |
| 282 gfx::Rect GetAvailableBounds() const; |
| 283 |
| 284 // Overridden from keyboard::KeyboardController::Observer: |
| 285 virtual void OnKeyboardBoundsChanged( |
| 286 const gfx::Rect& keyboard_bounds) OVERRIDE; |
| 287 |
280 // The RootWindow is cached so that we don't invoke Shell::GetInstance() from | 288 // The RootWindow is cached so that we don't invoke Shell::GetInstance() from |
281 // our destructor. We avoid that as at the time we're deleted Shell is being | 289 // our destructor. We avoid that as at the time we're deleted Shell is being |
282 // deleted too. | 290 // deleted too. |
283 aura::RootWindow* root_window_; | 291 aura::RootWindow* root_window_; |
284 | 292 |
285 // True when inside LayoutShelf method. Used to prevent calling LayoutShelf | 293 // True when inside LayoutShelf method. Used to prevent calling LayoutShelf |
286 // again from SetChildBounds(). | 294 // again from SetChildBounds(). |
287 bool in_layout_; | 295 bool in_layout_; |
288 | 296 |
289 // See description above setter. | 297 // See description above setter. |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
323 // Tracks the amount of the drag. The value is only valid when | 331 // Tracks the amount of the drag. The value is only valid when |
324 // |gesture_drag_status_| is set to GESTURE_DRAG_IN_PROGRESS. | 332 // |gesture_drag_status_| is set to GESTURE_DRAG_IN_PROGRESS. |
325 float gesture_drag_amount_; | 333 float gesture_drag_amount_; |
326 | 334 |
327 // Manage the auto-hide state during the gesture. | 335 // Manage the auto-hide state during the gesture. |
328 ShelfAutoHideState gesture_drag_auto_hide_state_; | 336 ShelfAutoHideState gesture_drag_auto_hide_state_; |
329 | 337 |
330 // Used to delay updating shelf background. | 338 // Used to delay updating shelf background. |
331 UpdateShelfObserver* update_shelf_observer_; | 339 UpdateShelfObserver* update_shelf_observer_; |
332 | 340 |
| 341 // The bounds of the keyboard. |
| 342 gfx::Rect keyboard_bounds_; |
| 343 |
333 DISALLOW_COPY_AND_ASSIGN(ShelfLayoutManager); | 344 DISALLOW_COPY_AND_ASSIGN(ShelfLayoutManager); |
334 }; | 345 }; |
335 | 346 |
336 } // namespace internal | 347 } // namespace internal |
337 } // namespace ash | 348 } // namespace ash |
338 | 349 |
339 #endif // ASH_SHELF_SHELF_LAYOUT_MANAGER_H_ | 350 #endif // ASH_SHELF_SHELF_LAYOUT_MANAGER_H_ |
OLD | NEW |