| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef EXTENSIONS_BROWSER_API_HID_HID_CONNECTION_RESOURCE_H_ | 5 #ifndef EXTENSIONS_BROWSER_API_HID_HID_CONNECTION_RESOURCE_H_ |
| 6 #define EXTENSIONS_BROWSER_API_HID_HID_CONNECTION_RESOURCE_H_ | 6 #define EXTENSIONS_BROWSER_API_HID_HID_CONNECTION_RESOURCE_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/memory/ref_counted.h" | 10 #include "base/memory/ref_counted.h" |
| 11 #include "content/public/browser/browser_thread.h" | 11 #include "content/public/browser/browser_thread.h" |
| 12 #include "device/hid/hid_connection.h" | 12 #include "device/hid/hid_connection.h" |
| 13 #include "extensions/browser/api/api_resource.h" | 13 #include "extensions/browser/api/api_resource.h" |
| 14 #include "extensions/browser/api/api_resource_manager.h" | 14 #include "extensions/browser/api/api_resource_manager.h" |
| 15 | 15 |
| 16 namespace device { |
| 17 class HidConnection; |
| 18 } |
| 19 |
| 16 namespace extensions { | 20 namespace extensions { |
| 17 | 21 |
| 18 class HidConnectionResource : public ApiResource { | 22 class HidConnectionResource : public ApiResource { |
| 19 public: | 23 public: |
| 24 static const content::BrowserThread::ID kThreadId = |
| 25 content::BrowserThread::FILE; |
| 26 |
| 20 HidConnectionResource(const std::string& owner_extension_id, | 27 HidConnectionResource(const std::string& owner_extension_id, |
| 21 scoped_refptr<device::HidConnection> connection); | 28 scoped_refptr<device::HidConnection> connection); |
| 22 virtual ~HidConnectionResource(); | 29 virtual ~HidConnectionResource(); |
| 23 | 30 |
| 24 scoped_refptr<device::HidConnection> connection() const { | 31 scoped_refptr<device::HidConnection> connection() const { |
| 25 return connection_; | 32 return connection_; |
| 26 } | 33 } |
| 27 | 34 |
| 35 virtual bool IsPersistent() const OVERRIDE; |
| 36 |
| 28 static const char* service_name() { return "HidConnectionResourceManager"; } | 37 static const char* service_name() { return "HidConnectionResourceManager"; } |
| 29 | 38 |
| 30 static const content::BrowserThread::ID kThreadId = | |
| 31 content::BrowserThread::FILE; | |
| 32 | |
| 33 private: | 39 private: |
| 34 scoped_refptr<device::HidConnection> connection_; | 40 scoped_refptr<device::HidConnection> connection_; |
| 35 | 41 |
| 36 DISALLOW_COPY_AND_ASSIGN(HidConnectionResource); | 42 DISALLOW_COPY_AND_ASSIGN(HidConnectionResource); |
| 37 }; | 43 }; |
| 38 | 44 |
| 39 } // namespace extensions | 45 } // namespace extensions |
| 40 | 46 |
| 41 #endif // EXTENSIONS_BROWSER_API_HID_HID_CONNECTION_RESOURCE_H_ | 47 #endif // EXTENSIONS_BROWSER_API_HID_HID_CONNECTION_RESOURCE_H_ |
| OLD | NEW |