Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2401)

Unified Diff: ash/public/interfaces/shelf_enum_traits.h

Issue 2259153002: mash: Port ash_sysui ShelfDelegateMus impl to mojo:ash. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Sync and rebase. Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ash/public/interfaces/shelf.typemap ('k') | ash/public/interfaces/typemaps.gni » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ash/public/interfaces/shelf_enum_traits.h
diff --git a/ash/public/interfaces/shelf_enum_traits.h b/ash/public/interfaces/shelf_enum_traits.h
new file mode 100644
index 0000000000000000000000000000000000000000..4d5d1cd9b475f79055c8c8158f396c9404834bcc
--- /dev/null
+++ b/ash/public/interfaces/shelf_enum_traits.h
@@ -0,0 +1,88 @@
+// 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.
+
+#ifndef ASH_PUBLIC_INTERFACES_SHELF_ENUM_TRAITS_H_
+#define ASH_PUBLIC_INTERFACES_SHELF_ENUM_TRAITS_H_
+
+#include "ash/common/shelf/shelf_types.h"
+#include "ash/public/interfaces/shelf.mojom.h"
+
+namespace mojo {
+
+template <>
+struct EnumTraits<ash::mojom::ShelfAlignment, ash::ShelfAlignment> {
+ static ash::mojom::ShelfAlignment ToMojom(ash::ShelfAlignment input) {
+ switch (input) {
+ case ash::SHELF_ALIGNMENT_BOTTOM:
+ return ash::mojom::ShelfAlignment::BOTTOM;
+ case ash::SHELF_ALIGNMENT_LEFT:
+ return ash::mojom::ShelfAlignment::LEFT;
+ case ash::SHELF_ALIGNMENT_RIGHT:
+ return ash::mojom::ShelfAlignment::RIGHT;
+ case ash::SHELF_ALIGNMENT_BOTTOM_LOCKED:
+ return ash::mojom::ShelfAlignment::BOTTOM_LOCKED;
+ }
+ NOTREACHED();
+ return ash::mojom::ShelfAlignment::BOTTOM;
+ }
+
+ static bool FromMojom(ash::mojom::ShelfAlignment input,
+ ash::ShelfAlignment* out) {
+ switch (input) {
+ case ash::mojom::ShelfAlignment::BOTTOM:
+ *out = ash::SHELF_ALIGNMENT_BOTTOM;
+ return true;
+ case ash::mojom::ShelfAlignment::LEFT:
+ *out = ash::SHELF_ALIGNMENT_LEFT;
+ return true;
+ case ash::mojom::ShelfAlignment::RIGHT:
+ *out = ash::SHELF_ALIGNMENT_RIGHT;
+ return true;
+ case ash::mojom::ShelfAlignment::BOTTOM_LOCKED:
+ *out = ash::SHELF_ALIGNMENT_BOTTOM_LOCKED;
+ return true;
+ }
+ NOTREACHED();
+ return false;
+ }
+};
+
+template <>
+struct EnumTraits<ash::mojom::ShelfAutoHideBehavior,
+ ash::ShelfAutoHideBehavior> {
+ static ash::mojom::ShelfAutoHideBehavior ToMojom(
+ ash::ShelfAutoHideBehavior input) {
+ switch (input) {
+ case ash::SHELF_AUTO_HIDE_BEHAVIOR_ALWAYS:
+ return ash::mojom::ShelfAutoHideBehavior::ALWAYS;
+ case ash::SHELF_AUTO_HIDE_BEHAVIOR_NEVER:
+ return ash::mojom::ShelfAutoHideBehavior::NEVER;
+ case ash::SHELF_AUTO_HIDE_ALWAYS_HIDDEN:
+ return ash::mojom::ShelfAutoHideBehavior::HIDDEN;
+ }
+ NOTREACHED();
+ return ash::mojom::ShelfAutoHideBehavior::NEVER;
+ }
+
+ static bool FromMojom(ash::mojom::ShelfAutoHideBehavior input,
+ ash::ShelfAutoHideBehavior* out) {
+ switch (input) {
+ case ash::mojom::ShelfAutoHideBehavior::ALWAYS:
+ *out = ash::SHELF_AUTO_HIDE_BEHAVIOR_ALWAYS;
+ return true;
+ case ash::mojom::ShelfAutoHideBehavior::NEVER:
+ *out = ash::SHELF_AUTO_HIDE_BEHAVIOR_NEVER;
+ return true;
+ case ash::mojom::ShelfAutoHideBehavior::HIDDEN:
+ *out = ash::SHELF_AUTO_HIDE_ALWAYS_HIDDEN;
+ return true;
+ }
+ NOTREACHED();
+ return false;
+ }
+};
+
+} // namespace mojo
+
+#endif // ASH_PUBLIC_INTERFACES_SHELF_ENUM_TRAITS_H_
« no previous file with comments | « ash/public/interfaces/shelf.typemap ('k') | ash/public/interfaces/typemaps.gni » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698