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

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

Issue 2413503002: Cleanup mojo Wallpaper interfaces for mash. (Closed)
Patch Set: Sync and rebase again... Created 4 years, 2 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
Index: ash/public/interfaces/wallpaper_enum_traits.h
diff --git a/ash/public/interfaces/wallpaper_enum_traits.h b/ash/public/interfaces/wallpaper_enum_traits.h
new file mode 100644
index 0000000000000000000000000000000000000000..03c15b99fd47f4a4eb78e1cdb146c746150c65aa
--- /dev/null
+++ b/ash/public/interfaces/wallpaper_enum_traits.h
@@ -0,0 +1,55 @@
+// 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_WALLPAPER_ENUM_TRAITS_H_
+#define ASH_PUBLIC_INTERFACES_WALLPAPER_ENUM_TRAITS_H_
+
+#include "ash/public/interfaces/wallpaper.mojom.h"
+#include "components/wallpaper/wallpaper_layout.h"
+
+namespace mojo {
+
+template <>
+struct EnumTraits<ash::mojom::WallpaperLayout, wallpaper::WallpaperLayout> {
+ static ash::mojom::WallpaperLayout ToMojom(wallpaper::WallpaperLayout input) {
+ switch (input) {
+ case wallpaper::WALLPAPER_LAYOUT_CENTER:
+ return ash::mojom::WallpaperLayout::CENTER;
+ case wallpaper::WALLPAPER_LAYOUT_CENTER_CROPPED:
+ return ash::mojom::WallpaperLayout::CENTER_CROPPED;
+ case wallpaper::WALLPAPER_LAYOUT_STRETCH:
+ return ash::mojom::WallpaperLayout::STRETCH;
+ case wallpaper::WALLPAPER_LAYOUT_TILE:
+ return ash::mojom::WallpaperLayout::TILE;
+ case wallpaper::NUM_WALLPAPER_LAYOUT:
+ break;
+ }
+ NOTREACHED();
+ return ash::mojom::WallpaperLayout::CENTER;
+ }
+
+ static bool FromMojom(ash::mojom::WallpaperLayout input,
+ wallpaper::WallpaperLayout* out) {
+ switch (input) {
+ case ash::mojom::WallpaperLayout::CENTER:
+ *out = wallpaper::WALLPAPER_LAYOUT_CENTER;
+ return true;
+ case ash::mojom::WallpaperLayout::CENTER_CROPPED:
+ *out = wallpaper::WALLPAPER_LAYOUT_CENTER_CROPPED;
+ return true;
+ case ash::mojom::WallpaperLayout::STRETCH:
+ *out = wallpaper::WALLPAPER_LAYOUT_STRETCH;
+ return true;
+ case ash::mojom::WallpaperLayout::TILE:
+ *out = wallpaper::WALLPAPER_LAYOUT_TILE;
+ return true;
+ }
+ NOTREACHED();
+ return false;
+ }
+};
+
+} // namespace mojo
+
+#endif // ASH_PUBLIC_INTERFACES_WALLPAPER_ENUM_TRAITS_H_
« no previous file with comments | « ash/public/interfaces/wallpaper.typemap ('k') | chrome/browser/chrome_content_browser_manifest_overlay.json » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698