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

Side by Side Diff: Source/web/FullscreenController.cpp

Issue 171333003: Pass implementation object to supplemental classes by reference (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Rebase Created 6 years, 10 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 | Annotate | Revision Log
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2013 Google Inc. All rights reserved. 2 * Copyright (C) 2013 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
58 } 58 }
59 59
60 void FullscreenController::willEnterFullScreen() 60 void FullscreenController::willEnterFullScreen()
61 { 61 {
62 if (!m_provisionalFullScreenElement) 62 if (!m_provisionalFullScreenElement)
63 return; 63 return;
64 64
65 // Ensure that this element's document is still attached. 65 // Ensure that this element's document is still attached.
66 Document& doc = m_provisionalFullScreenElement->document(); 66 Document& doc = m_provisionalFullScreenElement->document();
67 if (doc.frame()) { 67 if (doc.frame()) {
68 FullscreenElementStack::from(&doc)->webkitWillEnterFullScreenForElement( m_provisionalFullScreenElement.get()); 68 FullscreenElementStack::from(doc).webkitWillEnterFullScreenForElement(m_ provisionalFullScreenElement.get());
69 m_fullScreenFrame = doc.frame(); 69 m_fullScreenFrame = doc.frame();
70 } 70 }
71 m_provisionalFullScreenElement.clear(); 71 m_provisionalFullScreenElement.clear();
72 } 72 }
73 73
74 void FullscreenController::didEnterFullScreen() 74 void FullscreenController::didEnterFullScreen()
75 { 75 {
76 if (!m_fullScreenFrame) 76 if (!m_fullScreenFrame)
77 return; 77 return;
78 78
79 if (Document* doc = m_fullScreenFrame->document()) { 79 if (Document* doc = m_fullScreenFrame->document()) {
80 if (FullscreenElementStack::isFullScreen(doc)) { 80 if (FullscreenElementStack::isFullScreen(*doc)) {
81 if (!m_exitFullscreenPageScaleFactor) { 81 if (!m_exitFullscreenPageScaleFactor) {
82 m_exitFullscreenPageScaleFactor = m_webViewImpl->pageScaleFactor (); 82 m_exitFullscreenPageScaleFactor = m_webViewImpl->pageScaleFactor ();
83 m_exitFullscreenScrollOffset = m_webViewImpl->mainFrame()->scrol lOffset(); 83 m_exitFullscreenScrollOffset = m_webViewImpl->mainFrame()->scrol lOffset();
84 m_webViewImpl->setPageScaleFactorPreservingScrollOffset(1.0f); 84 m_webViewImpl->setPageScaleFactorPreservingScrollOffset(1.0f);
85 } 85 }
86 86
87 FullscreenElementStack::from(doc)->webkitDidEnterFullScreenForElemen t(0); 87 FullscreenElementStack::from(*doc).webkitDidEnterFullScreenForElemen t(0);
88 if (RuntimeEnabledFeatures::overlayFullscreenVideoEnabled()) { 88 if (RuntimeEnabledFeatures::overlayFullscreenVideoEnabled()) {
89 Element* element = FullscreenElementStack::currentFullScreenElem entFrom(doc); 89 Element* element = FullscreenElementStack::currentFullScreenElem entFrom(*doc);
90 ASSERT(element); 90 ASSERT(element);
91 if (element->isMediaElement() && m_webViewImpl->layerTreeView()) 91 if (element->isMediaElement() && m_webViewImpl->layerTreeView())
92 m_webViewImpl->layerTreeView()->setHasTransparentBackground( true); 92 m_webViewImpl->layerTreeView()->setHasTransparentBackground( true);
93 } 93 }
94 } 94 }
95 } 95 }
96 } 96 }
97 97
98 void FullscreenController::willExitFullScreen() 98 void FullscreenController::willExitFullScreen()
99 { 99 {
100 if (!m_fullScreenFrame) 100 if (!m_fullScreenFrame)
101 return; 101 return;
102 102
103 if (Document* doc = m_fullScreenFrame->document()) { 103 if (Document* doc = m_fullScreenFrame->document()) {
104 FullscreenElementStack* fullscreen = FullscreenElementStack::fromIfExist s(doc); 104 FullscreenElementStack* fullscreen = FullscreenElementStack::fromIfExist s(*doc);
105 if (!fullscreen) 105 if (!fullscreen)
106 return; 106 return;
107 if (fullscreen->isFullScreen(doc)) { 107 if (fullscreen->isFullScreen(*doc)) {
108 // When the client exits from full screen we have to call webkitCanc elFullScreen to 108 // When the client exits from full screen we have to call webkitCanc elFullScreen to
109 // notify the document. While doing that, suppress notifications bac k to the client. 109 // notify the document. While doing that, suppress notifications bac k to the client.
110 m_isCancelingFullScreen = true; 110 m_isCancelingFullScreen = true;
111 fullscreen->webkitCancelFullScreen(); 111 fullscreen->webkitCancelFullScreen();
112 m_isCancelingFullScreen = false; 112 m_isCancelingFullScreen = false;
113 fullscreen->webkitWillExitFullScreenForElement(0); 113 fullscreen->webkitWillExitFullScreenForElement(0);
114 if (RuntimeEnabledFeatures::overlayFullscreenVideoEnabled() && m_web ViewImpl->layerTreeView()) 114 if (RuntimeEnabledFeatures::overlayFullscreenVideoEnabled() && m_web ViewImpl->layerTreeView())
115 m_webViewImpl->layerTreeView()->setHasTransparentBackground(m_we bViewImpl->isTransparent()); 115 m_webViewImpl->layerTreeView()->setHasTransparentBackground(m_we bViewImpl->isTransparent());
116 } 116 }
117 } 117 }
118 } 118 }
119 119
120 void FullscreenController::didExitFullScreen() 120 void FullscreenController::didExitFullScreen()
121 { 121 {
122 if (!m_fullScreenFrame) 122 if (!m_fullScreenFrame)
123 return; 123 return;
124 124
125 if (Document* doc = m_fullScreenFrame->document()) { 125 if (Document* doc = m_fullScreenFrame->document()) {
126 if (FullscreenElementStack* fullscreen = FullscreenElementStack::fromIfE xists(doc)) { 126 if (FullscreenElementStack* fullscreen = FullscreenElementStack::fromIfE xists(*doc)) {
127 if (fullscreen->webkitIsFullScreen()) { 127 if (fullscreen->webkitIsFullScreen()) {
128 if (m_exitFullscreenPageScaleFactor) { 128 if (m_exitFullscreenPageScaleFactor) {
129 m_webViewImpl->setPageScaleFactor(m_exitFullscreenPageScaleF actor, 129 m_webViewImpl->setPageScaleFactor(m_exitFullscreenPageScaleF actor,
130 WebPoint(m_exitFullscreenScrollOffset.width(), m_exitFul lscreenScrollOffset.height())); 130 WebPoint(m_exitFullscreenScrollOffset.width(), m_exitFul lscreenScrollOffset.height()));
131 m_exitFullscreenPageScaleFactor = 0; 131 m_exitFullscreenPageScaleFactor = 0;
132 m_exitFullscreenScrollOffset = IntSize(); 132 m_exitFullscreenScrollOffset = IntSize();
133 } 133 }
134 134
135 fullscreen->webkitDidExitFullScreenForElement(0); 135 fullscreen->webkitDidExitFullScreenForElement(0);
136 } 136 }
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
188 if (mediaElement->player()) 188 if (mediaElement->player())
189 mediaElement->player()->hideFullscreenOverlay(); 189 mediaElement->player()->hideFullscreenOverlay();
190 return; 190 return;
191 } 191 }
192 if (WebViewClient* client = m_webViewImpl->client()) 192 if (WebViewClient* client = m_webViewImpl->client())
193 client->exitFullScreen(); 193 client->exitFullScreen();
194 } 194 }
195 195
196 } 196 }
197 197
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698