| 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 173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 184 shelf_->shelf()->SetAlignment(alignment); | 184 shelf_->shelf()->SetAlignment(alignment); |
| 185 } | 185 } |
| 186 ShelfAlignment GetAlignment() const { return shelf_->GetAlignment(); } | 186 ShelfAlignment GetAlignment() const { return shelf_->GetAlignment(); } |
| 187 | 187 |
| 188 // TODO(harrym|oshima): These templates will be moved to a new Shelf class. | 188 // TODO(harrym|oshima): These templates will be moved to a new Shelf class. |
| 189 // A helper function for choosing values specific to a shelf alignment. | 189 // A helper function for choosing values specific to a shelf alignment. |
| 190 template <typename T> | 190 template <typename T> |
| 191 T SelectValueForShelfAlignment(T bottom, T left, T right) const { | 191 T SelectValueForShelfAlignment(T bottom, T left, T right) const { |
| 192 switch (GetAlignment()) { | 192 switch (GetAlignment()) { |
| 193 case SHELF_ALIGNMENT_BOTTOM: | 193 case SHELF_ALIGNMENT_BOTTOM: |
| 194 case SHELF_ALIGNMENT_BOTTOM_LOCKED: |
| 194 return bottom; | 195 return bottom; |
| 195 case SHELF_ALIGNMENT_LEFT: | 196 case SHELF_ALIGNMENT_LEFT: |
| 196 return left; | 197 return left; |
| 197 case SHELF_ALIGNMENT_RIGHT: | 198 case SHELF_ALIGNMENT_RIGHT: |
| 198 return right; | 199 return right; |
| 199 } | 200 } |
| 200 NOTREACHED(); | 201 NOTREACHED(); |
| 201 return right; | 202 return right; |
| 202 } | 203 } |
| 203 | 204 |
| 204 template<typename T> | 205 template<typename T> |
| 205 T PrimaryAxisValue(T horizontal, T vertical) const { | 206 T PrimaryAxisValue(T horizontal, T vertical) const { |
| 206 return IsHorizontalAlignment() ? horizontal : vertical; | 207 return IsHorizontalAlignment() ? horizontal : vertical; |
| 207 } | 208 } |
| 208 | 209 |
| 209 // Is the shelf's alignment horizontal? | 210 // Is the shelf's alignment horizontal? |
| 210 bool IsHorizontalAlignment() const; | 211 bool IsHorizontalAlignment() const; |
| 211 | 212 |
| 212 // Returns true when the alignment is locked. This can be caused by the screen | |
| 213 // being locked, or when adding a user. Returns false when transitioning to a | |
| 214 // user session, and while the session is active. | |
| 215 bool IsAlignmentLocked() const; | |
| 216 | |
| 217 // Set the height of the ChromeVox panel, which takes away space from the | 213 // Set the height of the ChromeVox panel, which takes away space from the |
| 218 // available work area from the top of the screen. | 214 // available work area from the top of the screen. |
| 219 void SetChromeVoxPanelHeight(int height); | 215 void SetChromeVoxPanelHeight(int height); |
| 220 | 216 |
| 221 private: | 217 private: |
| 222 class AutoHideEventFilter; | 218 class AutoHideEventFilter; |
| 223 class UpdateShelfObserver; | 219 class UpdateShelfObserver; |
| 224 friend class AshPopupAlignmentDelegateTest; | 220 friend class AshPopupAlignmentDelegateTest; |
| 225 friend class ash::ScreenAsh; | 221 friend class ash::ScreenAsh; |
| 226 friend class PanelLayoutManagerTest; | 222 friend class PanelLayoutManagerTest; |
| (...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 400 | 396 |
| 401 // The show hide animation duration override or 0 for default. | 397 // The show hide animation duration override or 0 for default. |
| 402 int duration_override_in_ms_; | 398 int duration_override_in_ms_; |
| 403 | 399 |
| 404 DISALLOW_COPY_AND_ASSIGN(ShelfLayoutManager); | 400 DISALLOW_COPY_AND_ASSIGN(ShelfLayoutManager); |
| 405 }; | 401 }; |
| 406 | 402 |
| 407 } // namespace ash | 403 } // namespace ash |
| 408 | 404 |
| 409 #endif // ASH_SHELF_SHELF_LAYOUT_MANAGER_H_ | 405 #endif // ASH_SHELF_SHELF_LAYOUT_MANAGER_H_ |
| OLD | NEW |