| 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 | 7 |
| 8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
| 9 #include "base/memory/ref_counted.h" | 9 #include "base/memory/ref_counted.h" |
| 10 | 10 |
| 11 namespace extensions { | 11 namespace extensions { |
| 12 | 12 |
| 13 class APIResourceController; | 13 class ApiResourceEventNotifier; |
| 14 class APIResourceEventNotifier; | |
| 15 | 14 |
| 16 // An APIResource represents something that an extension API manages, such as a | 15 // An ApiResource represents something that an extension API manages, such as a |
| 17 // socket or a serial-port connection. | 16 // socket or a serial-port connection. Typically, an ApiResourceManager will |
| 18 class APIResource { | 17 // control the lifetime of all ApiResources of a specific derived type. |
| 18 class ApiResource { |
| 19 public: | 19 public: |
| 20 virtual ~APIResource(); | 20 virtual ~ApiResource(); |
| 21 | 21 |
| 22 protected: | 22 protected: |
| 23 enum APIResourceType { | 23 ApiResource(ApiResourceEventNotifier* event_notifier); |
| 24 SocketResource, | |
| 25 SerialConnectionResource, | |
| 26 UsbDeviceResource, | |
| 27 }; | |
| 28 APIResource(APIResourceType api_resource_type, | |
| 29 APIResourceEventNotifier* event_notifier); | |
| 30 | 24 |
| 31 APIResourceType api_resource_type() const; | 25 ApiResourceEventNotifier* event_notifier() const; |
| 32 APIResourceEventNotifier* event_notifier() const; | |
| 33 | 26 |
| 34 private: | 27 private: |
| 35 APIResourceType api_resource_type_; | 28 scoped_refptr<ApiResourceEventNotifier> event_notifier_; |
| 36 scoped_refptr<APIResourceEventNotifier> event_notifier_; | |
| 37 | 29 |
| 38 friend class APIResourceController; | 30 DISALLOW_COPY_AND_ASSIGN(ApiResource); |
| 39 DISALLOW_COPY_AND_ASSIGN(APIResource); | |
| 40 }; | 31 }; |
| 41 | 32 |
| 42 } // namespace extensions | 33 } // namespace extensions |
| 43 | 34 |
| 44 #endif // CHROME_BROWSER_EXTENSIONS_API_API_RESOURCE_H_ | 35 #endif // CHROME_BROWSER_EXTENSIONS_API_API_RESOURCE_H_ |
| OLD | NEW |