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

Side by Side Diff: ash/public/interfaces/shelf_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
« no previous file with comments | « ash/public/interfaces/shelf.typemap ('k') | ash/public/interfaces/shelf_struct_traits.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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_SHELF_ENUM_TRAITS_H_
6 #define ASH_PUBLIC_INTERFACES_SHELF_ENUM_TRAITS_H_
7
8 #include "ash/public/cpp/shelf_types.h"
9 #include "ash/public/interfaces/shelf.mojom.h"
10
11 namespace mojo {
12
13 template <>
14 struct EnumTraits<ash::mojom::ShelfAlignment, ash::ShelfAlignment> {
15 static ash::mojom::ShelfAlignment ToMojom(ash::ShelfAlignment input) {
16 switch (input) {
17 case ash::SHELF_ALIGNMENT_BOTTOM:
18 return ash::mojom::ShelfAlignment::BOTTOM;
19 case ash::SHELF_ALIGNMENT_LEFT:
20 return ash::mojom::ShelfAlignment::LEFT;
21 case ash::SHELF_ALIGNMENT_RIGHT:
22 return ash::mojom::ShelfAlignment::RIGHT;
23 case ash::SHELF_ALIGNMENT_BOTTOM_LOCKED:
24 return ash::mojom::ShelfAlignment::BOTTOM_LOCKED;
25 }
26 NOTREACHED();
27 return ash::mojom::ShelfAlignment::BOTTOM;
28 }
29
30 static bool FromMojom(ash::mojom::ShelfAlignment input,
31 ash::ShelfAlignment* out) {
32 switch (input) {
33 case ash::mojom::ShelfAlignment::BOTTOM:
34 *out = ash::SHELF_ALIGNMENT_BOTTOM;
35 return true;
36 case ash::mojom::ShelfAlignment::LEFT:
37 *out = ash::SHELF_ALIGNMENT_LEFT;
38 return true;
39 case ash::mojom::ShelfAlignment::RIGHT:
40 *out = ash::SHELF_ALIGNMENT_RIGHT;
41 return true;
42 case ash::mojom::ShelfAlignment::BOTTOM_LOCKED:
43 *out = ash::SHELF_ALIGNMENT_BOTTOM_LOCKED;
44 return true;
45 }
46 NOTREACHED();
47 return false;
48 }
49 };
50
51 template <>
52 struct EnumTraits<ash::mojom::ShelfAutoHideBehavior,
53 ash::ShelfAutoHideBehavior> {
54 static ash::mojom::ShelfAutoHideBehavior ToMojom(
55 ash::ShelfAutoHideBehavior input) {
56 switch (input) {
57 case ash::SHELF_AUTO_HIDE_BEHAVIOR_ALWAYS:
58 return ash::mojom::ShelfAutoHideBehavior::ALWAYS;
59 case ash::SHELF_AUTO_HIDE_BEHAVIOR_NEVER:
60 return ash::mojom::ShelfAutoHideBehavior::NEVER;
61 case ash::SHELF_AUTO_HIDE_ALWAYS_HIDDEN:
62 return ash::mojom::ShelfAutoHideBehavior::HIDDEN;
63 }
64 NOTREACHED();
65 return ash::mojom::ShelfAutoHideBehavior::NEVER;
66 }
67
68 static bool FromMojom(ash::mojom::ShelfAutoHideBehavior input,
69 ash::ShelfAutoHideBehavior* out) {
70 switch (input) {
71 case ash::mojom::ShelfAutoHideBehavior::ALWAYS:
72 *out = ash::SHELF_AUTO_HIDE_BEHAVIOR_ALWAYS;
73 return true;
74 case ash::mojom::ShelfAutoHideBehavior::NEVER:
75 *out = ash::SHELF_AUTO_HIDE_BEHAVIOR_NEVER;
76 return true;
77 case ash::mojom::ShelfAutoHideBehavior::HIDDEN:
78 *out = ash::SHELF_AUTO_HIDE_ALWAYS_HIDDEN;
79 return true;
80 }
81 NOTREACHED();
82 return false;
83 }
84 };
85
86 } // namespace mojo
87
88 #endif // ASH_PUBLIC_INTERFACES_SHELF_ENUM_TRAITS_H_
OLDNEW
« no previous file with comments | « ash/public/interfaces/shelf.typemap ('k') | ash/public/interfaces/shelf_struct_traits.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698