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

Side by Side Diff: ash/public/interfaces/wallpaper_enum_traits.h

Issue 2642973006: Include AIDL files in the presubmit check for IPC security. (Closed)
Patch Set: Move `using` statements. Created 3 years, 11 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 unified diff | Download patch
OLDNEW
(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 #ifndef ASH_PUBLIC_INTERFACES_WALLPAPER_ENUM_TRAITS_H_
6 #define ASH_PUBLIC_INTERFACES_WALLPAPER_ENUM_TRAITS_H_
7
8 #include "ash/public/interfaces/wallpaper.mojom.h"
9 #include "components/wallpaper/wallpaper_layout.h"
10
11 namespace mojo {
12
13 template <>
14 struct EnumTraits<ash::mojom::WallpaperLayout, wallpaper::WallpaperLayout> {
15 static ash::mojom::WallpaperLayout ToMojom(wallpaper::WallpaperLayout input) {
16 switch (input) {
17 case wallpaper::WALLPAPER_LAYOUT_CENTER:
18 return ash::mojom::WallpaperLayout::CENTER;
19 case wallpaper::WALLPAPER_LAYOUT_CENTER_CROPPED:
20 return ash::mojom::WallpaperLayout::CENTER_CROPPED;
21 case wallpaper::WALLPAPER_LAYOUT_STRETCH:
22 return ash::mojom::WallpaperLayout::STRETCH;
23 case wallpaper::WALLPAPER_LAYOUT_TILE:
24 return ash::mojom::WallpaperLayout::TILE;
25 case wallpaper::NUM_WALLPAPER_LAYOUT:
26 break;
27 }
28 NOTREACHED();
29 return ash::mojom::WallpaperLayout::CENTER;
30 }
31
32 static bool FromMojom(ash::mojom::WallpaperLayout input,
33 wallpaper::WallpaperLayout* out) {
34 switch (input) {
35 case ash::mojom::WallpaperLayout::CENTER:
36 *out = wallpaper::WALLPAPER_LAYOUT_CENTER;
37 return true;
38 case ash::mojom::WallpaperLayout::CENTER_CROPPED:
39 *out = wallpaper::WALLPAPER_LAYOUT_CENTER_CROPPED;
40 return true;
41 case ash::mojom::WallpaperLayout::STRETCH:
42 *out = wallpaper::WALLPAPER_LAYOUT_STRETCH;
43 return true;
44 case ash::mojom::WallpaperLayout::TILE:
45 *out = wallpaper::WALLPAPER_LAYOUT_TILE;
46 return true;
47 }
48 NOTREACHED();
49 return false;
50 }
51 };
52
53 } // namespace mojo
54
55 #endif // ASH_PUBLIC_INTERFACES_WALLPAPER_ENUM_TRAITS_H_
OLDNEW
« no previous file with comments | « ash/public/interfaces/wallpaper.typemap ('k') | ash/public/interfaces/wallpaper_struct_traits.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698