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

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

Issue 417213002: Introduce PlatformEvent to handle Device events, Battery events and Gamepad events. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: with backward compatibility Created 6 years, 4 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 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "config.h" 5 #include "config.h"
6 #include "modules/gamepad/GamepadDispatcher.h" 6 #include "modules/gamepad/GamepadDispatcher.h"
7 7
8 #include "modules/gamepad/NavigatorGamepad.h" 8 #include "modules/gamepad/NavigatorGamepad.h"
9 #include "public/platform/Platform.h" 9 #include "public/platform/Platform.h"
10 #include "wtf/TemporaryChange.h" 10 #include "wtf/TemporaryChange.h"
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
45 ASSERT(index < blink::WebGamepads::itemsLengthCap); 45 ASSERT(index < blink::WebGamepads::itemsLengthCap);
46 ASSERT(connected == gamepad.connected); 46 ASSERT(connected == gamepad.connected);
47 47
48 m_latestChange.pad = gamepad; 48 m_latestChange.pad = gamepad;
49 m_latestChange.index = index; 49 m_latestChange.index = index;
50 notifyControllers(); 50 notifyControllers();
51 } 51 }
52 52
53 void GamepadDispatcher::startListening() 53 void GamepadDispatcher::startListening()
54 { 54 {
55 blink::Platform::current()->setGamepadListener(this); 55 blink::Platform::current()->startListening(WebPlatformEventGamepad, this);
56 } 56 }
57 57
58 void GamepadDispatcher::stopListening() 58 void GamepadDispatcher::stopListening()
59 { 59 {
60 blink::Platform::current()->setGamepadListener(0); 60 blink::Platform::current()->stopListening(WebPlatformEventGamepad);
61 } 61 }
62 62
63 } // namespace blink 63 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698