OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 #include "config.h" | 5 #include "config.h" |
6 #include "modules/screen_orientation/ScreenOrientation.h" | 6 #include "modules/screen_orientation/ScreenOrientation.h" |
7 | 7 |
8 #include "bindings/core/v8/ScriptPromise.h" | 8 #include "bindings/core/v8/ScriptPromise.h" |
9 #include "bindings/core/v8/ScriptPromiseResolver.h" | 9 #include "bindings/core/v8/ScriptPromiseResolver.h" |
10 #include "core/dom/DOMException.h" | 10 #include "core/dom/DOMException.h" |
11 #include "core/dom/Document.h" | 11 #include "core/dom/Document.h" |
12 #include "core/dom/ExceptionCode.h" | 12 #include "core/dom/ExceptionCode.h" |
13 #include "core/frame/LocalFrame.h" | 13 #include "core/frame/LocalFrame.h" |
14 #include "modules/EventTargetModules.h" | 14 #include "modules/EventTargetModules.h" |
15 #include "modules/screen_orientation/LockOrientationCallback.h" | 15 #include "modules/screen_orientation/LockOrientationCallback.h" |
16 #include "modules/screen_orientation/ScreenOrientationController.h" | 16 #include "modules/screen_orientation/ScreenOrientationController.h" |
17 #include "public/platform/WebScreenOrientationType.h" | 17 #include "public/platform/WebScreenOrientationType.h" |
18 | 18 |
19 // This code assumes that WebScreenOrientationType values are included in WebScr
eenOrientationLockType. | 19 // This code assumes that WebScreenOrientationType values are included in WebScr
eenOrientationLockType. |
20 #define COMPILE_ASSERT_MATCHING_ENUM(enum1, enum2) \ | 20 #define COMPILE_ASSERT_MATCHING_ENUM(enum1, enum2) \ |
21 COMPILE_ASSERT(static_cast<unsigned>(blink::enum1) == static_cast<unsigned>(
blink::enum2), mismatching_types) | 21 COMPILE_ASSERT(static_cast<unsigned>(blink::enum1) == static_cast<unsigned>(
blink::enum2), mismatching_types) |
22 COMPILE_ASSERT_MATCHING_ENUM(WebScreenOrientationPortraitPrimary, WebScreenOrien
tationLockPortraitPrimary); | 22 COMPILE_ASSERT_MATCHING_ENUM(WebScreenOrientationPortraitPrimary, WebScreenOrien
tationLockPortraitPrimary); |
23 COMPILE_ASSERT_MATCHING_ENUM(WebScreenOrientationPortraitSecondary, WebScreenOri
entationLockPortraitSecondary); | 23 COMPILE_ASSERT_MATCHING_ENUM(WebScreenOrientationPortraitSecondary, WebScreenOri
entationLockPortraitSecondary); |
24 COMPILE_ASSERT_MATCHING_ENUM(WebScreenOrientationLandscapePrimary, WebScreenOrie
ntationLockLandscapePrimary); | 24 COMPILE_ASSERT_MATCHING_ENUM(WebScreenOrientationLandscapePrimary, WebScreenOrie
ntationLockLandscapePrimary); |
25 COMPILE_ASSERT_MATCHING_ENUM(WebScreenOrientationLandscapeSecondary, WebScreenOr
ientationLockLandscapeSecondary); | 25 COMPILE_ASSERT_MATCHING_ENUM(WebScreenOrientationLandscapeSecondary, WebScreenOr
ientationLockLandscapeSecondary); |
26 | 26 |
27 namespace WebCore { | 27 namespace blink { |
28 | 28 |
29 struct ScreenOrientationInfo { | 29 struct ScreenOrientationInfo { |
30 const AtomicString& name; | 30 const AtomicString& name; |
31 unsigned orientation; | 31 unsigned orientation; |
32 }; | 32 }; |
33 | 33 |
34 static ScreenOrientationInfo* orientationsMap(unsigned& length) | 34 static ScreenOrientationInfo* orientationsMap(unsigned& length) |
35 { | 35 { |
36 DEFINE_STATIC_LOCAL(const AtomicString, portraitPrimary, ("portrait-primary"
, AtomicString::ConstructFromLiteral)); | 36 DEFINE_STATIC_LOCAL(const AtomicString, portraitPrimary, ("portrait-primary"
, AtomicString::ConstructFromLiteral)); |
37 DEFINE_STATIC_LOCAL(const AtomicString, portraitSecondary, ("portrait-second
ary", AtomicString::ConstructFromLiteral)); | 37 DEFINE_STATIC_LOCAL(const AtomicString, portraitSecondary, ("portrait-second
ary", AtomicString::ConstructFromLiteral)); |
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
182 return 0; | 182 return 0; |
183 | 183 |
184 return ScreenOrientationController::from(*m_frame); | 184 return ScreenOrientationController::from(*m_frame); |
185 } | 185 } |
186 | 186 |
187 void ScreenOrientation::trace(Visitor* visitor) | 187 void ScreenOrientation::trace(Visitor* visitor) |
188 { | 188 { |
189 EventTargetWithInlineData::trace(visitor); | 189 EventTargetWithInlineData::trace(visitor); |
190 } | 190 } |
191 | 191 |
192 } // namespace WebCore | 192 } // namespace blink |
OLD | NEW |