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