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

Unified Diff: content/common/screen_orientation_utils.cc

Issue 549603003: Create Mojo service for locking/unlocking screen orientation. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Response to review, port unittest Created 6 years, 3 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: content/common/screen_orientation_utils.cc
diff --git a/content/common/screen_orientation_utils.cc b/content/common/screen_orientation_utils.cc
new file mode 100644
index 0000000000000000000000000000000000000000..c3df64f017dbff4c343f25e7340c8144d695922b
--- /dev/null
+++ b/content/common/screen_orientation_utils.cc
@@ -0,0 +1,67 @@
+// Copyright 2014 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.
+
+#include "content/common/screen_orientation_utils.h"
+
+#include "base/logging.h"
+
+namespace content {
+
+ScreenOrientationLockType
+WebScreenOrientationLockTypeToScreenOrientationLockType(
+ blink::WebScreenOrientationLockType orientation) {
+ switch (orientation) {
+ case blink::WebScreenOrientationLockDefault:
+ return SCREEN_ORIENTATION_LOCK_TYPE_DEFAULT;
+ case blink::WebScreenOrientationLockPortraitPrimary:
+ return SCREEN_ORIENTATION_LOCK_TYPE_PORTRAIT_PRIMARY;
+ case blink::WebScreenOrientationLockPortraitSecondary:
+ return SCREEN_ORIENTATION_LOCK_TYPE_PORTRAIT_SECONDARY;
+ case blink::WebScreenOrientationLockLandscapePrimary:
+ return SCREEN_ORIENTATION_LOCK_TYPE_LANDSCAPE_PRIMARY;
+ case blink::WebScreenOrientationLockLandscapeSecondary:
+ return SCREEN_ORIENTATION_LOCK_TYPE_LANDSCAPE_SECONDARY;
+ case blink::WebScreenOrientationLockAny:
+ return SCREEN_ORIENTATION_LOCK_TYPE_ANY;
+ case blink::WebScreenOrientationLockLandscape:
+ return SCREEN_ORIENTATION_LOCK_TYPE_LANDSCAPE;
+ case blink::WebScreenOrientationLockPortrait:
+ return SCREEN_ORIENTATION_LOCK_TYPE_PORTRAIT;
+ case blink::WebScreenOrientationLockNatural:
+ return SCREEN_ORIENTATION_LOCK_TYPE_NATURAL;
+ default:
+ NOTREACHED();
+ return SCREEN_ORIENTATION_LOCK_TYPE_DEFAULT;
+ }
+}
+
+blink::WebScreenOrientationLockType
+ScreenOrientationLockTypeToWebScreenOrientationLockType(
+ ScreenOrientationLockType orientation) {
+ switch (orientation) {
+ case SCREEN_ORIENTATION_LOCK_TYPE_DEFAULT:
+ return blink::WebScreenOrientationLockDefault;
+ case SCREEN_ORIENTATION_LOCK_TYPE_PORTRAIT_PRIMARY:
+ return blink::WebScreenOrientationLockPortraitPrimary;
+ case SCREEN_ORIENTATION_LOCK_TYPE_PORTRAIT_SECONDARY:
+ return blink::WebScreenOrientationLockPortraitSecondary;
+ case SCREEN_ORIENTATION_LOCK_TYPE_LANDSCAPE_PRIMARY:
+ return blink::WebScreenOrientationLockLandscapePrimary;
+ case SCREEN_ORIENTATION_LOCK_TYPE_LANDSCAPE_SECONDARY:
+ return blink::WebScreenOrientationLockLandscapeSecondary;
+ case SCREEN_ORIENTATION_LOCK_TYPE_ANY:
+ return blink::WebScreenOrientationLockAny;
+ case SCREEN_ORIENTATION_LOCK_TYPE_LANDSCAPE:
+ return blink::WebScreenOrientationLockLandscape;
+ case SCREEN_ORIENTATION_LOCK_TYPE_PORTRAIT:
+ return blink::WebScreenOrientationLockPortrait;
+ case SCREEN_ORIENTATION_LOCK_TYPE_NATURAL:
+ return blink::WebScreenOrientationLockNatural;
+ default:
+ NOTREACHED();
+ return blink::WebScreenOrientationLockDefault;
+ }
+}
+
+} // namespace content

Powered by Google App Engine
This is Rietveld 408576698