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); |