| OLD | NEW |
| 1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 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 <memory> | 8 #include <memory> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 77 // user can drag the shelf out. | 77 // user can drag the shelf out. |
| 78 static const int kWorkspaceAreaAutoHideInset; | 78 static const int kWorkspaceAreaAutoHideInset; |
| 79 | 79 |
| 80 // Size of the shelf when auto-hidden. | 80 // Size of the shelf when auto-hidden. |
| 81 static const int kAutoHideSize; | 81 static const int kAutoHideSize; |
| 82 | 82 |
| 83 // Inset between the inner edge of the shelf (towards centre of screen), and | 83 // Inset between the inner edge of the shelf (towards centre of screen), and |
| 84 // the shelf items, notifications, status area etc. | 84 // the shelf items, notifications, status area etc. |
| 85 static const int kShelfItemInset; | 85 static const int kShelfItemInset; |
| 86 | 86 |
| 87 explicit ShelfLayoutManager(ShelfWidget* shelf); | 87 explicit ShelfLayoutManager(ShelfWidget* shelf_widget); |
| 88 ~ShelfLayoutManager() override; | 88 ~ShelfLayoutManager() override; |
| 89 | 89 |
| 90 void set_workspace_controller(WorkspaceController* controller) { | 90 void set_workspace_controller(WorkspaceController* controller) { |
| 91 workspace_controller_ = controller; | 91 workspace_controller_ = controller; |
| 92 } | 92 } |
| 93 | 93 |
| 94 bool updating_bounds() const { return updating_bounds_; } | 94 bool updating_bounds() const { return updating_bounds_; } |
| 95 | 95 |
| 96 // Clears internal data for shutdown process. | 96 // Clears internal data for shutdown process. |
| 97 void PrepareForShutdown(); | 97 void PrepareForShutdown(); |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 132 // from an EventHandler. In mash these come from events that hit the shelf | 132 // from an EventHandler. In mash these come from events that hit the shelf |
| 133 // widget and status tray widget. | 133 // widget and status tray widget. |
| 134 void UpdateAutoHideForMouseEvent(ui::MouseEvent* event); | 134 void UpdateAutoHideForMouseEvent(ui::MouseEvent* event); |
| 135 void UpdateAutoHideForGestureEvent(ui::GestureEvent* event); | 135 void UpdateAutoHideForGestureEvent(ui::GestureEvent* event); |
| 136 | 136 |
| 137 ShelfVisibilityState visibility_state() const { | 137 ShelfVisibilityState visibility_state() const { |
| 138 return state_.visibility_state; | 138 return state_.visibility_state; |
| 139 } | 139 } |
| 140 ShelfAutoHideState auto_hide_state() const { return state_.auto_hide_state; } | 140 ShelfAutoHideState auto_hide_state() const { return state_.auto_hide_state; } |
| 141 | 141 |
| 142 ShelfWidget* shelf_widget() { return shelf_; } | 142 ShelfWidget* shelf_widget() { return shelf_widget_; } |
| 143 | 143 |
| 144 // Sets whether any windows overlap the shelf. If a window overlaps the shelf | 144 // Sets whether any windows overlap the shelf. If a window overlaps the shelf |
| 145 // the shelf renders slightly differently. | 145 // the shelf renders slightly differently. |
| 146 void SetWindowOverlapsShelf(bool value); | 146 void SetWindowOverlapsShelf(bool value); |
| 147 bool window_overlaps_shelf() const { return window_overlaps_shelf_; } | 147 bool window_overlaps_shelf() const { return window_overlaps_shelf_; } |
| 148 | 148 |
| 149 void AddObserver(ShelfLayoutManagerObserver* observer); | 149 void AddObserver(ShelfLayoutManagerObserver* observer); |
| 150 void RemoveObserver(ShelfLayoutManagerObserver* observer); | 150 void RemoveObserver(ShelfLayoutManagerObserver* observer); |
| 151 | 151 |
| 152 // Gesture related functions: | 152 // Gesture related functions: |
| (...skipping 23 matching lines...) Expand all Loading... |
| 176 aura::Window* gained_active, | 176 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 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 void SessionStateChanged(SessionStateDelegate::SessionState state) override; | 183 void SessionStateChanged(SessionStateDelegate::SessionState state) override; |
| 184 | 184 |
| 185 // TODO(msw): Remove these accessors, kept temporarily to simplify changes. | 185 // TODO(msw): Remove these accessors, kept temporarily to simplify changes. |
| 186 void SetAutoHideBehavior(ShelfAutoHideBehavior behavior) { | 186 wm::ShelfAlignment GetAlignment() const { |
| 187 shelf_->shelf()->SetAutoHideBehavior(behavior); | 187 return shelf_widget_->GetAlignment(); |
| 188 } | 188 } |
| 189 ShelfAutoHideBehavior auto_hide_behavior() const { | |
| 190 return shelf_->shelf()->auto_hide_behavior(); | |
| 191 } | |
| 192 | |
| 193 // TODO(msw): Remove these accessors, kept temporarily to simplify changes. | |
| 194 void SetAlignment(wm::ShelfAlignment alignment) { | |
| 195 shelf_->shelf()->SetAlignment(alignment); | |
| 196 } | |
| 197 wm::ShelfAlignment GetAlignment() const { return shelf_->GetAlignment(); } | |
| 198 | 189 |
| 199 // TODO(harrym|oshima): These templates will be moved to a new Shelf class. | 190 // TODO(harrym|oshima): These templates will be moved to a new Shelf class. |
| 200 // A helper function for choosing values specific to a shelf alignment. | 191 // A helper function for choosing values specific to a shelf alignment. |
| 201 template <typename T> | 192 template <typename T> |
| 202 T SelectValueForShelfAlignment(T bottom, T left, T right) const { | 193 T SelectValueForShelfAlignment(T bottom, T left, T right) const { |
| 203 switch (GetAlignment()) { | 194 switch (GetAlignment()) { |
| 204 case wm::SHELF_ALIGNMENT_BOTTOM: | 195 case wm::SHELF_ALIGNMENT_BOTTOM: |
| 205 case wm::SHELF_ALIGNMENT_BOTTOM_LOCKED: | 196 case wm::SHELF_ALIGNMENT_BOTTOM_LOCKED: |
| 206 return bottom; | 197 return bottom; |
| 207 case wm::SHELF_ALIGNMENT_LEFT: | 198 case wm::SHELF_ALIGNMENT_LEFT: |
| (...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 344 | 335 |
| 345 // True when inside UpdateBoundsAndOpacity() method. Used to prevent calling | 336 // True when inside UpdateBoundsAndOpacity() method. Used to prevent calling |
| 346 // UpdateBoundsAndOpacity() again from SetChildBounds(). | 337 // UpdateBoundsAndOpacity() again from SetChildBounds(). |
| 347 bool updating_bounds_; | 338 bool updating_bounds_; |
| 348 | 339 |
| 349 bool in_shutdown_ = false; | 340 bool in_shutdown_ = false; |
| 350 | 341 |
| 351 // Current state. | 342 // Current state. |
| 352 State state_; | 343 State state_; |
| 353 | 344 |
| 354 ShelfWidget* shelf_; | 345 ShelfWidget* shelf_widget_; |
| 355 | 346 |
| 356 WorkspaceController* workspace_controller_; | 347 WorkspaceController* workspace_controller_; |
| 357 | 348 |
| 358 // Do any windows overlap the shelf? This is maintained by WorkspaceManager. | 349 // Do any windows overlap the shelf? This is maintained by WorkspaceManager. |
| 359 bool window_overlaps_shelf_; | 350 bool window_overlaps_shelf_; |
| 360 | 351 |
| 361 base::OneShotTimer auto_hide_timer_; | 352 base::OneShotTimer auto_hide_timer_; |
| 362 | 353 |
| 363 // Whether the mouse was over the shelf when the auto hide timer started. | 354 // Whether the mouse was over the shelf when the auto hide timer started. |
| 364 // False when neither the auto hide timer nor the timer task are running. | 355 // False when neither the auto hide timer nor the timer task are running. |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 416 | 407 |
| 417 std::unique_ptr<RootWindowControllerObserverImpl> | 408 std::unique_ptr<RootWindowControllerObserverImpl> |
| 418 root_window_controller_observer_; | 409 root_window_controller_observer_; |
| 419 | 410 |
| 420 DISALLOW_COPY_AND_ASSIGN(ShelfLayoutManager); | 411 DISALLOW_COPY_AND_ASSIGN(ShelfLayoutManager); |
| 421 }; | 412 }; |
| 422 | 413 |
| 423 } // namespace ash | 414 } // namespace ash |
| 424 | 415 |
| 425 #endif // ASH_SHELF_SHELF_LAYOUT_MANAGER_H_ | 416 #endif // ASH_SHELF_SHELF_LAYOUT_MANAGER_H_ |
| OLD | NEW |