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

Unified Diff: content/browser/gamepad/xbox_data_fetcher_mac.h

Issue 1627643002: Revert of Refactoring gamepad polling to support dynamically added sources (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 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 side-by-side diff with in-line comments
Download patch
Index: content/browser/gamepad/xbox_data_fetcher_mac.h
diff --git a/content/browser/gamepad/xbox_data_fetcher_mac.h b/content/browser/gamepad/xbox_data_fetcher_mac.h
index 9b3a4543deb279c355c9210c9f9c94f40c1b293a..599a63cf6cdb745d89dbd911e043c212017fff05 100644
--- a/content/browser/gamepad/xbox_data_fetcher_mac.h
+++ b/content/browser/gamepad/xbox_data_fetcher_mac.h
@@ -17,12 +17,6 @@
#include "base/mac/scoped_ioplugininterface.h"
#include "base/macros.h"
#include "base/memory/scoped_ptr.h"
-#include "content/browser/gamepad/gamepad_data_fetcher.h"
-
-struct IOUSBDeviceStruct320;
-struct IOUSBInterfaceStruct300;
-
-namespace content {
class XboxController {
public:
@@ -107,11 +101,11 @@
// Handle for the USB device. IOUSBDeviceStruct320 is the latest version of
// the device API that is supported on Mac OS 10.6.
- base::mac::ScopedIOPluginInterface<IOUSBDeviceStruct320> device_;
+ base::mac::ScopedIOPluginInterface<struct IOUSBDeviceStruct320> device_;
// Handle for the interface on the device which sends button and analog data.
// The other interfaces (for the ChatPad and headset) are ignored.
- base::mac::ScopedIOPluginInterface<IOUSBInterfaceStruct300> interface_;
+ base::mac::ScopedIOPluginInterface<struct IOUSBInterfaceStruct300> interface_;
bool device_is_open_;
bool interface_is_open_;
@@ -142,13 +136,18 @@
DISALLOW_COPY_AND_ASSIGN(XboxController);
};
-class XboxDataFetcher : public GamepadDataFetcher,
- public XboxController::Delegate {
+class XboxDataFetcher : public XboxController::Delegate {
public:
- XboxDataFetcher();
- ~XboxDataFetcher() override;
+ class Delegate {
+ public:
+ virtual void XboxDeviceAdd(XboxController* device) = 0;
+ virtual void XboxDeviceRemove(XboxController* device) = 0;
+ virtual void XboxValueChanged(XboxController* device,
+ const XboxController::Data& data) = 0;
+ };
- void GetGamepadData(bool devices_changed_hint) override;
+ explicit XboxDataFetcher(Delegate* delegate);
+ virtual ~XboxDataFetcher();
bool RegisterForNotifications();
bool RegisterForDeviceNotifications(
@@ -163,13 +162,14 @@
private:
static void DeviceAdded(void* context, io_iterator_t iterator);
static void DeviceRemoved(void* context, io_iterator_t iterator);
- void OnAddedToProvider() override;
void AddController(XboxController* controller);
void RemoveController(XboxController* controller);
void RemoveControllerByLocationID(uint32_t id);
void XboxControllerGotData(XboxController* controller,
const XboxController::Data& data) override;
void XboxControllerError(XboxController* controller) override;
+
+ Delegate* delegate_;
std::set<XboxController*> controllers_;
@@ -187,6 +187,4 @@
DISALLOW_COPY_AND_ASSIGN(XboxDataFetcher);
};
-} // namespace content
-
#endif // CONTENT_BROWSER_GAMEPAD_XBOX_DATA_FETCHER_MAC_H_
« no previous file with comments | « content/browser/gamepad/raw_input_data_fetcher_win.cc ('k') | content/browser/gamepad/xbox_data_fetcher_mac.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698