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