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 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
142 if (!m_gamepads) | 142 if (!m_gamepads) |
143 m_gamepads = GamepadList::create(); | 143 m_gamepads = GamepadList::create(); |
144 | 144 |
145 RefPtrWillBeRawPtr<Gamepad> gamepad = m_gamepads->item(index); | 145 RefPtrWillBeRawPtr<Gamepad> gamepad = m_gamepads->item(index); |
146 if (!gamepad) | 146 if (!gamepad) |
147 gamepad = Gamepad::create(); | 147 gamepad = Gamepad::create(); |
148 sampleGamepad(index, *gamepad, webGamepad); | 148 sampleGamepad(index, *gamepad, webGamepad); |
149 m_gamepads->set(index, gamepad); | 149 m_gamepads->set(index, gamepad); |
150 | 150 |
151 const AtomicString& eventName = connected ? EventTypeNames::gamepadconnected
: EventTypeNames::gamepaddisconnected; | 151 const AtomicString& eventName = connected ? EventTypeNames::gamepadconnected
: EventTypeNames::gamepaddisconnected; |
152 RefPtr<GamepadEvent> event = GamepadEvent::create(eventName, false, true, ga
mepad.get()); | 152 RefPtrWillBeRawPtr<GamepadEvent> event = GamepadEvent::create(eventName, fal
se, true, gamepad.get()); |
153 window()->dispatchEvent(event); | 153 window()->dispatchEvent(event); |
154 } | 154 } |
155 | 155 |
156 NavigatorGamepad::NavigatorGamepad(Document& document) | 156 NavigatorGamepad::NavigatorGamepad(Document& document) |
157 : DOMWindowProperty(document.frame()) | 157 : DOMWindowProperty(document.frame()) |
158 , DeviceSensorEventController(document) | 158 , DeviceSensorEventController(document) |
159 , DOMWindowLifecycleObserver(document.frame()->domWindow()) | 159 , DOMWindowLifecycleObserver(document.frame()->domWindow()) |
160 { | 160 { |
161 } | 161 } |
162 | 162 |
(...skipping 27 matching lines...) Expand all Loading... |
190 { | 190 { |
191 GamepadDispatcher::instance().removeClient(this); | 191 GamepadDispatcher::instance().removeClient(this); |
192 } | 192 } |
193 | 193 |
194 bool NavigatorGamepad::hasLastData() | 194 bool NavigatorGamepad::hasLastData() |
195 { | 195 { |
196 // Gamepad data is polled instead of pushed. | 196 // Gamepad data is polled instead of pushed. |
197 return false; | 197 return false; |
198 } | 198 } |
199 | 199 |
200 PassRefPtr<Event> NavigatorGamepad::getLastEvent() | 200 PassRefPtrWillBeRawPtr<Event> NavigatorGamepad::getLastEvent() |
201 { | 201 { |
202 // This is called only when hasLastData() is true. | 202 // This is called only when hasLastData() is true. |
203 ASSERT_NOT_REACHED(); | 203 ASSERT_NOT_REACHED(); |
204 return nullptr; | 204 return nullptr; |
205 } | 205 } |
206 | 206 |
207 bool NavigatorGamepad::isNullEvent(Event*) | 207 bool NavigatorGamepad::isNullEvent(Event*) |
208 { | 208 { |
209 // This is called only when hasLastData() is true. | 209 // This is called only when hasLastData() is true. |
210 ASSERT_NOT_REACHED(); | 210 ASSERT_NOT_REACHED(); |
(...skipping 14 matching lines...) Expand all Loading... |
225 if (eventType == EventTypeNames::gamepadconnected || eventType == EventTypeN
ames::gamepaddisconnected) | 225 if (eventType == EventTypeNames::gamepadconnected || eventType == EventTypeN
ames::gamepaddisconnected) |
226 m_hasEventListener = false; | 226 m_hasEventListener = false; |
227 } | 227 } |
228 | 228 |
229 void NavigatorGamepad::didRemoveAllEventListeners(DOMWindow*) | 229 void NavigatorGamepad::didRemoveAllEventListeners(DOMWindow*) |
230 { | 230 { |
231 m_hasEventListener = false; | 231 m_hasEventListener = false; |
232 } | 232 } |
233 | 233 |
234 } // namespace WebCore | 234 } // namespace WebCore |
OLD | NEW |