| 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/LocalFrame.h" | 9 #include "core/frame/LocalFrame.h" |
| 10 #include "core/frame/Screen.h" | 10 #include "core/frame/Screen.h" |
| (...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 102 Document* ScreenOrientation::document() const | 102 Document* ScreenOrientation::document() const |
| 103 { | 103 { |
| 104 if (!m_associatedDOMWindow || !m_associatedDOMWindow->isCurrentlyDisplayedIn
Frame()) | 104 if (!m_associatedDOMWindow || !m_associatedDOMWindow->isCurrentlyDisplayedIn
Frame()) |
| 105 return 0; | 105 return 0; |
| 106 ASSERT(m_associatedDOMWindow->document()); | 106 ASSERT(m_associatedDOMWindow->document()); |
| 107 return m_associatedDOMWindow->document(); | 107 return m_associatedDOMWindow->document(); |
| 108 } | 108 } |
| 109 | 109 |
| 110 ScreenOrientation& ScreenOrientation::from(Screen& screen) | 110 ScreenOrientation& ScreenOrientation::from(Screen& screen) |
| 111 { | 111 { |
| 112 ScreenOrientation* supplement = static_cast<ScreenOrientation*>(Supplement<S
creen>::from(screen, supplementName())); | 112 ScreenOrientation* supplement = static_cast<ScreenOrientation*>(WillBeHeapSu
pplement<Screen>::from(screen, supplementName())); |
| 113 if (!supplement) { | 113 if (!supplement) { |
| 114 supplement = new ScreenOrientation(screen); | 114 supplement = new ScreenOrientation(screen); |
| 115 provideTo(screen, supplementName(), adoptPtr(supplement)); | 115 provideTo(screen, supplementName(), adoptPtrWillBeNoop(supplement)); |
| 116 } | 116 } |
| 117 return *supplement; | 117 return *supplement; |
| 118 } | 118 } |
| 119 | 119 |
| 120 ScreenOrientation::~ScreenOrientation() | 120 ScreenOrientation::~ScreenOrientation() |
| 121 { | 121 { |
| 122 } | 122 } |
| 123 | 123 |
| 124 const AtomicString& ScreenOrientation::orientation(Screen& screen) | 124 const AtomicString& ScreenOrientation::orientation(Screen& screen) |
| 125 { | 125 { |
| (...skipping 27 matching lines...) Expand all Loading... |
| 153 ScreenOrientation::from(screen).lockOrientationAsync(orientations); | 153 ScreenOrientation::from(screen).lockOrientationAsync(orientations); |
| 154 return true; | 154 return true; |
| 155 } | 155 } |
| 156 | 156 |
| 157 void ScreenOrientation::unlockOrientation(Screen& screen) | 157 void ScreenOrientation::unlockOrientation(Screen& screen) |
| 158 { | 158 { |
| 159 ScreenOrientation::from(screen).lockOrientationAsync(WebScreenOrientationDef
ault); | 159 ScreenOrientation::from(screen).lockOrientationAsync(WebScreenOrientationDef
ault); |
| 160 } | 160 } |
| 161 | 161 |
| 162 } // namespace WebCore | 162 } // namespace WebCore |
| OLD | NEW |