| 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 <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "ash/ash_export.h" | 10 #include "ash/ash_export.h" |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 75 static const int kWorkspaceAreaAutoHideInset; | 75 static const int kWorkspaceAreaAutoHideInset; |
| 76 | 76 |
| 77 // Size of the shelf when auto-hidden. | 77 // Size of the shelf when auto-hidden. |
| 78 static const int kAutoHideSize; | 78 static const int kAutoHideSize; |
| 79 | 79 |
| 80 // Inset between the inner edge of the shelf (towards centre of screen), and | 80 // Inset between the inner edge of the shelf (towards centre of screen), and |
| 81 // the shelf items, notifications, status area etc. | 81 // the shelf items, notifications, status area etc. |
| 82 static const int kShelfItemInset; | 82 static const int kShelfItemInset; |
| 83 | 83 |
| 84 explicit ShelfLayoutManager(ShelfWidget* shelf); | 84 explicit ShelfLayoutManager(ShelfWidget* shelf); |
| 85 virtual ~ShelfLayoutManager(); | 85 ~ShelfLayoutManager() override; |
| 86 | 86 |
| 87 // Sets the ShelfAutoHideBehavior. See enum description for details. | 87 // Sets the ShelfAutoHideBehavior. See enum description for details. |
| 88 void SetAutoHideBehavior(ShelfAutoHideBehavior behavior); | 88 void SetAutoHideBehavior(ShelfAutoHideBehavior behavior); |
| 89 ShelfAutoHideBehavior auto_hide_behavior() const { | 89 ShelfAutoHideBehavior auto_hide_behavior() const { |
| 90 return auto_hide_behavior_; | 90 return auto_hide_behavior_; |
| 91 } | 91 } |
| 92 | 92 |
| 93 // Sets the alignment. Returns true if the alignment is changed. Otherwise, | 93 // Sets the alignment. Returns true if the alignment is changed. Otherwise, |
| 94 // returns false. | 94 // returns false. |
| 95 bool SetAlignment(ShelfAlignment alignment); | 95 bool SetAlignment(ShelfAlignment alignment); |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 158 // this point on. | 158 // this point on. |
| 159 DragState UpdateGestureDrag(const ui::GestureEvent& gesture); | 159 DragState UpdateGestureDrag(const ui::GestureEvent& gesture); |
| 160 void CompleteGestureDrag(const ui::GestureEvent& gesture); | 160 void CompleteGestureDrag(const ui::GestureEvent& gesture); |
| 161 void CancelGestureDrag(); | 161 void CancelGestureDrag(); |
| 162 | 162 |
| 163 // Set an animation duration override for the show / hide animation of the | 163 // Set an animation duration override for the show / hide animation of the |
| 164 // shelf. Specifying 0 leads to use the default. | 164 // shelf. Specifying 0 leads to use the default. |
| 165 void SetAnimationDurationOverride(int duration_override_in_ms); | 165 void SetAnimationDurationOverride(int duration_override_in_ms); |
| 166 | 166 |
| 167 // Overridden from SnapLayoutManager: | 167 // Overridden from SnapLayoutManager: |
| 168 virtual void OnWindowResized() override; | 168 void OnWindowResized() override; |
| 169 virtual void SetChildBounds(aura::Window* child, | 169 void SetChildBounds(aura::Window* child, |
| 170 const gfx::Rect& requested_bounds) override; | 170 const gfx::Rect& requested_bounds) override; |
| 171 | 171 |
| 172 // Overridden from ash::ShellObserver: | 172 // Overridden from ash::ShellObserver: |
| 173 virtual void OnLockStateChanged(bool locked) override; | 173 void OnLockStateChanged(bool locked) override; |
| 174 | 174 |
| 175 // Overriden from aura::client::ActivationChangeObserver: | 175 // Overriden from aura::client::ActivationChangeObserver: |
| 176 virtual void OnWindowActivated(aura::Window* gained_active, | 176 void OnWindowActivated(aura::Window* gained_active, |
| 177 aura::Window* lost_active) override; | 177 aura::Window* lost_active) override; |
| 178 | 178 |
| 179 // Overridden from ash::LockStateObserver: | 179 // Overridden from ash::LockStateObserver: |
| 180 virtual void OnLockStateEvent(LockStateObserver::EventType event) override; | 180 void OnLockStateEvent(LockStateObserver::EventType event) override; |
| 181 | 181 |
| 182 // Overridden from ash::SessionStateObserver: | 182 // Overridden from ash::SessionStateObserver: |
| 183 virtual void SessionStateChanged( | 183 void SessionStateChanged(SessionStateDelegate::SessionState state) override; |
| 184 SessionStateDelegate::SessionState state) override; | |
| 185 | 184 |
| 186 // TODO(harrym|oshima): These templates will be moved to | 185 // TODO(harrym|oshima): These templates will be moved to |
| 187 // new Shelf class. | 186 // new Shelf class. |
| 188 // A helper function that provides a shortcut for choosing | 187 // A helper function that provides a shortcut for choosing |
| 189 // values specific to a shelf alignment. | 188 // values specific to a shelf alignment. |
| 190 template<typename T> | 189 template<typename T> |
| 191 T SelectValueForShelfAlignment(T bottom, T left, T right, T top) const { | 190 T SelectValueForShelfAlignment(T bottom, T left, T right, T top) const { |
| 192 switch (GetAlignment()) { | 191 switch (GetAlignment()) { |
| 193 case SHELF_ALIGNMENT_BOTTOM: | 192 case SHELF_ALIGNMENT_BOTTOM: |
| 194 return bottom; | 193 return bottom; |
| (...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 310 // tray. | 309 // tray. |
| 311 ShelfAutoHideState CalculateAutoHideState( | 310 ShelfAutoHideState CalculateAutoHideState( |
| 312 ShelfVisibilityState visibility_state) const; | 311 ShelfVisibilityState visibility_state) const; |
| 313 | 312 |
| 314 // Returns true if |window| is a descendant of the shelf. | 313 // Returns true if |window| is a descendant of the shelf. |
| 315 bool IsShelfWindow(aura::Window* window); | 314 bool IsShelfWindow(aura::Window* window); |
| 316 | 315 |
| 317 int GetWorkAreaSize(const State& state, int size) const; | 316 int GetWorkAreaSize(const State& state, int size) const; |
| 318 | 317 |
| 319 // Overridden from keyboard::KeyboardControllerObserver: | 318 // Overridden from keyboard::KeyboardControllerObserver: |
| 320 virtual void OnKeyboardBoundsChanging(const gfx::Rect& new_bounds) override; | 319 void OnKeyboardBoundsChanging(const gfx::Rect& new_bounds) override; |
| 321 | 320 |
| 322 // Overridden from DockedWindowLayoutManagerObserver: | 321 // Overridden from DockedWindowLayoutManagerObserver: |
| 323 virtual void OnDockBoundsChanging( | 322 void OnDockBoundsChanging( |
| 324 const gfx::Rect& dock_bounds, | 323 const gfx::Rect& dock_bounds, |
| 325 DockedWindowLayoutManagerObserver::Reason reason) override; | 324 DockedWindowLayoutManagerObserver::Reason reason) override; |
| 326 | 325 |
| 327 // The RootWindow is cached so that we don't invoke Shell::GetInstance() from | 326 // The RootWindow is cached so that we don't invoke Shell::GetInstance() from |
| 328 // our destructor. We avoid that as at the time we're deleted Shell is being | 327 // our destructor. We avoid that as at the time we're deleted Shell is being |
| 329 // deleted too. | 328 // deleted too. |
| 330 aura::Window* root_window_; | 329 aura::Window* root_window_; |
| 331 | 330 |
| 332 // True when inside UpdateBoundsAndOpacity() method. Used to prevent calling | 331 // True when inside UpdateBoundsAndOpacity() method. Used to prevent calling |
| 333 // UpdateBoundsAndOpacity() again from SetChildBounds(). | 332 // UpdateBoundsAndOpacity() again from SetChildBounds(). |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 394 | 393 |
| 395 // The show hide animation duration override or 0 for default. | 394 // The show hide animation duration override or 0 for default. |
| 396 int duration_override_in_ms_; | 395 int duration_override_in_ms_; |
| 397 | 396 |
| 398 DISALLOW_COPY_AND_ASSIGN(ShelfLayoutManager); | 397 DISALLOW_COPY_AND_ASSIGN(ShelfLayoutManager); |
| 399 }; | 398 }; |
| 400 | 399 |
| 401 } // namespace ash | 400 } // namespace ash |
| 402 | 401 |
| 403 #endif // ASH_SHELF_SHELF_LAYOUT_MANAGER_H_ | 402 #endif // ASH_SHELF_SHELF_LAYOUT_MANAGER_H_ |
| OLD | NEW |