Chromium Code Reviews| OLD | NEW |
|---|---|
| (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 WebScreenOrientationEnumTraits_h | |
| 6 #define WebScreenOrientationEnumTraits_h | |
| 7 | |
| 8 #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.mojom-shared.h" | |
| 10 | |
| 11 namespace mojo { | |
| 12 | |
| 13 template <> | |
| 14 struct EnumTraits<::blink::mojom::ScreenOrientationLockType, | |
|
blundell
2016/10/25 16:09:27
Why not do this for ScreenOrientationLockResult as
lunalu1
2016/11/03 23:15:26
This is because before OnLockSuccess and OnLockErr
| |
| 15 ::blink::WebScreenOrientationLockType> { | |
| 16 static ::blink::mojom::ScreenOrientationLockType ToMojom( | |
| 17 ::blink::WebScreenOrientationLockType lockType) { | |
| 18 switch (lockType) { | |
| 19 case ::blink::WebScreenOrientationLockDefault: | |
| 20 return ::blink::mojom::ScreenOrientationLockType::DEFAULT; | |
| 21 case ::blink::WebScreenOrientationLockPortraitPrimary: | |
| 22 return ::blink::mojom::ScreenOrientationLockType::PORTRAIT_PRIMARY; | |
| 23 case ::blink::WebScreenOrientationLockPortraitSecondary: | |
| 24 return ::blink::mojom::ScreenOrientationLockType::PORTRAIT_SECONDARY; | |
| 25 case ::blink::WebScreenOrientationLockLandscapePrimary: | |
| 26 return ::blink::mojom::ScreenOrientationLockType::LANDSCAPE_PRIMARY; | |
| 27 case ::blink::WebScreenOrientationLockLandscapeSecondary: | |
| 28 return ::blink::mojom::ScreenOrientationLockType::LANDSCAPE_SECONDARY; | |
| 29 case ::blink::WebScreenOrientationLockAny: | |
| 30 return ::blink::mojom::ScreenOrientationLockType::ANY; | |
| 31 case ::blink::WebScreenOrientationLockLandscape: | |
| 32 return ::blink::mojom::ScreenOrientationLockType::LANDSCAPE; | |
| 33 case ::blink::WebScreenOrientationLockPortrait: | |
| 34 return ::blink::mojom::ScreenOrientationLockType::PORTRAIT; | |
| 35 case ::blink::WebScreenOrientationLockNatural: | |
| 36 return ::blink::mojom::ScreenOrientationLockType::NATURAL; | |
| 37 } | |
| 38 NOTREACHED(); | |
| 39 return ::blink::mojom::ScreenOrientationLockType::DEFAULT; | |
| 40 } | |
| 41 | |
| 42 static bool FromMojom(::blink::mojom::ScreenOrientationLockType lockType, | |
| 43 ::blink::WebScreenOrientationLockType* out) { | |
| 44 switch (lockType) { | |
| 45 case ::blink::mojom::ScreenOrientationLockType::DEFAULT: | |
| 46 *out = ::blink::WebScreenOrientationLockDefault; | |
| 47 return true; | |
| 48 case ::blink::mojom::ScreenOrientationLockType::PORTRAIT_PRIMARY: | |
| 49 *out = ::blink::WebScreenOrientationLockPortraitPrimary; | |
| 50 return true; | |
| 51 case ::blink::mojom::ScreenOrientationLockType::PORTRAIT_SECONDARY: | |
| 52 *out = ::blink::WebScreenOrientationLockPortraitSecondary; | |
| 53 return true; | |
| 54 case ::blink::mojom::ScreenOrientationLockType::LANDSCAPE_PRIMARY: | |
| 55 *out = ::blink::WebScreenOrientationLockLandscapePrimary; | |
| 56 return true; | |
| 57 case ::blink::mojom::ScreenOrientationLockType::LANDSCAPE_SECONDARY: | |
| 58 *out = ::blink::WebScreenOrientationLockLandscapeSecondary; | |
| 59 return true; | |
| 60 case ::blink::mojom::ScreenOrientationLockType::ANY: | |
| 61 *out = ::blink::WebScreenOrientationLockAny; | |
| 62 return true; | |
| 63 case ::blink::mojom::ScreenOrientationLockType::LANDSCAPE: | |
| 64 *out = ::blink::WebScreenOrientationLockLandscape; | |
| 65 return true; | |
| 66 case ::blink::mojom::ScreenOrientationLockType::PORTRAIT: | |
| 67 *out = ::blink::WebScreenOrientationLockPortrait; | |
| 68 return true; | |
| 69 case ::blink::mojom::ScreenOrientationLockType::NATURAL: | |
| 70 *out = ::blink::WebScreenOrientationLockNatural; | |
| 71 return true; | |
| 72 } | |
| 73 NOTREACHED(); | |
| 74 return false; | |
| 75 } | |
| 76 }; | |
| 77 | |
| 78 } // namespace mojo | |
| 79 | |
| 80 #endif // WebScreenOrientationEnumTraits_h | |
| OLD | NEW |