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

Unified Diff: Source/modules/gamepad/NavigatorGamepad.cpp

Issue 332183009: Notify the browser when the page lost interest about gamepads (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: gamepads||webkitGamepads 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
« no previous file with comments | « Source/modules/gamepad/NavigatorGamepad.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/modules/gamepad/NavigatorGamepad.cpp
diff --git a/Source/modules/gamepad/NavigatorGamepad.cpp b/Source/modules/gamepad/NavigatorGamepad.cpp
index 0b39cea0a4775edb93e83c9af4196c9516b2f78a..6333946be8a506ee5138fe2e9e63869afac7b3f6 100644
--- a/Source/modules/gamepad/NavigatorGamepad.cpp
+++ b/Source/modules/gamepad/NavigatorGamepad.cpp
@@ -228,4 +228,13 @@ void NavigatorGamepad::didRemoveAllEventListeners(LocalDOMWindow*)
m_hasEventListener = false;
}
+void NavigatorGamepad::pageVisibilityChanged()
+{
+ // Inform the embedder whether it needs to provide gamepad data for us.
+ if (page()->visibilityState() == PageVisibilityStateVisible && (m_hasEventListener || m_gamepads || m_webkitGamepads))
+ startUpdating();
+ else
+ stopUpdating();
+}
+
} // namespace WebCore
« no previous file with comments | « Source/modules/gamepad/NavigatorGamepad.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698