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

Side by Side Diff: third_party/WebKit/public/platform/modules/screen_orientation/WebScreenOrientationEnumTraits.h

Issue 2564653003: [DeviceService] Move screen_orientation.mojom from //content to //device. (Closed)
Patch Set: Address nits from blundell@ Created 4 years 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
1 // Copyright 2016 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef WebScreenOrientationEnumTraits_h 5 #ifndef WebScreenOrientationEnumTraits_h
6 #define WebScreenOrientationEnumTraits_h 6 #define WebScreenOrientationEnumTraits_h
7 7
8 #include "device/screen_orientation/public/interfaces/screen_orientation_lock_ty pes.mojom-shared.h"
8 #include "third_party/WebKit/public/platform/modules/screen_orientation/WebScree nOrientationLockType.h" 9 #include "third_party/WebKit/public/platform/modules/screen_orientation/WebScree nOrientationLockType.h"
9 #include "third_party/WebKit/public/platform/modules/screen_orientation/screen_o rientation_lock_types.mojom-shared.h"
10 10
11 namespace mojo { 11 namespace mojo {
12 12
13 template <> 13 template <>
14 struct EnumTraits<::blink::mojom::ScreenOrientationLockType, 14 struct EnumTraits<::device::mojom::ScreenOrientationLockType,
15 ::blink::WebScreenOrientationLockType> { 15 ::blink::WebScreenOrientationLockType> {
16 static ::blink::mojom::ScreenOrientationLockType ToMojom( 16 static ::device::mojom::ScreenOrientationLockType ToMojom(
17 ::blink::WebScreenOrientationLockType lockType) { 17 ::blink::WebScreenOrientationLockType lockType) {
18 switch (lockType) { 18 switch (lockType) {
19 case ::blink::WebScreenOrientationLockDefault: 19 case ::blink::WebScreenOrientationLockDefault:
20 return ::blink::mojom::ScreenOrientationLockType::DEFAULT; 20 return ::device::mojom::ScreenOrientationLockType::DEFAULT;
21 case ::blink::WebScreenOrientationLockPortraitPrimary: 21 case ::blink::WebScreenOrientationLockPortraitPrimary:
22 return ::blink::mojom::ScreenOrientationLockType::PORTRAIT_PRIMARY; 22 return ::device::mojom::ScreenOrientationLockType::PORTRAIT_PRIMARY;
23 case ::blink::WebScreenOrientationLockPortraitSecondary: 23 case ::blink::WebScreenOrientationLockPortraitSecondary:
24 return ::blink::mojom::ScreenOrientationLockType::PORTRAIT_SECONDARY; 24 return ::device::mojom::ScreenOrientationLockType::PORTRAIT_SECONDARY;
25 case ::blink::WebScreenOrientationLockLandscapePrimary: 25 case ::blink::WebScreenOrientationLockLandscapePrimary:
26 return ::blink::mojom::ScreenOrientationLockType::LANDSCAPE_PRIMARY; 26 return ::device::mojom::ScreenOrientationLockType::LANDSCAPE_PRIMARY;
27 case ::blink::WebScreenOrientationLockLandscapeSecondary: 27 case ::blink::WebScreenOrientationLockLandscapeSecondary:
28 return ::blink::mojom::ScreenOrientationLockType::LANDSCAPE_SECONDARY; 28 return ::device::mojom::ScreenOrientationLockType::LANDSCAPE_SECONDARY;
29 case ::blink::WebScreenOrientationLockAny: 29 case ::blink::WebScreenOrientationLockAny:
30 return ::blink::mojom::ScreenOrientationLockType::ANY; 30 return ::device::mojom::ScreenOrientationLockType::ANY;
31 case ::blink::WebScreenOrientationLockLandscape: 31 case ::blink::WebScreenOrientationLockLandscape:
32 return ::blink::mojom::ScreenOrientationLockType::LANDSCAPE; 32 return ::device::mojom::ScreenOrientationLockType::LANDSCAPE;
33 case ::blink::WebScreenOrientationLockPortrait: 33 case ::blink::WebScreenOrientationLockPortrait:
34 return ::blink::mojom::ScreenOrientationLockType::PORTRAIT; 34 return ::device::mojom::ScreenOrientationLockType::PORTRAIT;
35 case ::blink::WebScreenOrientationLockNatural: 35 case ::blink::WebScreenOrientationLockNatural:
36 return ::blink::mojom::ScreenOrientationLockType::NATURAL; 36 return ::device::mojom::ScreenOrientationLockType::NATURAL;
37 } 37 }
38 NOTREACHED(); 38 NOTREACHED();
39 return ::blink::mojom::ScreenOrientationLockType::DEFAULT; 39 return ::device::mojom::ScreenOrientationLockType::DEFAULT;
40 } 40 }
41 41
42 static bool FromMojom(::blink::mojom::ScreenOrientationLockType lockType, 42 static bool FromMojom(::device::mojom::ScreenOrientationLockType lockType,
43 ::blink::WebScreenOrientationLockType* out) { 43 ::blink::WebScreenOrientationLockType* out) {
44 switch (lockType) { 44 switch (lockType) {
45 case ::blink::mojom::ScreenOrientationLockType::DEFAULT: 45 case ::device::mojom::ScreenOrientationLockType::DEFAULT:
46 *out = ::blink::WebScreenOrientationLockDefault; 46 *out = ::blink::WebScreenOrientationLockDefault;
47 return true; 47 return true;
48 case ::blink::mojom::ScreenOrientationLockType::PORTRAIT_PRIMARY: 48 case ::device::mojom::ScreenOrientationLockType::PORTRAIT_PRIMARY:
49 *out = ::blink::WebScreenOrientationLockPortraitPrimary; 49 *out = ::blink::WebScreenOrientationLockPortraitPrimary;
50 return true; 50 return true;
51 case ::blink::mojom::ScreenOrientationLockType::PORTRAIT_SECONDARY: 51 case ::device::mojom::ScreenOrientationLockType::PORTRAIT_SECONDARY:
52 *out = ::blink::WebScreenOrientationLockPortraitSecondary; 52 *out = ::blink::WebScreenOrientationLockPortraitSecondary;
53 return true; 53 return true;
54 case ::blink::mojom::ScreenOrientationLockType::LANDSCAPE_PRIMARY: 54 case ::device::mojom::ScreenOrientationLockType::LANDSCAPE_PRIMARY:
55 *out = ::blink::WebScreenOrientationLockLandscapePrimary; 55 *out = ::blink::WebScreenOrientationLockLandscapePrimary;
56 return true; 56 return true;
57 case ::blink::mojom::ScreenOrientationLockType::LANDSCAPE_SECONDARY: 57 case ::device::mojom::ScreenOrientationLockType::LANDSCAPE_SECONDARY:
58 *out = ::blink::WebScreenOrientationLockLandscapeSecondary; 58 *out = ::blink::WebScreenOrientationLockLandscapeSecondary;
59 return true; 59 return true;
60 case ::blink::mojom::ScreenOrientationLockType::ANY: 60 case ::device::mojom::ScreenOrientationLockType::ANY:
61 *out = ::blink::WebScreenOrientationLockAny; 61 *out = ::blink::WebScreenOrientationLockAny;
62 return true; 62 return true;
63 case ::blink::mojom::ScreenOrientationLockType::LANDSCAPE: 63 case ::device::mojom::ScreenOrientationLockType::LANDSCAPE:
64 *out = ::blink::WebScreenOrientationLockLandscape; 64 *out = ::blink::WebScreenOrientationLockLandscape;
65 return true; 65 return true;
66 case ::blink::mojom::ScreenOrientationLockType::PORTRAIT: 66 case ::device::mojom::ScreenOrientationLockType::PORTRAIT:
67 *out = ::blink::WebScreenOrientationLockPortrait; 67 *out = ::blink::WebScreenOrientationLockPortrait;
68 return true; 68 return true;
69 case ::blink::mojom::ScreenOrientationLockType::NATURAL: 69 case ::device::mojom::ScreenOrientationLockType::NATURAL:
70 *out = ::blink::WebScreenOrientationLockNatural; 70 *out = ::blink::WebScreenOrientationLockNatural;
71 return true; 71 return true;
72 } 72 }
73 NOTREACHED(); 73 NOTREACHED();
74 return false; 74 return false;
75 } 75 }
76 }; 76 };
77 77
78 } // namespace mojo 78 } // namespace mojo
79 79
80 #endif // WebScreenOrientationEnumTraits_h 80 #endif // WebScreenOrientationEnumTraits_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698