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

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

Issue 2716153003: Removed FrameHost::chromeClient() (Closed)
Patch Set: Small feedback Created 3 years, 9 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/ScreenOrientationControllerImpl.h" 5 #include "modules/screen_orientation/ScreenOrientationControllerImpl.h"
6 6
7 #include "core/dom/Document.h" 7 #include "core/dom/Document.h"
8 #include "core/dom/TaskRunnerHelper.h" 8 #include "core/dom/TaskRunnerHelper.h"
9 #include "core/events/Event.h" 9 #include "core/events/Event.h"
10 #include "core/frame/FrameHost.h"
11 #include "core/frame/FrameView.h" 10 #include "core/frame/FrameView.h"
12 #include "core/frame/LocalFrame.h" 11 #include "core/frame/LocalFrame.h"
13 #include "core/page/ChromeClient.h" 12 #include "core/page/ChromeClient.h"
14 #include "core/page/Page.h" 13 #include "core/page/Page.h"
15 #include "modules/screen_orientation/ScreenOrientation.h" 14 #include "modules/screen_orientation/ScreenOrientation.h"
16 #include "modules/screen_orientation/ScreenOrientationDispatcher.h" 15 #include "modules/screen_orientation/ScreenOrientationDispatcher.h"
17 #include "platform/LayoutTestSupport.h" 16 #include "platform/LayoutTestSupport.h"
18 #include "platform/ScopedOrientationChangeIndicator.h" 17 #include "platform/ScopedOrientationChangeIndicator.h"
19 #include "public/platform/WebScreenInfo.h" 18 #include "public/platform/WebScreenInfo.h"
20 #include "public/platform/modules/screen_orientation/WebScreenOrientationClient. h" 19 #include "public/platform/modules/screen_orientation/WebScreenOrientationClient. h"
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
78 : WebScreenOrientationPortraitPrimary; 77 : WebScreenOrientationPortraitPrimary;
79 default: 78 default:
80 NOTREACHED(); 79 NOTREACHED();
81 return WebScreenOrientationPortraitPrimary; 80 return WebScreenOrientationPortraitPrimary;
82 } 81 }
83 } 82 }
84 83
85 void ScreenOrientationControllerImpl::updateOrientation() { 84 void ScreenOrientationControllerImpl::updateOrientation() {
86 DCHECK(m_orientation); 85 DCHECK(m_orientation);
87 DCHECK(frame()); 86 DCHECK(frame());
88 DCHECK(frame()->host()); 87 DCHECK(frame()->page());
89 ChromeClient& chromeClient = frame()->host()->chromeClient(); 88 ChromeClient& chromeClient = frame()->page()->chromeClient();
90 WebScreenInfo screenInfo = chromeClient.screenInfo(); 89 WebScreenInfo screenInfo = chromeClient.screenInfo();
91 WebScreenOrientationType orientationType = screenInfo.orientationType; 90 WebScreenOrientationType orientationType = screenInfo.orientationType;
92 if (orientationType == WebScreenOrientationUndefined) { 91 if (orientationType == WebScreenOrientationUndefined) {
93 // The embedder could not provide us with an orientation, deduce it 92 // The embedder could not provide us with an orientation, deduce it
94 // ourselves. 93 // ourselves.
95 orientationType = computeOrientation(chromeClient.screenInfo().rect, 94 orientationType = computeOrientation(chromeClient.screenInfo().rect,
96 screenInfo.orientationAngle); 95 screenInfo.orientationAngle);
97 } 96 }
98 DCHECK(orientationType != WebScreenOrientationUndefined); 97 DCHECK(orientationType != WebScreenOrientationUndefined);
99 98
(...skipping 13 matching lines...) Expand all
113 return isActive() && isVisible(); 112 return isActive() && isVisible();
114 } 113 }
115 114
116 void ScreenOrientationControllerImpl::pageVisibilityChanged() { 115 void ScreenOrientationControllerImpl::pageVisibilityChanged() {
117 notifyDispatcher(); 116 notifyDispatcher();
118 117
119 if (!isActiveAndVisible()) 118 if (!isActiveAndVisible())
120 return; 119 return;
121 120
122 DCHECK(frame()); 121 DCHECK(frame());
123 DCHECK(frame()->host()); 122 DCHECK(frame()->page());
124 123
125 // The orientation type and angle are tied in a way that if the angle has 124 // The orientation type and angle are tied in a way that if the angle has
126 // changed, the type must have changed. 125 // changed, the type must have changed.
127 unsigned short currentAngle = 126 unsigned short currentAngle =
128 frame()->host()->chromeClient().screenInfo().orientationAngle; 127 frame()->page()->chromeClient().screenInfo().orientationAngle;
129 128
130 // FIXME: sendOrientationChangeEvent() currently send an event all the 129 // FIXME: sendOrientationChangeEvent() currently send an event all the
131 // children of the frame, so it should only be called on the frame on 130 // children of the frame, so it should only be called on the frame on
132 // top of the tree. We would need the embedder to call 131 // top of the tree. We would need the embedder to call
133 // sendOrientationChangeEvent on every WebFrame part of a WebView to be 132 // sendOrientationChangeEvent on every WebFrame part of a WebView to be
134 // able to remove this. 133 // able to remove this.
135 if (frame() == frame()->localFrameRoot() && 134 if (frame() == frame()->localFrameRoot() &&
136 m_orientation->angle() != currentAngle) 135 m_orientation->angle() != currentAngle)
137 notifyOrientationChanged(); 136 notifyOrientationChanged();
138 } 137 }
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
235 } 234 }
236 235
237 DEFINE_TRACE(ScreenOrientationControllerImpl) { 236 DEFINE_TRACE(ScreenOrientationControllerImpl) {
238 visitor->trace(m_orientation); 237 visitor->trace(m_orientation);
239 ContextLifecycleObserver::trace(visitor); 238 ContextLifecycleObserver::trace(visitor);
240 Supplement<LocalFrame>::trace(visitor); 239 Supplement<LocalFrame>::trace(visitor);
241 PlatformEventController::trace(visitor); 240 PlatformEventController::trace(visitor);
242 } 241 }
243 242
244 } // namespace blink 243 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/svg/SVGAElement.cpp ('k') | third_party/WebKit/Source/web/InspectorOverlay.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698