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 "core/frame/DOMWindow.h" | 8 #include "core/frame/DOMWindow.h" |
9 #include "core/frame/Frame.h" | 9 #include "core/frame/Frame.h" |
10 #include "core/frame/Screen.h" | 10 #include "core/frame/Screen.h" |
11 | 11 |
12 namespace WebCore { | 12 namespace WebCore { |
13 | 13 |
14 ScreenOrientation::ScreenOrientation(Screen* screen) | 14 ScreenOrientation::ScreenOrientation(Screen& screen) |
15 : DOMWindowProperty(screen->frame()) | 15 : DOMWindowProperty(screen.frame()) |
16 { | 16 { |
17 } | 17 } |
18 | 18 |
19 const char* ScreenOrientation::supplementName() | 19 const char* ScreenOrientation::supplementName() |
20 { | 20 { |
21 return "ScreenOrientation"; | 21 return "ScreenOrientation"; |
22 } | 22 } |
23 | 23 |
24 ScreenOrientation* ScreenOrientation::from(Screen* screen) | 24 ScreenOrientation& ScreenOrientation::from(Screen& screen) |
25 { | 25 { |
26 ScreenOrientation* supplement = static_cast<ScreenOrientation*>(Supplement<S
creen>::from(screen, supplementName())); | 26 ScreenOrientation* supplement = static_cast<ScreenOrientation*>(Supplement<S
creen>::from(screen, supplementName())); |
27 if (!supplement) { | 27 if (!supplement) { |
28 ASSERT(screen); | |
29 supplement = new ScreenOrientation(screen); | 28 supplement = new ScreenOrientation(screen); |
30 provideTo(screen, supplementName(), adoptPtr(supplement)); | 29 provideTo(screen, supplementName(), adoptPtr(supplement)); |
31 } | 30 } |
32 return supplement; | 31 return *supplement; |
33 } | 32 } |
34 | 33 |
35 ScreenOrientation::~ScreenOrientation() | 34 ScreenOrientation::~ScreenOrientation() |
36 { | 35 { |
37 } | 36 } |
38 | 37 |
39 Screen* ScreenOrientation::screen() const | 38 Screen* ScreenOrientation::screen() const |
40 { | 39 { |
41 Frame* frame = this->frame(); | 40 Frame* frame = this->frame(); |
42 ASSERT(frame); | 41 ASSERT(frame); |
43 DOMWindow* window = frame->domWindow(); | 42 DOMWindow* window = frame->domWindow(); |
44 ASSERT(window); | 43 ASSERT(window); |
45 return window->screen(); | 44 return window->screen(); |
46 } | 45 } |
47 | 46 |
48 const AtomicString& ScreenOrientation::orientation(Screen* screen) | 47 const AtomicString& ScreenOrientation::orientation(Screen& screen) |
49 { | 48 { |
50 // FIXME: Implement. | 49 // FIXME: Implement. |
51 DEFINE_STATIC_LOCAL(const AtomicString, portraitPrimary, ("portrait-primary"
, AtomicString::ConstructFromLiteral)); | 50 DEFINE_STATIC_LOCAL(const AtomicString, portraitPrimary, ("portrait-primary"
, AtomicString::ConstructFromLiteral)); |
52 return portraitPrimary; | 51 return portraitPrimary; |
53 } | 52 } |
54 | 53 |
55 bool ScreenOrientation::lockOrientation(Screen* screen, const Vector<String>& or
ientations) | 54 bool ScreenOrientation::lockOrientation(Screen& screen, const Vector<String>& or
ientations) |
56 { | 55 { |
57 // FIXME: Implement. | 56 // FIXME: Implement. |
58 return false; | 57 return false; |
59 } | 58 } |
60 | 59 |
61 bool ScreenOrientation::lockOrientation(Screen* screen, const AtomicString& orie
ntation) | 60 bool ScreenOrientation::lockOrientation(Screen& screen, const AtomicString& orie
ntation) |
62 { | 61 { |
63 // FIXME: Implement. | 62 // FIXME: Implement. |
64 return false; | 63 return false; |
65 } | 64 } |
66 | 65 |
67 void ScreenOrientation::unlockOrientation(Screen* screen) | 66 void ScreenOrientation::unlockOrientation(Screen& screen) |
68 { | 67 { |
69 // FIXME: Implement. | 68 // FIXME: Implement. |
70 } | 69 } |
71 | 70 |
72 } // namespace WebCore | 71 } // namespace WebCore |
OLD | NEW |