Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(274)

Side by Side Diff: third_party/WebKit/Source/modules/screen_orientation/ScreenOrientationController.cpp

Issue 2188523005: Remove ScreenOrientation runtime flag (status=stable) (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: V2 Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 "platform/ScopedOrientationChangeIndicator.h" 16 #include "platform/ScopedOrientationChangeIndicator.h"
17 #include "public/platform/WebScreenInfo.h" 17 #include "public/platform/WebScreenInfo.h"
18 #include "public/platform/modules/screen_orientation/WebScreenOrientationClient. h" 18 #include "public/platform/modules/screen_orientation/WebScreenOrientationClient. h"
19 19
20 namespace blink { 20 namespace blink {
21 21
22 ScreenOrientationController::~ScreenOrientationController() 22 ScreenOrientationController::~ScreenOrientationController()
23 { 23 {
24 } 24 }
25 25
26 void ScreenOrientationController::provideTo(LocalFrame& frame, WebScreenOrientat ionClient* client) 26 void ScreenOrientationController::provideTo(LocalFrame& frame, WebScreenOrientat ionClient* client)
27 { 27 {
28 ASSERT(RuntimeEnabledFeatures::screenOrientationEnabled());
29
30 ScreenOrientationController* controller = new ScreenOrientationController(fr ame, client); 28 ScreenOrientationController* controller = new ScreenOrientationController(fr ame, client);
31 Supplement<LocalFrame>::provideTo(frame, supplementName(), controller); 29 Supplement<LocalFrame>::provideTo(frame, supplementName(), controller);
32 } 30 }
33 31
34 ScreenOrientationController* ScreenOrientationController::from(LocalFrame& frame ) 32 ScreenOrientationController* ScreenOrientationController::from(LocalFrame& frame )
35 { 33 {
36 return static_cast<ScreenOrientationController*>(Supplement<LocalFrame>::fro m(frame, supplementName())); 34 return static_cast<ScreenOrientationController*>(Supplement<LocalFrame>::fro m(frame, supplementName()));
37 } 35 }
38 36
39 ScreenOrientationController::ScreenOrientationController(LocalFrame& frame, WebS creenOrientationClient* client) 37 ScreenOrientationController::ScreenOrientationController(LocalFrame& frame, WebS creenOrientationClient* client)
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
113 // children of the frame, so it should only be called on the frame on 111 // children of the frame, so it should only be called on the frame on
114 // top of the tree. We would need the embedder to call 112 // top of the tree. We would need the embedder to call
115 // sendOrientationChangeEvent on every WebFrame part of a WebView to be 113 // sendOrientationChangeEvent on every WebFrame part of a WebView to be
116 // able to remove this. 114 // able to remove this.
117 if (frame() == frame()->localFrameRoot() && m_orientation->angle() != curren tAngle) 115 if (frame() == frame()->localFrameRoot() && m_orientation->angle() != curren tAngle)
118 notifyOrientationChanged(); 116 notifyOrientationChanged();
119 } 117 }
120 118
121 void ScreenOrientationController::notifyOrientationChanged() 119 void ScreenOrientationController::notifyOrientationChanged()
122 { 120 {
123 ASSERT(RuntimeEnabledFeatures::screenOrientationEnabled());
124
125 if (!isActiveAndVisible()) 121 if (!isActiveAndVisible())
126 return; 122 return;
127 123
128 updateOrientation(); 124 updateOrientation();
129 125
130 // Keep track of the frames that need to be notified before notifying the 126 // Keep track of the frames that need to be notified before notifying the
131 // current frame as it will prevent side effects from the change event 127 // current frame as it will prevent side effects from the change event
132 // handlers. 128 // handlers.
133 HeapVector<Member<LocalFrame>> childFrames; 129 HeapVector<Member<LocalFrame>> childFrames;
134 for (Frame* child = frame()->tree().firstChild(); child; child = child->tree ().nextSibling()) { 130 for (Frame* child = frame()->tree().firstChild(); child; child = child->tree ().nextSibling()) {
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
216 212
217 DEFINE_TRACE(ScreenOrientationController) 213 DEFINE_TRACE(ScreenOrientationController)
218 { 214 {
219 visitor->trace(m_orientation); 215 visitor->trace(m_orientation);
220 LocalFrameLifecycleObserver::trace(visitor); 216 LocalFrameLifecycleObserver::trace(visitor);
221 Supplement<LocalFrame>::trace(visitor); 217 Supplement<LocalFrame>::trace(visitor);
222 PlatformEventController::trace(visitor); 218 PlatformEventController::trace(visitor);
223 } 219 }
224 220
225 } // namespace blink 221 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698