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

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

Issue 2391883006: Mojo-ify implementation of screen orientation locking/unlocking. (Closed)
Patch Set: Codereview update 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: third_party/WebKit/public/platform/modules/screen_orientation/WebScreenOrientationEnumTraits.h
diff --git a/third_party/WebKit/public/platform/modules/screen_orientation/WebScreenOrientationEnumTraits.h b/third_party/WebKit/public/platform/modules/screen_orientation/WebScreenOrientationEnumTraits.h
new file mode 100644
index 0000000000000000000000000000000000000000..7666a248f6b6bba86bb18da55b7f62f1f28f8a78
--- /dev/null
+++ b/third_party/WebKit/public/platform/modules/screen_orientation/WebScreenOrientationEnumTraits.h
@@ -0,0 +1,80 @@
+// 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 WebScreenOrientationEnumTraits_h
+#define WebScreenOrientationEnumTraits_h
+
+#include "third_party/WebKit/public/platform/modules/screen_orientation/WebScreenOrientationLockType.h"
+#include "third_party/WebKit/public/platform/modules/screen_orientation/screen_orientation.mojom-shared.h"
+
+namespace mojo {
+
+template <>
+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
+ ::blink::WebScreenOrientationLockType> {
+ static ::blink::mojom::ScreenOrientationLockType ToMojom(
+ ::blink::WebScreenOrientationLockType lockType) {
+ switch (lockType) {
+ case ::blink::WebScreenOrientationLockDefault:
+ return ::blink::mojom::ScreenOrientationLockType::DEFAULT;
+ case ::blink::WebScreenOrientationLockPortraitPrimary:
+ return ::blink::mojom::ScreenOrientationLockType::PORTRAIT_PRIMARY;
+ case ::blink::WebScreenOrientationLockPortraitSecondary:
+ return ::blink::mojom::ScreenOrientationLockType::PORTRAIT_SECONDARY;
+ case ::blink::WebScreenOrientationLockLandscapePrimary:
+ return ::blink::mojom::ScreenOrientationLockType::LANDSCAPE_PRIMARY;
+ case ::blink::WebScreenOrientationLockLandscapeSecondary:
+ return ::blink::mojom::ScreenOrientationLockType::LANDSCAPE_SECONDARY;
+ case ::blink::WebScreenOrientationLockAny:
+ return ::blink::mojom::ScreenOrientationLockType::ANY;
+ case ::blink::WebScreenOrientationLockLandscape:
+ return ::blink::mojom::ScreenOrientationLockType::LANDSCAPE;
+ case ::blink::WebScreenOrientationLockPortrait:
+ return ::blink::mojom::ScreenOrientationLockType::PORTRAIT;
+ case ::blink::WebScreenOrientationLockNatural:
+ return ::blink::mojom::ScreenOrientationLockType::NATURAL;
+ }
+ NOTREACHED();
+ return ::blink::mojom::ScreenOrientationLockType::DEFAULT;
+ }
+
+ static bool FromMojom(::blink::mojom::ScreenOrientationLockType lockType,
+ ::blink::WebScreenOrientationLockType* out) {
+ switch (lockType) {
+ case ::blink::mojom::ScreenOrientationLockType::DEFAULT:
+ *out = ::blink::WebScreenOrientationLockDefault;
+ return true;
+ case ::blink::mojom::ScreenOrientationLockType::PORTRAIT_PRIMARY:
+ *out = ::blink::WebScreenOrientationLockPortraitPrimary;
+ return true;
+ case ::blink::mojom::ScreenOrientationLockType::PORTRAIT_SECONDARY:
+ *out = ::blink::WebScreenOrientationLockPortraitSecondary;
+ return true;
+ case ::blink::mojom::ScreenOrientationLockType::LANDSCAPE_PRIMARY:
+ *out = ::blink::WebScreenOrientationLockLandscapePrimary;
+ return true;
+ case ::blink::mojom::ScreenOrientationLockType::LANDSCAPE_SECONDARY:
+ *out = ::blink::WebScreenOrientationLockLandscapeSecondary;
+ return true;
+ case ::blink::mojom::ScreenOrientationLockType::ANY:
+ *out = ::blink::WebScreenOrientationLockAny;
+ return true;
+ case ::blink::mojom::ScreenOrientationLockType::LANDSCAPE:
+ *out = ::blink::WebScreenOrientationLockLandscape;
+ return true;
+ case ::blink::mojom::ScreenOrientationLockType::PORTRAIT:
+ *out = ::blink::WebScreenOrientationLockPortrait;
+ return true;
+ case ::blink::mojom::ScreenOrientationLockType::NATURAL:
+ *out = ::blink::WebScreenOrientationLockNatural;
+ return true;
+ }
+ NOTREACHED();
+ return false;
+ }
+};
+
+} // namespace mojo
+
+#endif // WebScreenOrientationEnumTraits_h

Powered by Google App Engine
This is Rietveld 408576698