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_API_RESOURCE_MANAGER_H_ | 5 #ifndef EXTENSIONS_BROWSER_API_API_RESOURCE_MANAGER_H_ |
6 #define EXTENSIONS_BROWSER_API_API_RESOURCE_MANAGER_H_ | 6 #define EXTENSIONS_BROWSER_API_API_RESOURCE_MANAGER_H_ |
7 | 7 |
8 #include <map> | 8 #include <map> |
9 | 9 |
10 #include "base/containers/hash_tables.h" | 10 #include "base/containers/hash_tables.h" |
11 #include "base/lazy_instance.h" | 11 #include "base/lazy_instance.h" |
12 #include "base/memory/linked_ptr.h" | 12 #include "base/memory/linked_ptr.h" |
13 #include "base/memory/ref_counted.h" | 13 #include "base/memory/ref_counted.h" |
14 #include "base/threading/non_thread_safe.h" | 14 #include "base/threading/non_thread_safe.h" |
15 #include "chrome/browser/chrome_notification_types.h" | 15 #include "chrome/browser/chrome_notification_types.h" |
16 #include "chrome/browser/extensions/extension_host.h" | 16 #include "chrome/browser/extensions/extension_host.h" |
17 #include "components/keyed_service/core/keyed_service.h" | 17 #include "components/keyed_service/core/keyed_service.h" |
18 #include "content/public/browser/browser_thread.h" | 18 #include "content/public/browser/browser_thread.h" |
19 #include "content/public/browser/notification_observer.h" | 19 #include "content/public/browser/notification_observer.h" |
20 #include "content/public/browser/notification_registrar.h" | 20 #include "content/public/browser/notification_registrar.h" |
21 #include "content/public/browser/notification_service.h" | 21 #include "content/public/browser/notification_service.h" |
22 #include "extensions/browser/browser_context_keyed_api_factory.h" | 22 #include "extensions/browser/browser_context_keyed_api_factory.h" |
23 #include "extensions/common/extension.h" | 23 #include "extensions/common/extension.h" |
24 | 24 |
25 namespace extensions { | 25 namespace extensions { |
26 | 26 |
27 namespace api { | 27 namespace api { |
| 28 class BluetoothSocketApiFunction; |
| 29 class BluetoothSocketEventDispatcher; |
28 class SerialEventDispatcher; | 30 class SerialEventDispatcher; |
29 } | 31 } |
30 | 32 |
31 namespace core_api { | 33 namespace core_api { |
32 class TCPServerSocketEventDispatcher; | 34 class TCPServerSocketEventDispatcher; |
33 class TCPSocketEventDispatcher; | 35 class TCPSocketEventDispatcher; |
34 class UDPSocketEventDispatcher; | 36 class UDPSocketEventDispatcher; |
35 } | 37 } |
36 | 38 |
37 // An ApiResourceManager manages the lifetime of a set of resources that | 39 // An ApiResourceManager manages the lifetime of a set of resources that |
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
145 ExtensionHost* host = content::Details<ExtensionHost>(details).ptr(); | 147 ExtensionHost* host = content::Details<ExtensionHost>(details).ptr(); |
146 data_->InitiateExtensionSuspendedCleanup(host->extension_id()); | 148 data_->InitiateExtensionSuspendedCleanup(host->extension_id()); |
147 break; | 149 break; |
148 } | 150 } |
149 } | 151 } |
150 } | 152 } |
151 | 153 |
152 private: | 154 private: |
153 // TODO(rockot): ApiResourceData could be moved out of ApiResourceManager and | 155 // TODO(rockot): ApiResourceData could be moved out of ApiResourceManager and |
154 // we could avoid maintaining a friends list here. | 156 // we could avoid maintaining a friends list here. |
| 157 friend class BluetoothAPI; |
| 158 friend class api::BluetoothSocketApiFunction; |
| 159 friend class api::BluetoothSocketEventDispatcher; |
155 friend class api::SerialEventDispatcher; | 160 friend class api::SerialEventDispatcher; |
156 friend class core_api::TCPServerSocketEventDispatcher; | 161 friend class core_api::TCPServerSocketEventDispatcher; |
157 friend class core_api::TCPSocketEventDispatcher; | 162 friend class core_api::TCPSocketEventDispatcher; |
158 friend class core_api::UDPSocketEventDispatcher; | 163 friend class core_api::UDPSocketEventDispatcher; |
159 friend class BrowserContextKeyedAPIFactory<ApiResourceManager<T> >; | 164 friend class BrowserContextKeyedAPIFactory<ApiResourceManager<T> >; |
160 | 165 |
161 // BrowserContextKeyedAPI implementation. | 166 // BrowserContextKeyedAPI implementation. |
162 static const char* service_name() { return T::service_name(); } | 167 static const char* service_name() { return T::service_name(); } |
163 | 168 |
164 static const bool kServiceHasOwnInstanceInIncognito = true; | 169 static const bool kServiceHasOwnInstanceInIncognito = true; |
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
322 }; | 327 }; |
323 | 328 |
324 content::BrowserThread::ID thread_id_; | 329 content::BrowserThread::ID thread_id_; |
325 content::NotificationRegistrar registrar_; | 330 content::NotificationRegistrar registrar_; |
326 scoped_refptr<ApiResourceData> data_; | 331 scoped_refptr<ApiResourceData> data_; |
327 }; | 332 }; |
328 | 333 |
329 } // namespace extensions | 334 } // namespace extensions |
330 | 335 |
331 #endif // EXTENSIONS_BROWSER_API_API_RESOURCE_MANAGER_H_ | 336 #endif // EXTENSIONS_BROWSER_API_API_RESOURCE_MANAGER_H_ |
OLD | NEW |