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

Unified Diff: device/hid/hid_service_mac.h

Issue 161823002: Clean up HID backend and API. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Many cleanup, such device ID, woww. Created 6 years, 10 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: device/hid/hid_service_mac.h
diff --git a/device/hid/hid_service_mac.h b/device/hid/hid_service_mac.h
index 9351d1ea15f22a987a328d0c6460f7d54a950403..d7e9f1c4235601f4db6e6153573203786d5e2612 100644
--- a/device/hid/hid_service_mac.h
+++ b/device/hid/hid_service_mac.h
@@ -1,77 +1,63 @@
-// Copyright (c) 2014 The Chromium Authors. All rights reserved.
+// Copyright 2014 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef DEVICE_HID_HID_SERVICE_MAC_H_
#define DEVICE_HID_HID_SERVICE_MAC_H_
-#include <map>
+#include <CoreFoundation/CoreFoundation.h>
+#include <IOKit/hid/IOHIDManager.h>
+
#include <string>
-#include <vector>
-#include "base/basictypes.h"
#include "base/mac/foundation_util.h"
#include "base/memory/ref_counted.h"
-#include "base/memory/singleton.h"
-#include "base/message_loop/message_loop.h"
-#include "base/strings/string16.h"
-#include "base/synchronization/waitable_event.h"
-#include "base/threading/thread.h"
-#include "base/threading/thread_checker.h"
-#include "build/build_config.h"
-#include "device/hid/hid_device_info.h"
+#include "device/hid/hid_platform_resource_bidi_map.h"
#include "device/hid/hid_service.h"
-#include <CoreFoundation/CoreFoundation.h>
-#include <IOKit/hid/IOHIDManager.h>
+namespace base {
+class MessageLoopProxy;
+}
namespace device {
class HidConnection;
-class HidService;
class HidServiceMac : public HidService {
public:
HidServiceMac();
- virtual scoped_refptr<HidConnection> Connect(std::string device_id) OVERRIDE;
+ virtual scoped_refptr<HidConnection> Connect(HidDeviceId device_id) OVERRIDE;
private:
virtual ~HidServiceMac();
- void ScheduleRunLoop();
- void UnscheduleRunLoop();
+ void StartWatchingDevices();
+ void StopWatchingDevices();
// Device changing callbacks.
static void AddDeviceCallback(void* context,
IOReturn result,
void* sender,
- IOHIDDeviceRef ref);
+ IOHIDDeviceRef hid_device);
static void RemoveDeviceCallback(void* context,
IOReturn result,
void* sender,
- IOHIDDeviceRef ref);
- static HidServiceMac* InstanceFromContext(void* context);
-
- IOHIDDeviceRef FindDevice(std::string id);
+ IOHIDDeviceRef hid_device);
void Enumerate();
- void PlatformAddDevice(IOHIDDeviceRef ref);
- void PlatformRemoveDevice(IOHIDDeviceRef ref);
-
- // The message loop this object belongs to.
- scoped_refptr<base::MessageLoopProxy> message_loop_;
+ void PlatformAddDevice(IOHIDDeviceRef hid_device);
+ void PlatformRemoveDevice(IOHIDDeviceRef hid_device);
// Platform HID Manager
- base::ScopedCFTypeRef<IOHIDManagerRef> hid_manager_ref_;
+ base::ScopedCFTypeRef<IOHIDManagerRef> hid_manager_;
- // Enumeration thread.
- scoped_ptr<base::Thread> enumeration_runloop_thread_;
- CFRunLoopRef enumeration_runloop_;
- base::WaitableEvent enumeration_runloop_init_;
+ // The message loop for the thread on which this service was created.
+ scoped_refptr<base::MessageLoopProxy> message_loop_;
- bool available_;
+ // A 1:1 mapping between device IDs and IOHIDDeviceRefs.
Mark Mentovai 2014/02/21 17:48:18 Why? Why go to the trouble of inventing our own ha
Ken Rockot(use gerrit already) 2014/02/22 01:17:04 Much simpler. I think the attachment to a consiste
+ HidPlatformResourceBidiMap<IOHIDDeviceRef> platform_resource_map_;
DISALLOW_COPY_AND_ASSIGN(HidServiceMac);
};

Powered by Google App Engine
This is Rietveld 408576698