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

Unified Diff: Source/modules/screen_orientation/ScreenOrientationController.cpp

Issue 319633007: Move WebScreenOrientationClient to WebFrameClient. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: fix oilpan build Created 6 years, 6 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 side-by-side diff with in-line comments
Download patch
Index: Source/modules/screen_orientation/ScreenOrientationController.cpp
diff --git a/Source/modules/screen_orientation/ScreenOrientationController.cpp b/Source/modules/screen_orientation/ScreenOrientationController.cpp
index 65adbf279560cb2eac5f8f5658391f351098dcc8..78268bf7ae047b54e6d3354d24e871222982c1e1 100644
--- a/Source/modules/screen_orientation/ScreenOrientationController.cpp
+++ b/Source/modules/screen_orientation/ScreenOrientationController.cpp
@@ -22,21 +22,22 @@ ScreenOrientationController::~ScreenOrientationController()
{
}
-void ScreenOrientationController::provideTo(Page& page, blink::WebScreenOrientationClient* client)
+void ScreenOrientationController::provideTo(LocalFrame& frame, blink::WebScreenOrientationClient* client)
{
- ScreenOrientationController* controller = new ScreenOrientationController(page, client);
- WillBeHeapSupplement<Page>::provideTo(page, supplementName(), adoptPtrWillBeNoop(controller));
+ ScreenOrientationController* controller = new ScreenOrientationController(frame, client);
+ Supplement<LocalFrame>::provideTo(frame, supplementName(), adoptPtr(controller));
sof 2014/06/09 21:18:58 This is not going to work, OwnPtr<>'ing something
zerny-chromium 2014/06/10 11:43:42 Now that LocalFrame supplements are on-heap, this
}
-ScreenOrientationController& ScreenOrientationController::from(Page& page)
+ScreenOrientationController& ScreenOrientationController::from(LocalFrame& frame)
{
- return *static_cast<ScreenOrientationController*>(WillBeHeapSupplement<Page>::from(page, supplementName()));
+ return *static_cast<ScreenOrientationController*>(Supplement<LocalFrame>::from(frame, supplementName()));
zerny-chromium 2014/06/10 11:43:42 WillBeHeapSupplement<LocalFrame>
}
-ScreenOrientationController::ScreenOrientationController(Page& page, blink::WebScreenOrientationClient* client)
- : PageLifecycleObserver(&page)
+ScreenOrientationController::ScreenOrientationController(LocalFrame& frame, blink::WebScreenOrientationClient* client)
+ : PageLifecycleObserver(frame.page())
, m_overrideOrientation(blink::WebScreenOrientationUndefined)
, m_client(client)
+ , m_frame(frame)
{
}
@@ -77,9 +78,8 @@ void ScreenOrientationController::pageVisibilityChanged()
if (page() && page()->visibilityState() == PageVisibilityStateVisible) {
blink::WebScreenOrientationType oldOrientation = m_overrideOrientation;
m_overrideOrientation = blink::WebScreenOrientationUndefined;
- LocalFrame* mainFrame = page()->mainFrame();
- if (mainFrame && oldOrientation != orientation())
- mainFrame->sendOrientationChangeEvent();
+ if (oldOrientation != orientation())
+ m_frame.sendOrientationChangeEvent();
} else if (m_overrideOrientation == blink::WebScreenOrientationUndefined) {
// The page is no longer visible, store the last know screen orientation
// so that we keep returning this orientation until the page becomes
@@ -96,13 +96,10 @@ blink::WebScreenOrientationType ScreenOrientationController::orientation() const
return m_overrideOrientation;
}
- LocalFrame* mainFrame = page() ? page()->mainFrame() : 0;
- if (!mainFrame)
- return blink::WebScreenOrientationPortraitPrimary;
- blink::WebScreenOrientationType orientationType = screenOrientationType(mainFrame->view());
+ blink::WebScreenOrientationType orientationType = screenOrientationType(m_frame.view());
if (orientationType == blink::WebScreenOrientationUndefined) {
// The embedder could not provide us with an orientation, deduce it ourselves.
- orientationType = computeOrientation(mainFrame->view());
+ orientationType = computeOrientation(m_frame.view());
}
ASSERT(orientationType != blink::WebScreenOrientationUndefined);
return orientationType;

Powered by Google App Engine
This is Rietveld 408576698