summaryrefslogtreecommitdiffstats
path: root/device/hid/hid_service.h
diff options
context:
space:
mode:
authorrockot@chromium.org <rockot@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-07-26 18:25:38 +0000
committerrockot@chromium.org <rockot@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-07-26 18:25:38 +0000
commit03b640fd591ce98a81ec36ef6dab245fa95b6b51 (patch)
treed74d538b4cc5bd5512150af429e956de2cafe9dc /device/hid/hid_service.h
parentbe4e0f9f02b6722b62986106d915f637ff1ca7b4 (diff)
downloadchromium_src-03b640fd591ce98a81ec36ef6dab245fa95b6b51.zip
chromium_src-03b640fd591ce98a81ec36ef6dab245fa95b6b51.tar.gz
chromium_src-03b640fd591ce98a81ec36ef6dab245fa95b6b51.tar.bz2
Support permission_broker for chrome.hid devices.
This enables the Chrome to query permission_broker for access to hidraw device paths when running on Chrome OS. HidService has been refactored so that it is owned by the extensions API embedder, rather than being a singleton. Because hid has just moved to //extensions as well, this also establishes a new ShellExtensionsAPIClient to create a HidService for app_shell. BUG=367145 TEST=manual test on ChromeOS dev build TBR=derat@chromium.org for mechanical app_shell changes Review URL: https://codereview.chromium.org/419713002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@285774 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'device/hid/hid_service.h')
-rw-r--r--device/hid/hid_service.h18
1 files changed, 6 insertions, 12 deletions
diff --git a/device/hid/hid_service.h b/device/hid/hid_service.h
index ebde59a..c8e4e41 100644
--- a/device/hid/hid_service.h
+++ b/device/hid/hid_service.h
@@ -10,8 +10,7 @@
#include <vector>
#include "base/memory/ref_counted.h"
-#include "base/memory/scoped_ptr.h"
-#include "base/message_loop/message_loop.h"
+#include "base/message_loop/message_loop_proxy.h"
#include "base/threading/thread_checker.h"
#include "device/hid/hid_device_info.h"
@@ -19,10 +18,12 @@ namespace device {
class HidConnection;
-class HidService : public base::MessageLoop::DestructionObserver {
+class HidService {
public:
- // Must be called on FILE thread.
- static HidService* GetInstance();
+ static HidService* Create(
+ scoped_refptr<base::MessageLoopProxy> ui_message_loop);
+
+ virtual ~HidService();
// Enumerates and returns a list of device identifiers.
virtual void GetDevices(std::vector<HidDeviceInfo>* devices);
@@ -34,19 +35,12 @@ class HidService : public base::MessageLoop::DestructionObserver {
virtual scoped_refptr<HidConnection> Connect(
const HidDeviceId& device_id) = 0;
- // Implements base::MessageLoop::DestructionObserver
- virtual void WillDestroyCurrentMessageLoop() OVERRIDE;
-
protected:
- friend struct base::DefaultDeleter<HidService>;
friend class HidConnectionTest;
typedef std::map<HidDeviceId, HidDeviceInfo> DeviceMap;
HidService();
- virtual ~HidService();
-
- static HidService* CreateInstance();
void AddDevice(const HidDeviceInfo& info);
void RemoveDevice(const HidDeviceId& device_id);