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

Side by Side Diff: content/browser/gamepad/gamepad_service.h

Issue 1586663006: Refactoring gamepad polling to support dynamically added sources (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Avoid crash on Android content_unittests Created 4 years, 11 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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 #ifndef CONTENT_BROWSER_GAMEPAD_GAMEPAD_SERVICE_H_ 5 #ifndef CONTENT_BROWSER_GAMEPAD_GAMEPAD_SERVICE_H_
6 #define CONTENT_BROWSER_GAMEPAD_GAMEPAD_SERVICE_H_ 6 #define CONTENT_BROWSER_GAMEPAD_GAMEPAD_SERVICE_H_
7 7
8 #include <set> 8 #include <set>
9 9
10 #include "base/callback_forward.h" 10 #include "base/callback_forward.h"
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
72 72
73 // Stop/join with the background thread in GamepadProvider |provider_|. 73 // Stop/join with the background thread in GamepadProvider |provider_|.
74 void Terminate(); 74 void Terminate();
75 75
76 // Called on IO thread when a gamepad is connected. 76 // Called on IO thread when a gamepad is connected.
77 void OnGamepadConnected(int index, const blink::WebGamepad& pad); 77 void OnGamepadConnected(int index, const blink::WebGamepad& pad);
78 78
79 // Called on IO thread when a gamepad is disconnected. 79 // Called on IO thread when a gamepad is disconnected.
80 void OnGamepadDisconnected(int index, const blink::WebGamepad& pad); 80 void OnGamepadDisconnected(int index, const blink::WebGamepad& pad);
81 81
82 GamepadProvider* provider() { return provider_.get(); }
83
82 private: 84 private:
83 friend struct base::DefaultSingletonTraits<GamepadService>; 85 friend struct base::DefaultSingletonTraits<GamepadService>;
84 friend class GamepadServiceTestConstructor; 86 friend class GamepadServiceTestConstructor;
85 friend class GamepadServiceTest; 87 friend class GamepadServiceTest;
86 88
87 GamepadService(); 89 GamepadService();
88 90
89 // Constructor for testing. This specifies the data fetcher to use for a 91 // Constructor for testing. This specifies the data fetcher to use for a
90 // provider, bypassing the default platform one. 92 // provider, bypassing the default platform one.
91 GamepadService(scoped_ptr<GamepadDataFetcher> fetcher); 93 explicit GamepadService(scoped_ptr<GamepadDataFetcher> fetcher);
92 94
93 virtual ~GamepadService(); 95 virtual ~GamepadService();
94 96
95 static void SetInstance(GamepadService*); 97 static void SetInstance(GamepadService* instance);
96 98
97 void OnUserGesture(); 99 void OnUserGesture();
98 100
99 struct ConsumerInfo { 101 struct ConsumerInfo {
100 ConsumerInfo(GamepadConsumer* consumer) 102 ConsumerInfo(GamepadConsumer* consumer)
101 : consumer(consumer), 103 : consumer(consumer),
102 did_observe_user_gesture(false) { 104 did_observe_user_gesture(false) {
103 } 105 }
104 106
105 bool operator<(const ConsumerInfo& other) const { 107 bool operator<(const ConsumerInfo& other) const {
(...skipping 15 matching lines...) Expand all
121 int num_active_consumers_; 123 int num_active_consumers_;
122 124
123 bool gesture_callback_pending_; 125 bool gesture_callback_pending_;
124 126
125 DISALLOW_COPY_AND_ASSIGN(GamepadService); 127 DISALLOW_COPY_AND_ASSIGN(GamepadService);
126 }; 128 };
127 129
128 } // namespace content 130 } // namespace content
129 131
130 #endif // CONTENT_BROWSER_GAMEPAD_GAMEPAD_SERVICE_H_ 132 #endif // CONTENT_BROWSER_GAMEPAD_GAMEPAD_SERVICE_H_
OLDNEW
« no previous file with comments | « content/browser/gamepad/gamepad_provider_unittest.cc ('k') | content/browser/gamepad/gamepad_service_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698