Chromium Code Reviews| Index: chrome/browser/extensions/api/api_resource_manager.h |
| diff --git a/chrome/browser/extensions/api/api_resource_manager.h b/chrome/browser/extensions/api/api_resource_manager.h |
| index b459c2292b30c3fdf2ad3ea64dbd79b54b68081c..d3f0d17ea4abfe904fc2c7c4f1883b190b85a1f6 100644 |
| --- a/chrome/browser/extensions/api/api_resource_manager.h |
| +++ b/chrome/browser/extensions/api/api_resource_manager.h |
| @@ -133,6 +133,10 @@ class ApiResourceManager : public ProfileKeyedAPI, |
| return data_->GetResourceIds(extension_id); |
| } |
| + bool Set(const std::string& extension_id, int api_resource_id, T* resource) { |
| + return data_->Set(extension_id, api_resource_id, resource); |
| + } |
| + |
| protected: |
| // content::NotificationObserver: |
| virtual void Observe(int type, |
| @@ -214,6 +218,18 @@ class ApiResourceManager : public ProfileKeyedAPI, |
| return GetOwnedResource(extension_id, api_resource_id); |
| } |
| + bool Set(const std::string& extension_id, |
|
Ryan Sleevi
2014/02/24 20:06:49
I know this is not your code, and so the lack of d
lally
2014/02/27 17:05:59
I've renamed it Replace(), and documented that it
lally
2014/02/27 21:43:19
I just checked with Renaud, yup, the extension_ids
|
| + int api_resource_id, |
| + T* api_resource) { |
| + DCHECK(content::BrowserThread::CurrentlyOn(thread_id_)); |
| + T* old_resource = api_resource_map_[api_resource_id].get(); |
| + if (old_resource && extension_id == old_resource->owner_extension_id()) { |
| + api_resource_map_[api_resource_id] = linked_ptr<T>(api_resource); |
| + return true; |
| + } |
| + return false; |
| + } |
| + |
| base::hash_set<int>* GetResourceIds(const std::string& extension_id) { |
| DCHECK(content::BrowserThread::CurrentlyOn(thread_id_)); |
| return GetOwnedResourceIds(extension_id); |