| 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_MANAGER_H_ | 5 #ifndef CHROME_BROWSER_EXTENSIONS_API_API_RESOURCE_MANAGER_H_ |
| 6 #define CHROME_BROWSER_EXTENSIONS_API_API_RESOURCE_MANAGER_H_ | 6 #define CHROME_BROWSER_EXTENSIONS_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 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 60 // In the cc file: | 60 // In the cc file: |
| 61 // | 61 // |
| 62 // static base::LazyInstance<ProfileKeyedAPIFactory< | 62 // static base::LazyInstance<ProfileKeyedAPIFactory< |
| 63 // ApiResourceManager<Resource> > > | 63 // ApiResourceManager<Resource> > > |
| 64 // g_factory = LAZY_INSTANCE_INITIALIZER; | 64 // g_factory = LAZY_INSTANCE_INITIALIZER; |
| 65 // | 65 // |
| 66 // | 66 // |
| 67 // template <> | 67 // template <> |
| 68 // ProfileKeyedAPIFactory<ApiResourceManager<Resource> >* | 68 // ProfileKeyedAPIFactory<ApiResourceManager<Resource> >* |
| 69 // ApiResourceManager<Resource>::GetFactoryInstance() { | 69 // ApiResourceManager<Resource>::GetFactoryInstance() { |
| 70 // return &g_factory.Get(); | 70 // return g_factory.Pointer(); |
| 71 // } | 71 // } |
| 72 template <class T> | 72 template <class T> |
| 73 class ApiResourceManager : public ProfileKeyedAPI, | 73 class ApiResourceManager : public ProfileKeyedAPI, |
| 74 public base::NonThreadSafe, | 74 public base::NonThreadSafe, |
| 75 public content::NotificationObserver { | 75 public content::NotificationObserver { |
| 76 public: | 76 public: |
| 77 explicit ApiResourceManager(Profile* profile) | 77 explicit ApiResourceManager(Profile* profile) |
| 78 : thread_id_(T::kThreadId), | 78 : thread_id_(T::kThreadId), |
| 79 data_(new ApiResourceData(thread_id_)) { | 79 data_(new ApiResourceData(thread_id_)) { |
| 80 registrar_.Add( | 80 registrar_.Add( |
| (...skipping 244 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 325 }; | 325 }; |
| 326 | 326 |
| 327 content::BrowserThread::ID thread_id_; | 327 content::BrowserThread::ID thread_id_; |
| 328 content::NotificationRegistrar registrar_; | 328 content::NotificationRegistrar registrar_; |
| 329 scoped_refptr<ApiResourceData> data_; | 329 scoped_refptr<ApiResourceData> data_; |
| 330 }; | 330 }; |
| 331 | 331 |
| 332 } // namespace extensions | 332 } // namespace extensions |
| 333 | 333 |
| 334 #endif // CHROME_BROWSER_EXTENSIONS_API_API_RESOURCE_MANAGER_H_ | 334 #endif // CHROME_BROWSER_EXTENSIONS_API_API_RESOURCE_MANAGER_H_ |
| OLD | NEW |