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

Unified Diff: third_party/WebKit/Source/core/dom/Fullscreen.cpp

Issue 2411553003: Notify WebMediaPlayer when its ancestor enters/exists fullscreen. (Closed)
Patch Set: Rebased. Add FullscreenObserver. Created 4 years, 2 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: third_party/WebKit/Source/core/dom/Fullscreen.cpp
diff --git a/third_party/WebKit/Source/core/dom/Fullscreen.cpp b/third_party/WebKit/Source/core/dom/Fullscreen.cpp
index f30793ebf893232c84067a756b252a75473c91a3..ebd0e7aa75fa7cd856fd155aa7777e682a242ef9 100644
--- a/third_party/WebKit/Source/core/dom/Fullscreen.cpp
+++ b/third_party/WebKit/Source/core/dom/Fullscreen.cpp
@@ -570,6 +570,9 @@ void Fullscreen::didEnterFullscreenForElement(Element* element) {
if (document()->frame())
document()->frame()->eventHandler().scheduleHoverStateUpdate();
+ for (FullscreenObserver* observer : m_observers)
+ observer->onEnteredFullscreen();
+
m_eventQueueTimer.startOneShot(0, BLINK_FROM_HERE);
}
@@ -608,6 +611,9 @@ void Fullscreen::didExitFullscreen() {
from(*exitingDocument).m_eventQueueTimer.startOneShot(0, BLINK_FROM_HERE);
m_forCrossProcessDescendant = false;
+
+ for (FullscreenObserver* observer : m_observers)
+ observer->onExitedFullscreen();
}
void Fullscreen::setFullScreenLayoutObject(LayoutFullScreen* layoutObject) {
@@ -725,6 +731,18 @@ void Fullscreen::pushFullscreenElementStack(Element& element,
m_fullscreenElementStack.append(std::make_pair(&element, requestType));
}
+void Fullscreen::registerObserver(FullscreenObserver* observer) {
+ if (m_observers.find(observer) != m_observers.end())
+ return;
+ m_observers.insert(observer);
+}
+
+void Fullscreen::removeObserver(FullscreenObserver* observer) {
+ if (m_observers.find(observer) == m_observers.end())
+ return;
+ m_observers.erase(observer);
+}
+
DEFINE_TRACE(Fullscreen) {
visitor->trace(m_currentFullScreenElement);
visitor->trace(m_fullscreenElementStack);
« no previous file with comments | « third_party/WebKit/Source/core/dom/Fullscreen.h ('k') | third_party/WebKit/Source/core/html/HTMLMediaElement.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698