Chromium Code Reviews| Index: device/hid/hid_service.h |
| diff --git a/device/hid/hid_service.h b/device/hid/hid_service.h |
| index 2589220121dac7cbc68308c53cf1dbae0cb39ea0..96bf3fc1c0325f842251645bb2def8e0d4e80759 100644 |
| --- a/device/hid/hid_service.h |
| +++ b/device/hid/hid_service.h |
| @@ -1,4 +1,4 @@ |
| -// 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. |
| @@ -9,25 +9,15 @@ |
| #include <string> |
| #include <vector> |
| -#include "base/basictypes.h" |
| #include "base/memory/ref_counted.h" |
| #include "base/memory/scoped_ptr.h" |
| #include "base/message_loop/message_loop.h" |
| -#include "base/strings/string16.h" |
| #include "base/threading/thread_checker.h" |
| -#include "build/build_config.h" |
| #include "device/hid/hid_device_info.h" |
| namespace device { |
| -namespace { |
| - |
| -class HidServiceContainer; |
| - |
| -} // namespace |
| - |
| class HidConnection; |
| -class HidService; |
| class HidService : public base::MessageLoop::DestructionObserver { |
| public: |
| @@ -40,37 +30,36 @@ class HidService : public base::MessageLoop::DestructionObserver { |
| // Fills in the device info struct of the given device_id. |
| // Returns true if succeed. |
| // Returns false if the device_id is invalid, with info untouched. |
| - bool GetInfo(std::string device_id, HidDeviceInfo* info) const; |
| + bool GetInfo(HidDeviceId device_id, HidDeviceInfo* info) const; |
| - virtual scoped_refptr<HidConnection> Connect( |
| - std::string platform_device_id) = 0; |
| + virtual scoped_refptr<HidConnection> Connect(HidDeviceId device_id) = 0; |
| // Implements base::MessageLoop::DestructionObserver |
| virtual void WillDestroyCurrentMessageLoop() OVERRIDE; |
| - // Gets whether the HidService have been successfully initialized. |
| - bool initialized() const { return initialized_; } |
| - |
| protected: |
| - friend class HidServiceContainer; |
| friend struct base::DefaultDeleter<HidService>; |
| friend class HidConnectionTest; |
| + typedef std::map<HidDeviceId, HidDeviceInfo> DeviceMap; |
| + |
| HidService(); |
| virtual ~HidService(); |
| static HidService* CreateInstance(); |
| - virtual void AddDevice(HidDeviceInfo info); |
| - virtual void RemoveDevice(std::string platform_device_id); |
| + HidDeviceId GenerateDeviceId(); |
| - typedef std::map<std::string, HidDeviceInfo> DeviceMap; |
| - DeviceMap devices_; |
| - |
| - bool initialized_; |
| + void AddDevice(const HidDeviceInfo& info); |
| + void RemoveDevice(HidDeviceId device_id); |
| base::ThreadChecker thread_checker_; |
|
Mark Mentovai
2014/02/21 17:48:18
Here’s a case where the thread checker is shared b
|
| + private: |
| + DeviceMap devices_; |
| + |
| + HidDeviceId next_device_id_; |
| + |
| DISALLOW_COPY_AND_ASSIGN(HidService); |
| }; |