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 "modules/screen_orientation/ScreenOrientationController.h" | 5 #include "modules/screen_orientation/ScreenOrientationController.h" |
6 | 6 |
7 #include "core/events/Event.h" | 7 #include "core/events/Event.h" |
8 #include "core/frame/FrameHost.h" | 8 #include "core/frame/FrameHost.h" |
9 #include "core/frame/FrameView.h" | 9 #include "core/frame/FrameView.h" |
10 #include "core/frame/LocalFrame.h" | 10 #include "core/frame/LocalFrame.h" |
11 #include "core/page/ChromeClient.h" | 11 #include "core/page/ChromeClient.h" |
12 #include "core/page/Page.h" | 12 #include "core/page/Page.h" |
13 #include "modules/screen_orientation/ScreenOrientation.h" | 13 #include "modules/screen_orientation/ScreenOrientation.h" |
14 #include "modules/screen_orientation/ScreenOrientationDispatcher.h" | 14 #include "modules/screen_orientation/ScreenOrientationDispatcher.h" |
15 #include "platform/LayoutTestSupport.h" | 15 #include "platform/LayoutTestSupport.h" |
16 #include "public/platform/WebScreenInfo.h" | 16 #include "public/platform/WebScreenInfo.h" |
17 #include "public/platform/modules/screen_orientation/WebScreenOrientationClient.
h" | 17 #include "public/platform/modules/screen_orientation/WebScreenOrientationClient.
h" |
18 | 18 |
19 namespace blink { | 19 namespace blink { |
20 | 20 |
21 ScreenOrientationController::~ScreenOrientationController() | 21 ScreenOrientationController::~ScreenOrientationController() |
22 { | 22 { |
23 } | 23 } |
24 | 24 |
25 void ScreenOrientationController::provideTo(LocalFrame& frame, WebScreenOrientat
ionClient* client) | 25 void ScreenOrientationController::provideTo(LocalFrame& frame, WebScreenOrientat
ionClient* client) |
26 { | 26 { |
27 ASSERT(RuntimeEnabledFeatures::screenOrientationEnabled()); | 27 ASSERT(RuntimeEnabledFeatures::screenOrientationEnabled()); |
28 | 28 |
29 ScreenOrientationController* controller = new ScreenOrientationController(fr
ame, client); | 29 ScreenOrientationController* controller = new ScreenOrientationController(fr
ame, client); |
30 HeapSupplement<LocalFrame>::provideTo(frame, supplementName(), controller); | 30 Supplement<LocalFrame>::provideTo(frame, supplementName(), controller); |
31 } | 31 } |
32 | 32 |
33 ScreenOrientationController* ScreenOrientationController::from(LocalFrame& frame
) | 33 ScreenOrientationController* ScreenOrientationController::from(LocalFrame& frame
) |
34 { | 34 { |
35 return static_cast<ScreenOrientationController*>(HeapSupplement<LocalFrame>:
:from(frame, supplementName())); | 35 return static_cast<ScreenOrientationController*>(Supplement<LocalFrame>::fro
m(frame, supplementName())); |
36 } | 36 } |
37 | 37 |
38 ScreenOrientationController::ScreenOrientationController(LocalFrame& frame, WebS
creenOrientationClient* client) | 38 ScreenOrientationController::ScreenOrientationController(LocalFrame& frame, WebS
creenOrientationClient* client) |
39 : LocalFrameLifecycleObserver(&frame) | 39 : LocalFrameLifecycleObserver(&frame) |
40 , PlatformEventController(frame.page()) | 40 , PlatformEventController(frame.page()) |
41 , m_client(client) | 41 , m_client(client) |
42 , m_dispatchEventTimer(this, &ScreenOrientationController::dispatchEventTime
rFired) | 42 , m_dispatchEventTimer(this, &ScreenOrientationController::dispatchEventTime
rFired) |
43 { | 43 { |
44 } | 44 } |
45 | 45 |
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
207 if (m_orientation && page()->isPageVisible()) | 207 if (m_orientation && page()->isPageVisible()) |
208 startUpdating(); | 208 startUpdating(); |
209 else | 209 else |
210 stopUpdating(); | 210 stopUpdating(); |
211 } | 211 } |
212 | 212 |
213 DEFINE_TRACE(ScreenOrientationController) | 213 DEFINE_TRACE(ScreenOrientationController) |
214 { | 214 { |
215 visitor->trace(m_orientation); | 215 visitor->trace(m_orientation); |
216 LocalFrameLifecycleObserver::trace(visitor); | 216 LocalFrameLifecycleObserver::trace(visitor); |
217 HeapSupplement<LocalFrame>::trace(visitor); | 217 Supplement<LocalFrame>::trace(visitor); |
218 PlatformEventController::trace(visitor); | 218 PlatformEventController::trace(visitor); |
219 } | 219 } |
220 | 220 |
221 } // namespace blink | 221 } // namespace blink |
OLD | NEW |