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

Side by Side 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 unified diff | Download patch
« no previous file with comments | « Source/modules/gamepad/NavigatorGamepad.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2011, Google Inc. All rights reserved. 2 * Copyright (C) 2011, 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 met: 5 * modification, are permitted provided that the following conditions are met:
6 * 6 *
7 * 1. Redistributions of source code must retain the above copyright 7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright 9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
(...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after
221 && !window->hasEventListeners(EventTypeNames::gamepaddisconnected)) { 221 && !window->hasEventListeners(EventTypeNames::gamepaddisconnected)) {
222 m_hasEventListener = false; 222 m_hasEventListener = false;
223 } 223 }
224 } 224 }
225 225
226 void NavigatorGamepad::didRemoveAllEventListeners(LocalDOMWindow*) 226 void NavigatorGamepad::didRemoveAllEventListeners(LocalDOMWindow*)
227 { 227 {
228 m_hasEventListener = false; 228 m_hasEventListener = false;
229 } 229 }
230 230
231 void NavigatorGamepad::pageVisibilityChanged()
232 {
233 // Inform the embedder whether it needs to provide gamepad data for us.
234 if (page()->visibilityState() == PageVisibilityStateVisible && (m_hasEventLi stener || m_gamepads || m_webkitGamepads))
235 startUpdating();
236 else
237 stopUpdating();
238 }
239
231 } // namespace WebCore 240 } // namespace WebCore
OLDNEW
« 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