Index: ash/common/shelf/wm_shelf.cc |
diff --git a/ash/common/shelf/wm_shelf.cc b/ash/common/shelf/wm_shelf.cc |
new file mode 100644 |
index 0000000000000000000000000000000000000000..646ebed36025f0bcefa8beb4ad2545123599b969 |
--- /dev/null |
+++ b/ash/common/shelf/wm_shelf.cc |
@@ -0,0 +1,44 @@ |
+// Copyright 2016 The Chromium Authors. All rights reserved. |
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+#include "ash/common/shelf/wm_shelf.h" |
+ |
+#include "base/logging.h" |
+ |
+namespace ash { |
+ |
+bool WmShelf::IsHorizontalAlignment() const { |
+ switch (GetAlignment()) { |
+ case SHELF_ALIGNMENT_BOTTOM: |
+ case SHELF_ALIGNMENT_BOTTOM_LOCKED: |
+ return true; |
+ case SHELF_ALIGNMENT_LEFT: |
+ case SHELF_ALIGNMENT_RIGHT: |
+ return false; |
+ } |
+ NOTREACHED(); |
+ return true; |
+} |
+ |
+int WmShelf::SelectValueForShelfAlignment(int bottom, |
+ int left, |
+ int right) const { |
+ switch (GetAlignment()) { |
+ case SHELF_ALIGNMENT_BOTTOM: |
+ case SHELF_ALIGNMENT_BOTTOM_LOCKED: |
+ return bottom; |
+ case SHELF_ALIGNMENT_LEFT: |
+ return left; |
+ case SHELF_ALIGNMENT_RIGHT: |
+ return right; |
+ } |
+ NOTREACHED(); |
+ return bottom; |
+} |
+ |
+int WmShelf::PrimaryAxisValue(int horizontal, int vertical) const { |
+ return IsHorizontalAlignment() ? horizontal : vertical; |
+} |
+ |
+} // namespace ash |