| 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" |
| (...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 175 bool Replace(const std::string& extension_id, | 175 bool Replace(const std::string& extension_id, |
| 176 int api_resource_id, | 176 int api_resource_id, |
| 177 T* resource) { | 177 T* resource) { |
| 178 return data_->Replace(extension_id, api_resource_id, resource); | 178 return data_->Replace(extension_id, api_resource_id, resource); |
| 179 } | 179 } |
| 180 | 180 |
| 181 protected: | 181 protected: |
| 182 // content::NotificationObserver: | 182 // content::NotificationObserver: |
| 183 virtual void Observe(int type, | 183 virtual void Observe(int type, |
| 184 const content::NotificationSource& source, | 184 const content::NotificationSource& source, |
| 185 const content::NotificationDetails& details) OVERRIDE { | 185 const content::NotificationDetails& details) override { |
| 186 DCHECK_EQ(extensions::NOTIFICATION_EXTENSION_HOST_DESTROYED, type); | 186 DCHECK_EQ(extensions::NOTIFICATION_EXTENSION_HOST_DESTROYED, type); |
| 187 ExtensionHost* host = content::Details<ExtensionHost>(details).ptr(); | 187 ExtensionHost* host = content::Details<ExtensionHost>(details).ptr(); |
| 188 data_->InitiateExtensionSuspendedCleanup(host->extension_id()); | 188 data_->InitiateExtensionSuspendedCleanup(host->extension_id()); |
| 189 } | 189 } |
| 190 | 190 |
| 191 // ExtensionRegistryObserver: | 191 // ExtensionRegistryObserver: |
| 192 virtual void OnExtensionUnloaded( | 192 virtual void OnExtensionUnloaded( |
| 193 content::BrowserContext* browser_context, | 193 content::BrowserContext* browser_context, |
| 194 const Extension* extension, | 194 const Extension* extension, |
| 195 UnloadedExtensionInfo::Reason reason) OVERRIDE { | 195 UnloadedExtensionInfo::Reason reason) override { |
| 196 data_->InitiateExtensionUnloadedCleanup(extension->id()); | 196 data_->InitiateExtensionUnloadedCleanup(extension->id()); |
| 197 } | 197 } |
| 198 | 198 |
| 199 private: | 199 private: |
| 200 // TODO(rockot): ApiResourceData could be moved out of ApiResourceManager and | 200 // TODO(rockot): ApiResourceData could be moved out of ApiResourceManager and |
| 201 // we could avoid maintaining a friends list here. | 201 // we could avoid maintaining a friends list here. |
| 202 friend class BluetoothAPI; | 202 friend class BluetoothAPI; |
| 203 friend class core_api::BluetoothSocketApiFunction; | 203 friend class core_api::BluetoothSocketApiFunction; |
| 204 friend class core_api::BluetoothSocketEventDispatcher; | 204 friend class core_api::BluetoothSocketEventDispatcher; |
| 205 friend class core_api::SerialEventDispatcher; | 205 friend class core_api::SerialEventDispatcher; |
| (...skipping 256 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 462 ->GetSequencedTaskRunnerWithShutdownBehavior( | 462 ->GetSequencedTaskRunnerWithShutdownBehavior( |
| 463 content::BrowserThread::GetBlockingPool()->GetNamedSequenceToken( | 463 content::BrowserThread::GetBlockingPool()->GetNamedSequenceToken( |
| 464 T::kSequenceToken), | 464 T::kSequenceToken), |
| 465 T::kShutdownBehavior); | 465 T::kShutdownBehavior); |
| 466 } | 466 } |
| 467 }; | 467 }; |
| 468 | 468 |
| 469 } // namespace extensions | 469 } // namespace extensions |
| 470 | 470 |
| 471 #endif // EXTENSIONS_BROWSER_API_API_RESOURCE_MANAGER_H_ | 471 #endif // EXTENSIONS_BROWSER_API_API_RESOURCE_MANAGER_H_ |
| OLD | NEW |