| 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
|
|
|