| OLD | NEW |
| 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 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 161 : EventTypeNames::gamepaddisconnected; | 161 : EventTypeNames::gamepaddisconnected; |
| 162 document->frame()->domWindow()->dispatchEvent( | 162 document->frame()->domWindow()->dispatchEvent( |
| 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(LocalFrame* frame) | 169 NavigatorGamepad::NavigatorGamepad(LocalFrame* frame) |
| 170 : ContextLifecycleObserver(frame->document()), | 170 : ContextLifecycleObserver(frame->document()), |
| 171 PlatformEventController(frame ? frame->page() : 0), | 171 PlatformEventController(frame), |
| 172 m_dispatchOneEventRunner(AsyncMethodRunner<NavigatorGamepad>::create( | 172 m_dispatchOneEventRunner(AsyncMethodRunner<NavigatorGamepad>::create( |
| 173 this, | 173 this, |
| 174 &NavigatorGamepad::dispatchOneEvent)) { | 174 &NavigatorGamepad::dispatchOneEvent)) { |
| 175 if (frame) | 175 if (frame) |
| 176 frame->domWindow()->registerEventListenerObserver(this); | 176 frame->domWindow()->registerEventListenerObserver(this); |
| 177 } | 177 } |
| 178 | 178 |
| 179 NavigatorGamepad::~NavigatorGamepad() {} | 179 NavigatorGamepad::~NavigatorGamepad() {} |
| 180 | 180 |
| 181 const char* NavigatorGamepad::supplementName() { | 181 const char* NavigatorGamepad::supplementName() { |
| (...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 266 if (connectedGamepadChanged || (!oldWasConnected && newIsConnected)) { | 266 if (connectedGamepadChanged || (!oldWasConnected && newIsConnected)) { |
| 267 m_pendingEvents.append(newGamepad); | 267 m_pendingEvents.append(newGamepad); |
| 268 } | 268 } |
| 269 } | 269 } |
| 270 | 270 |
| 271 if (!m_pendingEvents.isEmpty()) | 271 if (!m_pendingEvents.isEmpty()) |
| 272 m_dispatchOneEventRunner->runAsync(); | 272 m_dispatchOneEventRunner->runAsync(); |
| 273 } | 273 } |
| 274 | 274 |
| 275 } // namespace blink | 275 } // namespace blink |
| OLD | NEW |