1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #ifndef EXTENSIONS_BROWSER_API_HID_HID_CONNECTION_RESOURCE_H_
6 #define EXTENSIONS_BROWSER_API_HID_HID_CONNECTION_RESOURCE_H_
10 #include "base/memory/ref_counted.h"
11 #include "content/public/browser/browser_thread.h"
12 #include "device/hid/hid_connection.h"
13 #include "extensions/browser/api/api_resource.h"
14 #include "extensions/browser/api/api_resource_manager.h"
20 namespace extensions {
22 class HidConnectionResource : public ApiResource {
24 #if defined(OS_MACOSX)
25 // Migration from FILE thread to UI thread. OS X gets it first.
26 static const content::BrowserThread::ID kThreadId =
27 content::BrowserThread::UI;
29 // TODO(reillyg): Migrate Linux/CrOS and Windows as well.
30 static const content::BrowserThread::ID kThreadId =
31 content::BrowserThread::FILE;
34 HidConnectionResource(const std::string& owner_extension_id,
35 scoped_refptr<device::HidConnection> connection);
36 ~HidConnectionResource() override;
38 scoped_refptr<device::HidConnection> connection() const {
42 bool IsPersistent() const override;
44 static const char* service_name() { return "HidConnectionResourceManager"; }
47 scoped_refptr<device::HidConnection> connection_;
49 DISALLOW_COPY_AND_ASSIGN(HidConnectionResource);
52 } // namespace extensions
54 #endif // EXTENSIONS_BROWSER_API_HID_HID_CONNECTION_RESOURCE_H_