OLD | NEW |
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/basictypes.h" | 10 #include "base/basictypes.h" |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 private: | 82 private: |
83 friend struct DefaultSingletonTraits<GamepadService>; | 83 friend struct DefaultSingletonTraits<GamepadService>; |
84 friend class GamepadServiceTestConstructor; | 84 friend class GamepadServiceTestConstructor; |
| 85 friend class GamepadServiceTest; |
85 | 86 |
86 GamepadService(); | 87 GamepadService(); |
87 | 88 |
88 // Constructor for testing. This specifies the data fetcher to use for a | 89 // Constructor for testing. This specifies the data fetcher to use for a |
89 // provider, bypassing the default platform one. | 90 // provider, bypassing the default platform one. |
90 GamepadService(scoped_ptr<GamepadDataFetcher> fetcher); | 91 GamepadService(scoped_ptr<GamepadDataFetcher> fetcher); |
91 | 92 |
92 virtual ~GamepadService(); | 93 virtual ~GamepadService(); |
93 | 94 |
| 95 void SetInstance(); |
| 96 |
94 void OnUserGesture(); | 97 void OnUserGesture(); |
95 | 98 |
96 struct ConsumerInfo { | 99 struct ConsumerInfo { |
97 ConsumerInfo(GamepadConsumer* consumer) | 100 ConsumerInfo(GamepadConsumer* consumer) |
98 : consumer(consumer), | 101 : consumer(consumer), |
99 did_observe_user_gesture(false) { | 102 did_observe_user_gesture(false) { |
100 } | 103 } |
101 | 104 |
102 bool operator<(const ConsumerInfo& other) const { | 105 bool operator<(const ConsumerInfo& other) const { |
103 return consumer < other.consumer; | 106 return consumer < other.consumer; |
(...skipping 14 matching lines...) Expand all Loading... |
118 int num_active_consumers_; | 121 int num_active_consumers_; |
119 | 122 |
120 bool gesture_callback_pending_; | 123 bool gesture_callback_pending_; |
121 | 124 |
122 DISALLOW_COPY_AND_ASSIGN(GamepadService); | 125 DISALLOW_COPY_AND_ASSIGN(GamepadService); |
123 }; | 126 }; |
124 | 127 |
125 } // namespace content | 128 } // namespace content |
126 | 129 |
127 #endif // CONTENT_BROWSER_GAMEPAD_GAMEPAD_SERVICE_H_ | 130 #endif // CONTENT_BROWSER_GAMEPAD_GAMEPAD_SERVICE_H_ |
OLD | NEW |