<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[171188] trunk/Source/WebCore</title>
</head>
<body>
<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; }
#msg dl a { font-weight: bold}
#msg dl a:link { color:#fc3; }
#msg dl a:active { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://trac.webkit.org/projects/webkit/changeset/171188">171188</a></dd>
<dt>Author</dt> <dd>weinig@apple.com</dd>
<dt>Date</dt> <dd>2014-07-17 10:35:35 -0700 (Thu, 17 Jul 2014)</dd>
</dl>
<h3>Log Message</h3>
<pre>Don't send geolocation permission requests when the page is not visible
<rdar://problem/17208715>
https://bugs.webkit.org/show_bug.cgi?id=134989
Reviewed by Darin Adler.
Instead of eagerly requesting geolocation permission for pages that aren't visible,
store a set of pending requests, and send them only once the page has become visible.
* Modules/geolocation/GeolocationController.cpp:
(WebCore::GeolocationController::GeolocationController):
(WebCore::GeolocationController::~GeolocationController):
(WebCore::GeolocationController::requestPermission):
(WebCore::GeolocationController::cancelPermissionRequest):
(WebCore::GeolocationController::viewStateDidChange):
(WebCore::provideGeolocationTo):
* Modules/geolocation/GeolocationController.h:
Store pending requests to be fired once the page is visible.
* WebCore.xcodeproj/project.pbxproj:
Add ViewStateChangeObserver.h
* page/Page.cpp:
(WebCore::Page::addViewStateChangeObserver):
(WebCore::Page::removeViewStateChangeObserver):
(WebCore::Page::setViewState):
* page/Page.h:
Add a set of registered view state observers, and notify them when the
view state changes.
* page/ViewStateChangeObserver.h: Added.
(WebCore::ViewStateChangeObserver::~ViewStateChangeObserver):
Add an observer that can register with the page for view state changes.</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCoreModulesgeolocationGeolocationControllercpp">trunk/Source/WebCore/Modules/geolocation/GeolocationController.cpp</a></li>
<li><a href="#trunkSourceWebCoreModulesgeolocationGeolocationControllerh">trunk/Source/WebCore/Modules/geolocation/GeolocationController.h</a></li>
<li><a href="#trunkSourceWebCoreWebCorexcodeprojprojectpbxproj">trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj</a></li>
<li><a href="#trunkSourceWebCorepagePagecpp">trunk/Source/WebCore/page/Page.cpp</a></li>
<li><a href="#trunkSourceWebCorepagePageh">trunk/Source/WebCore/page/Page.h</a></li>
</ul>
<h3>Added Paths</h3>
<ul>
<li><a href="#trunkSourceWebCorepageViewStateChangeObserverh">trunk/Source/WebCore/page/ViewStateChangeObserver.h</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (171187 => 171188)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2014-07-17 17:33:37 UTC (rev 171187)
+++ trunk/Source/WebCore/ChangeLog        2014-07-17 17:35:35 UTC (rev 171188)
</span><span class="lines">@@ -1,3 +1,39 @@
</span><ins>+2014-07-16 Sam Weinig <sam@webkit.org>
+
+ Don't send geolocation permission requests when the page is not visible
+ <rdar://problem/17208715>
+ https://bugs.webkit.org/show_bug.cgi?id=134989
+
+ Reviewed by Darin Adler.
+
+ Instead of eagerly requesting geolocation permission for pages that aren't visible,
+ store a set of pending requests, and send them only once the page has become visible.
+
+ * Modules/geolocation/GeolocationController.cpp:
+ (WebCore::GeolocationController::GeolocationController):
+ (WebCore::GeolocationController::~GeolocationController):
+ (WebCore::GeolocationController::requestPermission):
+ (WebCore::GeolocationController::cancelPermissionRequest):
+ (WebCore::GeolocationController::viewStateDidChange):
+ (WebCore::provideGeolocationTo):
+ * Modules/geolocation/GeolocationController.h:
+ Store pending requests to be fired once the page is visible.
+
+ * WebCore.xcodeproj/project.pbxproj:
+ Add ViewStateChangeObserver.h
+
+ * page/Page.cpp:
+ (WebCore::Page::addViewStateChangeObserver):
+ (WebCore::Page::removeViewStateChangeObserver):
+ (WebCore::Page::setViewState):
+ * page/Page.h:
+ Add a set of registered view state observers, and notify them when the
+ view state changes.
+
+ * page/ViewStateChangeObserver.h: Added.
+ (WebCore::ViewStateChangeObserver::~ViewStateChangeObserver):
+ Add an observer that can register with the page for view state changes.
+
</ins><span class="cx"> 2014-07-17 Jer Noble <jer.noble@apple.com>
</span><span class="cx">
</span><span class="cx"> Enable legacy fullscreen API in media controls
</span></span></pre></div>
<a id="trunkSourceWebCoreModulesgeolocationGeolocationControllercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/geolocation/GeolocationController.cpp (171187 => 171188)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/geolocation/GeolocationController.cpp        2014-07-17 17:33:37 UTC (rev 171187)
+++ trunk/Source/WebCore/Modules/geolocation/GeolocationController.cpp        2014-07-17 17:35:35 UTC (rev 171188)
</span><span class="lines">@@ -34,15 +34,21 @@
</span><span class="cx">
</span><span class="cx"> namespace WebCore {
</span><span class="cx">
</span><del>-GeolocationController::GeolocationController(GeolocationClient* client)
- : m_client(client)
</del><ins>+GeolocationController::GeolocationController(Page& page, GeolocationClient* client)
+ : m_page(page)
+ , m_client(client)
</ins><span class="cx"> {
</span><ins>+ m_page.addViewStateChangeObserver(*this);
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> GeolocationController::~GeolocationController()
</span><span class="cx"> {
</span><span class="cx"> ASSERT(m_observers.isEmpty());
</span><span class="cx">
</span><ins>+ // NOTE: We don't have to remove ourselves from page's ViewStateChangeObserver set, since
+ // we are supplement of the Page, and our destructor getting called means the page is being
+ // torn down.
+
</ins><span class="cx"> if (m_client)
</span><span class="cx"> m_client->geolocationDestroyed();
</span><span class="cx"> }
</span><span class="lines">@@ -82,12 +88,20 @@
</span><span class="cx">
</span><span class="cx"> void GeolocationController::requestPermission(Geolocation* geolocation)
</span><span class="cx"> {
</span><ins>+ if (!m_page.isVisible()) {
+ m_pendedPermissionRequest.add(geolocation);
+ return;
+ }
+
</ins><span class="cx"> if (m_client)
</span><span class="cx"> m_client->requestPermission(geolocation);
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> void GeolocationController::cancelPermissionRequest(Geolocation* geolocation)
</span><span class="cx"> {
</span><ins>+ if (m_pendedPermissionRequest.remove(geolocation))
+ return;
+
</ins><span class="cx"> if (m_client)
</span><span class="cx"> m_client->cancelPermissionRequest(geolocation);
</span><span class="cx"> }
</span><span class="lines">@@ -120,6 +134,16 @@
</span><span class="cx"> return m_client->lastPosition();
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+void GeolocationController::viewStateDidChange(ViewState::Flags, ViewState::Flags)
+{
+ if (!m_page.isVisible())
+ return;
+
+ HashSet<RefPtr<Geolocation>> pendedPermissionRequests = WTF::move(m_pendedPermissionRequest);
+ for (auto& permissionRequest : pendedPermissionRequests)
+ m_client->requestPermission(permissionRequest.get());
+}
+
</ins><span class="cx"> const char* GeolocationController::supplementName()
</span><span class="cx"> {
</span><span class="cx"> return "GeolocationController";
</span><span class="lines">@@ -127,7 +151,7 @@
</span><span class="cx">
</span><span class="cx"> void provideGeolocationTo(Page* page, GeolocationClient* client)
</span><span class="cx"> {
</span><del>- Supplement<Page>::provideTo(page, GeolocationController::supplementName(), std::make_unique<GeolocationController>(client));
</del><ins>+ Supplement<Page>::provideTo(page, GeolocationController::supplementName(), std::make_unique<GeolocationController>(*page, client));
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> } // namespace WebCore
</span></span></pre></div>
<a id="trunkSourceWebCoreModulesgeolocationGeolocationControllerh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/geolocation/GeolocationController.h (171187 => 171188)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/geolocation/GeolocationController.h        2014-07-17 17:33:37 UTC (rev 171187)
+++ trunk/Source/WebCore/Modules/geolocation/GeolocationController.h        2014-07-17 17:35:35 UTC (rev 171188)
</span><span class="lines">@@ -30,6 +30,7 @@
</span><span class="cx">
</span><span class="cx"> #include "Geolocation.h"
</span><span class="cx"> #include "Page.h"
</span><ins>+#include "ViewStateChangeObserver.h"
</ins><span class="cx"> #include <wtf/HashSet.h>
</span><span class="cx"> #include <wtf/Noncopyable.h>
</span><span class="cx"> #include <wtf/RefPtr.h>
</span><span class="lines">@@ -41,10 +42,10 @@
</span><span class="cx"> class GeolocationPosition;
</span><span class="cx"> class Page;
</span><span class="cx">
</span><del>-class GeolocationController : public Supplement<Page> {
</del><ins>+class GeolocationController : public Supplement<Page>, private ViewStateChangeObserver {
</ins><span class="cx"> WTF_MAKE_NONCOPYABLE(GeolocationController);
</span><span class="cx"> public:
</span><del>- explicit GeolocationController(GeolocationClient*);
</del><ins>+ explicit GeolocationController(Page&, GeolocationClient*);
</ins><span class="cx"> ~GeolocationController();
</span><span class="cx">
</span><span class="cx"> void addObserver(Geolocation*, bool enableHighAccuracy);
</span><span class="lines">@@ -64,13 +65,20 @@
</span><span class="cx"> static GeolocationController* from(Page* page) { return static_cast<GeolocationController*>(Supplement<Page>::from(page, supplementName())); }
</span><span class="cx">
</span><span class="cx"> private:
</span><ins>+ Page& m_page;
</ins><span class="cx"> GeolocationClient* m_client;
</span><span class="cx">
</span><ins>+ virtual void viewStateDidChange(ViewState::Flags oldViewState, ViewState::Flags newViewState) override;
+
</ins><span class="cx"> RefPtr<GeolocationPosition> m_lastPosition;
</span><ins>+
</ins><span class="cx"> typedef HashSet<RefPtr<Geolocation>> ObserversSet;
</span><span class="cx"> // All observers; both those requesting high accuracy and those not.
</span><span class="cx"> ObserversSet m_observers;
</span><span class="cx"> ObserversSet m_highAccuracyObservers;
</span><ins>+
+ // While the page is not visible, we pend permission requests.
+ HashSet<RefPtr<Geolocation>> m_pendedPermissionRequest;
</ins><span class="cx"> };
</span><span class="cx">
</span><span class="cx"> } // namespace WebCore
</span></span></pre></div>
<a id="trunkSourceWebCoreWebCorexcodeprojprojectpbxproj"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj (171187 => 171188)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj        2014-07-17 17:33:37 UTC (rev 171187)
+++ trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj        2014-07-17 17:35:35 UTC (rev 171188)
</span><span class="lines">@@ -2425,6 +2425,7 @@
</span><span class="cx">                 7CC69940191EC5F500AF2270 /* JSWebKitNamespace.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7CC6993E191EC5F500AF2270 /* JSWebKitNamespace.cpp */; };
</span><span class="cx">                 7CC69941191EC5F500AF2270 /* JSWebKitNamespace.h in Headers */ = {isa = PBXBuildFile; fileRef = 7CC6993F191EC5F500AF2270 /* JSWebKitNamespace.h */; };
</span><span class="cx">                 7CC7E3D717208C0F003C5277 /* IDNScriptWhiteList.txt in Resources */ = {isa = PBXBuildFile; fileRef = 7CC7E3D617208C0F003C5277 /* IDNScriptWhiteList.txt */; };
</span><ins>+                7CDEEE1E197610D700E352CD /* ViewStateChangeObserver.h in Headers */ = {isa = PBXBuildFile; fileRef = 7CDEEE1D197610D700E352CD /* ViewStateChangeObserver.h */; settings = {ATTRIBUTES = (Private, ); }; };
</ins><span class="cx">                 7CE68344192143A800F4D928 /* UserMessageHandlerDescriptor.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7CE68342192143A800F4D928 /* UserMessageHandlerDescriptor.cpp */; };
</span><span class="cx">                 7CE68345192143A800F4D928 /* UserMessageHandlerDescriptor.h in Headers */ = {isa = PBXBuildFile; fileRef = 7CE68343192143A800F4D928 /* UserMessageHandlerDescriptor.h */; settings = {ATTRIBUTES = (Private, ); }; };
</span><span class="cx">                 7CE683471921821500F4D928 /* UserMessageHandlerDescriptorTypes.h in Headers */ = {isa = PBXBuildFile; fileRef = 7CE683461921821500F4D928 /* UserMessageHandlerDescriptorTypes.h */; settings = {ATTRIBUTES = (Private, ); }; };
</span><span class="lines">@@ -9581,6 +9582,7 @@
</span><span class="cx">                 7CC6993E191EC5F500AF2270 /* JSWebKitNamespace.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSWebKitNamespace.cpp; sourceTree = "<group>"; };
</span><span class="cx">                 7CC6993F191EC5F500AF2270 /* JSWebKitNamespace.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSWebKitNamespace.h; sourceTree = "<group>"; };
</span><span class="cx">                 7CC7E3D617208C0F003C5277 /* IDNScriptWhiteList.txt */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = IDNScriptWhiteList.txt; sourceTree = "<group>"; };
</span><ins>+                7CDEEE1D197610D700E352CD /* ViewStateChangeObserver.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ViewStateChangeObserver.h; sourceTree = "<group>"; };
</ins><span class="cx">                 7CE68342192143A800F4D928 /* UserMessageHandlerDescriptor.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = UserMessageHandlerDescriptor.cpp; sourceTree = "<group>"; };
</span><span class="cx">                 7CE68343192143A800F4D928 /* UserMessageHandlerDescriptor.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = UserMessageHandlerDescriptor.h; sourceTree = "<group>"; };
</span><span class="cx">                 7CE683461921821500F4D928 /* UserMessageHandlerDescriptorTypes.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = UserMessageHandlerDescriptorTypes.h; sourceTree = "<group>"; };
</span><span class="lines">@@ -16716,6 +16718,7 @@
</span><span class="cx">                                 E1271A130EEEC80400F61213 /* WorkerNavigator.cpp */,
</span><span class="cx">                                 E1271A0A0EEEC77A00F61213 /* WorkerNavigator.h */,
</span><span class="cx">                                 E1271A510EEECD1C00F61213 /* WorkerNavigator.idl */,
</span><ins>+                                7CDEEE1D197610D700E352CD /* ViewStateChangeObserver.h */,
</ins><span class="cx">                         );
</span><span class="cx">                         path = page;
</span><span class="cx">                         sourceTree = "<group>";
</span><span class="lines">@@ -26289,6 +26292,7 @@
</span><span class="cx">                                 B2227AB80D00BF220071B782 /* SVGStyleElement.h in Headers */,
</span><span class="cx">                                 B2227ABB0D00BF220071B782 /* SVGSVGElement.h in Headers */,
</span><span class="cx">                                 B2227ABE0D00BF220071B782 /* SVGSwitchElement.h in Headers */,
</span><ins>+                                7CDEEE1E197610D700E352CD /* ViewStateChangeObserver.h in Headers */,
</ins><span class="cx">                                 B2227AC10D00BF220071B782 /* SVGSymbolElement.h in Headers */,
</span><span class="cx">                                 B2227AC50D00BF220071B782 /* SVGTests.h in Headers */,
</span><span class="cx">                                 08F0BFC31255C53C00075185 /* SVGTextChunk.h in Headers */,
</span></span></pre></div>
<a id="trunkSourceWebCorepagePagecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/page/Page.cpp (171187 => 171188)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/page/Page.cpp        2014-07-17 17:33:37 UTC (rev 171187)
+++ trunk/Source/WebCore/page/Page.cpp        2014-07-17 17:35:35 UTC (rev 171188)
</span><span class="lines">@@ -83,6 +83,7 @@
</span><span class="cx"> #include "TextResourceDecoder.h"
</span><span class="cx"> #include "UserContentController.h"
</span><span class="cx"> #include "UserInputBridge.h"
</span><ins>+#include "ViewStateChangeObserver.h"
</ins><span class="cx"> #include "VisitedLinkState.h"
</span><span class="cx"> #include "VisitedLinkStore.h"
</span><span class="cx"> #include "VoidCallback.h"
</span><span class="lines">@@ -901,6 +902,16 @@
</span><span class="cx"> resumeAnimatingImages();
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+void Page::addViewStateChangeObserver(ViewStateChangeObserver& observer)
+{
+ m_viewStateChangeObservers.add(&observer);
+}
+
+void Page::removeViewStateChangeObserver(ViewStateChangeObserver& observer)
+{
+ m_viewStateChangeObservers.remove(&observer);
+}
+
</ins><span class="cx"> void Page::suspendScriptedAnimations()
</span><span class="cx"> {
</span><span class="cx"> m_scriptedAnimationsSuspended = true;
</span><span class="lines">@@ -1196,6 +1207,8 @@
</span><span class="cx"> if (!changed)
</span><span class="cx"> return;
</span><span class="cx">
</span><ins>+ ViewState::Flags oldViewState = m_viewState;
+
</ins><span class="cx"> m_viewState = viewState;
</span><span class="cx"> m_focusController->setViewState(viewState);
</span><span class="cx"> if (m_pageThrottler)
</span><span class="lines">@@ -1207,6 +1220,9 @@
</span><span class="cx"> setIsInWindowInternal(viewState & ViewState::IsInWindow);
</span><span class="cx"> if (changed & ViewState::IsVisuallyIdle)
</span><span class="cx"> setIsVisuallyIdleInternal(viewState & ViewState::IsVisuallyIdle);
</span><ins>+
+ for (auto* observer : m_viewStateChangeObservers)
+ observer->viewStateDidChange(oldViewState, m_viewState);
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> void Page::setIsVisible(bool isVisible)
</span></span></pre></div>
<a id="trunkSourceWebCorepagePageh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/page/Page.h (171187 => 171188)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/page/Page.h        2014-07-17 17:33:37 UTC (rev 171187)
+++ trunk/Source/WebCore/page/Page.h        2014-07-17 17:35:35 UTC (rev 171188)
</span><span class="lines">@@ -102,6 +102,7 @@
</span><span class="cx"> class StorageNamespace;
</span><span class="cx"> class UserContentController;
</span><span class="cx"> class ValidationMessageClient;
</span><ins>+class ViewStateChangeObserver;
</ins><span class="cx"> class VisitedLinkStore;
</span><span class="cx">
</span><span class="cx"> typedef uint64_t LinkHash;
</span><span class="lines">@@ -319,6 +320,9 @@
</span><span class="cx"> void setIsInWindow(bool);
</span><span class="cx"> bool isInWindow() const { return m_viewState & ViewState::IsInWindow; }
</span><span class="cx">
</span><ins>+ void addViewStateChangeObserver(ViewStateChangeObserver&);
+ void removeViewStateChangeObserver(ViewStateChangeObserver&);
+
</ins><span class="cx"> void suspendScriptedAnimations();
</span><span class="cx"> void resumeScriptedAnimations();
</span><span class="cx"> bool scriptedAnimationsSuspended() const { return m_scriptedAnimationsSuspended; }
</span><span class="lines">@@ -578,6 +582,8 @@
</span><span class="cx"> RefPtr<UserContentController> m_userContentController;
</span><span class="cx"> RefPtr<VisitedLinkStore> m_visitedLinkStore;
</span><span class="cx">
</span><ins>+ HashSet<ViewStateChangeObserver*> m_viewStateChangeObservers;
+
</ins><span class="cx"> SessionID m_sessionID;
</span><span class="cx"> };
</span><span class="cx">
</span></span></pre></div>
<a id="trunkSourceWebCorepageViewStateChangeObserverh"></a>
<div class="addfile"><h4>Added: trunk/Source/WebCore/page/ViewStateChangeObserver.h (0 => 171188)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/page/ViewStateChangeObserver.h         (rev 0)
+++ trunk/Source/WebCore/page/ViewStateChangeObserver.h        2014-07-17 17:35:35 UTC (rev 171188)
</span><span class="lines">@@ -0,0 +1,44 @@
</span><ins>+/*
+ * Copyright (C) 2014 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef ViewStateChangeObserver_h
+#define ViewStateChangeObserver_h
+
+#include "ViewState.h"
+
+namespace WebCore {
+
+class ViewStateChangeObserver {
+public:
+ virtual ~ViewStateChangeObserver()
+ {
+ }
+
+ virtual void viewStateDidChange(ViewState::Flags oldViewState, ViewState::Flags newViewState) = 0;
+};
+
+} // namespace WebCore
+
+#endif // ViewStateChangeObserver_h
</ins></span></pre>
</div>
</div>
</body>
</html>