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

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

Issue 2645823002: Change PlatformEventController to take LocalFrame rather than Page. (Closed)
Patch Set: Change PlatformEventController to take LocalFrame rather than Page. Created 3 years, 10 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 152 matching lines...) Expand 10 before | Expand all | Expand 10 after
163 GamepadEvent::create(eventName, false, true, gamepad)); 163 GamepadEvent::create(eventName, false, true, gamepad));
164 164
165 if (!m_pendingEvents.isEmpty()) 165 if (!m_pendingEvents.isEmpty())
166 m_dispatchOneEventRunner->runAsync(); 166 m_dispatchOneEventRunner->runAsync();
167 } 167 }
168 168
169 NavigatorGamepad::NavigatorGamepad(Navigator& navigator) 169 NavigatorGamepad::NavigatorGamepad(Navigator& navigator)
170 : Supplement<Navigator>(navigator), 170 : Supplement<Navigator>(navigator),
171 ContextLifecycleObserver(navigator.frame() ? navigator.frame()->document() 171 ContextLifecycleObserver(navigator.frame() ? navigator.frame()->document()
172 : nullptr), 172 : nullptr),
173 PlatformEventController(navigator.frame() ? navigator.frame()->page() 173 PlatformEventController(navigator.frame()),
174 : nullptr),
175 m_dispatchOneEventRunner(AsyncMethodRunner<NavigatorGamepad>::create( 174 m_dispatchOneEventRunner(AsyncMethodRunner<NavigatorGamepad>::create(
176 this, 175 this,
177 &NavigatorGamepad::dispatchOneEvent)) { 176 &NavigatorGamepad::dispatchOneEvent)) {
178 if (navigator.frame()) 177 if (navigator.frame())
179 navigator.frame()->domWindow()->registerEventListenerObserver(this); 178 navigator.frame()->domWindow()->registerEventListenerObserver(this);
180 } 179 }
181 180
182 NavigatorGamepad::~NavigatorGamepad() {} 181 NavigatorGamepad::~NavigatorGamepad() {}
183 182
184 const char* NavigatorGamepad::supplementName() { 183 const char* NavigatorGamepad::supplementName() {
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
269 if (connectedGamepadChanged || (!oldWasConnected && newIsConnected)) { 268 if (connectedGamepadChanged || (!oldWasConnected && newIsConnected)) {
270 m_pendingEvents.append(newGamepad); 269 m_pendingEvents.append(newGamepad);
271 } 270 }
272 } 271 }
273 272
274 if (!m_pendingEvents.isEmpty()) 273 if (!m_pendingEvents.isEmpty())
275 m_dispatchOneEventRunner->runAsync(); 274 m_dispatchOneEventRunner->runAsync();
276 } 275 }
277 276
278 } // namespace blink 277 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698