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

Side by Side Diff: Source/modules/gamepad/NavigatorGamepad.cpp

Issue 560653002: Remove GamePad runtime flag(status=stable) (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years, 3 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
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 206 matching lines...) Expand 10 before | Expand all | Expand 10 after
217 return false; 217 return false;
218 } 218 }
219 219
220 static bool isGamepadEvent(const AtomicString& eventType) 220 static bool isGamepadEvent(const AtomicString& eventType)
221 { 221 {
222 return eventType == EventTypeNames::gamepadconnected || eventType == EventTy peNames::gamepaddisconnected; 222 return eventType == EventTypeNames::gamepadconnected || eventType == EventTy peNames::gamepaddisconnected;
223 } 223 }
224 224
225 void NavigatorGamepad::didAddEventListener(LocalDOMWindow*, const AtomicString& eventType) 225 void NavigatorGamepad::didAddEventListener(LocalDOMWindow*, const AtomicString& eventType)
226 { 226 {
227 if (RuntimeEnabledFeatures::gamepadEnabled() && isGamepadEvent(eventType)) { 227 if (isGamepadEvent(eventType)) {
228 if (page() && page()->visibilityState() == PageVisibilityStateVisible) 228 if (page() && page()->visibilityState() == PageVisibilityStateVisible)
229 startUpdating(); 229 startUpdating();
230 m_hasEventListener = true; 230 m_hasEventListener = true;
231 } 231 }
232 } 232 }
233 233
234 void NavigatorGamepad::didRemoveEventListener(LocalDOMWindow* window, const Atom icString& eventType) 234 void NavigatorGamepad::didRemoveEventListener(LocalDOMWindow* window, const Atom icString& eventType)
235 { 235 {
236 if (isGamepadEvent(eventType) 236 if (isGamepadEvent(eventType)
237 && !window->hasEventListeners(EventTypeNames::gamepadconnected) 237 && !window->hasEventListeners(EventTypeNames::gamepadconnected)
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
284 if (connectedGamepadChanged || (!oldWasConnected && newIsConnected)) { 284 if (connectedGamepadChanged || (!oldWasConnected && newIsConnected)) {
285 m_pendingEvents.append(newGamepad); 285 m_pendingEvents.append(newGamepad);
286 } 286 }
287 } 287 }
288 288
289 if (!m_pendingEvents.isEmpty()) 289 if (!m_pendingEvents.isEmpty())
290 m_dispatchOneEventRunner.runAsync(); 290 m_dispatchOneEventRunner.runAsync();
291 } 291 }
292 292
293 } // namespace blink 293 } // namespace blink
OLDNEW
« no previous file with comments | « no previous file | Source/modules/gamepad/NavigatorGamepad.idl » ('j') | Source/web/FrameLoaderClientImpl.cpp » ('J')

Powered by Google App Engine
This is Rietveld 408576698