Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1703)

Side by Side Diff: chrome/browser/extensions/api/api_resource_manager.h

Issue 179243002: Change ProfileKeyedAPIFactory to build instances with BrowserContext instead of Profile. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: locationbarview Created 6 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
81 chrome::NOTIFICATION_EXTENSION_UNLOADED, 81 chrome::NOTIFICATION_EXTENSION_UNLOADED,
82 content::NotificationService::AllSources()); 82 content::NotificationService::AllSources());
83 registrar_.Add( 83 registrar_.Add(
84 this, 84 this,
85 chrome::NOTIFICATION_EXTENSION_HOST_DESTROYED, 85 chrome::NOTIFICATION_EXTENSION_HOST_DESTROYED,
86 content::NotificationService::AllSources()); 86 content::NotificationService::AllSources());
87 } 87 }
88 88
89 // For Testing. 89 // For Testing.
90 static ApiResourceManager<T>* CreateApiResourceManagerForTest( 90 static ApiResourceManager<T>* CreateApiResourceManagerForTest(
91 Profile* profile, 91 content::BrowserContext* context,
92 content::BrowserThread::ID thread_id) { 92 content::BrowserThread::ID thread_id) {
93 ApiResourceManager* manager = new ApiResourceManager<T>(profile); 93 ApiResourceManager* manager = new ApiResourceManager<T>(context);
94 manager->thread_id_ = thread_id; 94 manager->thread_id_ = thread_id;
95 manager->data_ = new ApiResourceData(thread_id); 95 manager->data_ = new ApiResourceData(thread_id);
96 return manager; 96 return manager;
97 } 97 }
98 98
99 virtual ~ApiResourceManager() { 99 virtual ~ApiResourceManager() {
100 DCHECK(CalledOnValidThread()); 100 DCHECK(CalledOnValidThread());
101 DCHECK(content::BrowserThread::IsMessageLoopValid(thread_id_)) << 101 DCHECK(content::BrowserThread::IsMessageLoopValid(thread_id_)) <<
102 "A unit test is using an ApiResourceManager but didn't provide " 102 "A unit test is using an ApiResourceManager but didn't provide "
103 "the thread message loop needed for that kind of resource. " 103 "the thread message loop needed for that kind of resource. "
(...skipping 220 matching lines...) Expand 10 before | Expand all | Expand 10 after
324 }; 324 };
325 325
326 content::BrowserThread::ID thread_id_; 326 content::BrowserThread::ID thread_id_;
327 content::NotificationRegistrar registrar_; 327 content::NotificationRegistrar registrar_;
328 scoped_refptr<ApiResourceData> data_; 328 scoped_refptr<ApiResourceData> data_;
329 }; 329 };
330 330
331 } // namespace extensions 331 } // namespace extensions
332 332
333 #endif // CHROME_BROWSER_EXTENSIONS_API_API_RESOURCE_MANAGER_H_ 333 #endif // CHROME_BROWSER_EXTENSIONS_API_API_RESOURCE_MANAGER_H_
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/extensions/screenlock_private_api.cc ('k') | chrome/browser/extensions/api/audio/audio_api.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698