| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 CHROME_BROWSER_EXTENSIONS_API_API_RESOURCE_H_ | 5 #ifndef CHROME_BROWSER_EXTENSIONS_API_API_RESOURCE_H_ |
| 6 #define CHROME_BROWSER_EXTENSIONS_API_API_RESOURCE_H_ | 6 #define CHROME_BROWSER_EXTENSIONS_API_API_RESOURCE_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
| 10 #include "base/memory/ref_counted.h" | 10 #include "base/memory/ref_counted.h" |
| 11 | 11 |
| 12 namespace extensions { | 12 namespace extensions { |
| 13 | 13 |
| 14 class APIResourceController; | 14 class APIResourceController; |
| 15 class APIResourceEventNotifier; | 15 class APIResourceEventNotifier; |
| 16 | 16 |
| 17 // An APIResource represents something that an extension API manages, such as a | 17 // An APIResource represents something that an extension API manages, such as a |
| 18 // socket or a serial-port connection. | 18 // socket or a serial-port connection. |
| 19 class APIResource { | 19 class APIResource { |
| 20 public: | 20 public: |
| 21 virtual ~APIResource(); | 21 virtual ~APIResource(); |
| 22 | 22 |
| 23 protected: | 23 protected: |
| 24 enum APIResourceType { | 24 enum APIResourceType { |
| 25 SocketResource, | 25 SocketResource, |
| 26 SerialConnectionResource | 26 SerialConnectionResource, |
| 27 UsbDeviceResource, |
| 27 }; | 28 }; |
| 28 APIResource(APIResourceType api_resource_type, | 29 APIResource(APIResourceType api_resource_type, |
| 29 APIResourceEventNotifier* event_notifier); | 30 APIResourceEventNotifier* event_notifier); |
| 30 | 31 |
| 31 APIResourceType api_resource_type() const; | 32 APIResourceType api_resource_type() const; |
| 32 APIResourceEventNotifier* event_notifier() const; | 33 APIResourceEventNotifier* event_notifier() const; |
| 33 | 34 |
| 34 private: | 35 private: |
| 35 APIResourceType api_resource_type_; | 36 APIResourceType api_resource_type_; |
| 36 scoped_refptr<APIResourceEventNotifier> event_notifier_; | 37 scoped_refptr<APIResourceEventNotifier> event_notifier_; |
| 37 | 38 |
| 38 friend class APIResourceController; | 39 friend class APIResourceController; |
| 39 DISALLOW_COPY_AND_ASSIGN(APIResource); | 40 DISALLOW_COPY_AND_ASSIGN(APIResource); |
| 40 }; | 41 }; |
| 41 | 42 |
| 42 } // namespace extensions | 43 } // namespace extensions |
| 43 | 44 |
| 44 #endif // CHROME_BROWSER_EXTENSIONS_API_API_RESOURCE_H_ | 45 #endif // CHROME_BROWSER_EXTENSIONS_API_API_RESOURCE_H_ |
| OLD | NEW |