OLD | NEW |
(Empty) | |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #include "ash/common/shelf/wm_shelf.h" |
| 6 |
| 7 #include "base/logging.h" |
| 8 |
| 9 namespace ash { |
| 10 |
| 11 bool WmShelf::IsHorizontalAlignment() const { |
| 12 switch (GetAlignment()) { |
| 13 case SHELF_ALIGNMENT_BOTTOM: |
| 14 case SHELF_ALIGNMENT_BOTTOM_LOCKED: |
| 15 return true; |
| 16 case SHELF_ALIGNMENT_LEFT: |
| 17 case SHELF_ALIGNMENT_RIGHT: |
| 18 return false; |
| 19 } |
| 20 NOTREACHED(); |
| 21 return true; |
| 22 } |
| 23 |
| 24 int WmShelf::SelectValueForShelfAlignment(int bottom, |
| 25 int left, |
| 26 int right) const { |
| 27 switch (GetAlignment()) { |
| 28 case SHELF_ALIGNMENT_BOTTOM: |
| 29 case SHELF_ALIGNMENT_BOTTOM_LOCKED: |
| 30 return bottom; |
| 31 case SHELF_ALIGNMENT_LEFT: |
| 32 return left; |
| 33 case SHELF_ALIGNMENT_RIGHT: |
| 34 return right; |
| 35 } |
| 36 NOTREACHED(); |
| 37 return bottom; |
| 38 } |
| 39 |
| 40 int WmShelf::PrimaryAxisValue(int horizontal, int vertical) const { |
| 41 return IsHorizontalAlignment() ? horizontal : vertical; |
| 42 } |
| 43 |
| 44 } // namespace ash |
OLD | NEW |