| 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 "ash/wm/dock/dock_observer.h" |
| 14 #include "base/basictypes.h" | 15 #include "base/basictypes.h" |
| 15 #include "base/compiler_specific.h" | 16 #include "base/compiler_specific.h" |
| 16 #include "base/logging.h" | 17 #include "base/logging.h" |
| 17 #include "base/observer_list.h" | 18 #include "base/observer_list.h" |
| 18 #include "base/timer.h" | 19 #include "base/timer.h" |
| 19 #include "ui/aura/client/activation_change_observer.h" | 20 #include "ui/aura/client/activation_change_observer.h" |
| 20 #include "ui/aura/layout_manager.h" | 21 #include "ui/aura/layout_manager.h" |
| 21 #include "ui/gfx/insets.h" | 22 #include "ui/gfx/insets.h" |
| 22 #include "ui/gfx/rect.h" | 23 #include "ui/gfx/rect.h" |
| 23 #include "ui/keyboard/keyboard_controller.h" | 24 #include "ui/keyboard/keyboard_controller.h" |
| (...skipping 21 matching lines...) Expand all Loading... |
| 45 // ShelfLayoutManager is the layout manager responsible for the launcher and | 46 // ShelfLayoutManager is the layout manager responsible for the launcher and |
| 46 // status widgets. The launcher is given the total available width and told the | 47 // status widgets. The launcher is given the total available width and told the |
| 47 // width of the status area. This allows the launcher to draw the background and | 48 // width of the status area. This allows the launcher to draw the background and |
| 48 // layout to the status area. | 49 // layout to the status area. |
| 49 // To respond to bounds changes in the status area StatusAreaLayoutManager works | 50 // To respond to bounds changes in the status area StatusAreaLayoutManager works |
| 50 // closely with ShelfLayoutManager. | 51 // closely with ShelfLayoutManager. |
| 51 class ASH_EXPORT ShelfLayoutManager : | 52 class ASH_EXPORT ShelfLayoutManager : |
| 52 public aura::LayoutManager, | 53 public aura::LayoutManager, |
| 53 public ash::ShellObserver, | 54 public ash::ShellObserver, |
| 54 public aura::client::ActivationChangeObserver, | 55 public aura::client::ActivationChangeObserver, |
| 56 public DockObserver, |
| 55 public keyboard::KeyboardControllerObserver { | 57 public keyboard::KeyboardControllerObserver { |
| 56 public: | 58 public: |
| 57 | 59 |
| 58 // We reserve a small area on the edge of the workspace area to ensure that | 60 // We reserve a small area on the edge of the workspace area to ensure that |
| 59 // the resize handle at the edge of the window can be hit. | 61 // the resize handle at the edge of the window can be hit. |
| 60 static const int kWorkspaceAreaVisibleInset; | 62 static const int kWorkspaceAreaVisibleInset; |
| 61 | 63 |
| 62 // When autohidden we extend the touch hit target onto the screen so that the | 64 // When autohidden we extend the touch hit target onto the screen so that the |
| 63 // user can drag the shelf out. | 65 // user can drag the shelf out. |
| 64 static const int kWorkspaceAreaAutoHideInset; | 66 static const int kWorkspaceAreaAutoHideInset; |
| (...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 274 int GetWorkAreaSize(const State& state, int size) const; | 276 int GetWorkAreaSize(const State& state, int size) const; |
| 275 | 277 |
| 276 // Return the bounds available in the parent, taking into account the bounds | 278 // Return the bounds available in the parent, taking into account the bounds |
| 277 // of the keyboard if necessary. | 279 // of the keyboard if necessary. |
| 278 gfx::Rect GetAvailableBounds() const; | 280 gfx::Rect GetAvailableBounds() const; |
| 279 | 281 |
| 280 // Overridden from keyboard::KeyboardControllerObserver: | 282 // Overridden from keyboard::KeyboardControllerObserver: |
| 281 virtual void OnKeyboardBoundsChanging( | 283 virtual void OnKeyboardBoundsChanging( |
| 282 const gfx::Rect& keyboard_bounds) OVERRIDE; | 284 const gfx::Rect& keyboard_bounds) OVERRIDE; |
| 283 | 285 |
| 286 // Overridden from dock::DockObserver: |
| 287 virtual void OnDockBoundsChanging(const gfx::Rect& dock_bounds) OVERRIDE; |
| 288 |
| 284 // Generates insets for inward edge based on the current shelf alignment. | 289 // Generates insets for inward edge based on the current shelf alignment. |
| 285 gfx::Insets GetInsetsForAlignment(int distance) const; | 290 gfx::Insets GetInsetsForAlignment(int distance) const; |
| 286 | 291 |
| 287 // 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 |
| 288 // 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 |
| 289 // deleted too. | 294 // deleted too. |
| 290 aura::RootWindow* root_window_; | 295 aura::RootWindow* root_window_; |
| 291 | 296 |
| 292 // True when inside LayoutShelf method. Used to prevent calling LayoutShelf | 297 // True when inside LayoutShelf method. Used to prevent calling LayoutShelf |
| 293 // again from SetChildBounds(). | 298 // again from SetChildBounds(). |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 333 | 338 |
| 334 // Manage the auto-hide state during the gesture. | 339 // Manage the auto-hide state during the gesture. |
| 335 ShelfAutoHideState gesture_drag_auto_hide_state_; | 340 ShelfAutoHideState gesture_drag_auto_hide_state_; |
| 336 | 341 |
| 337 // Used to delay updating shelf background. | 342 // Used to delay updating shelf background. |
| 338 UpdateShelfObserver* update_shelf_observer_; | 343 UpdateShelfObserver* update_shelf_observer_; |
| 339 | 344 |
| 340 // The bounds of the keyboard. | 345 // The bounds of the keyboard. |
| 341 gfx::Rect keyboard_bounds_; | 346 gfx::Rect keyboard_bounds_; |
| 342 | 347 |
| 348 // The bounds of the dock. |
| 349 gfx::Rect dock_bounds_; |
| 350 |
| 343 DISALLOW_COPY_AND_ASSIGN(ShelfLayoutManager); | 351 DISALLOW_COPY_AND_ASSIGN(ShelfLayoutManager); |
| 344 }; | 352 }; |
| 345 | 353 |
| 346 } // namespace internal | 354 } // namespace internal |
| 347 } // namespace ash | 355 } // namespace ash |
| 348 | 356 |
| 349 #endif // ASH_SHELF_SHELF_LAYOUT_MANAGER_H_ | 357 #endif // ASH_SHELF_SHELF_LAYOUT_MANAGER_H_ |
| OLD | NEW |