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

Side by Side Diff: chrome/browser/extensions/api/image_writer_private/operation_manager.cc

Issue 166053003: Move ProfileKeyedAPI implementations to take BrowserContext in the constructor (part 2). (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: | Created 6 years, 10 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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 #include "base/lazy_instance.h" 5 #include "base/lazy_instance.h"
6 #include "chrome/browser/browser_process.h" 6 #include "chrome/browser/browser_process.h"
7 #include "chrome/browser/chrome_notification_types.h" 7 #include "chrome/browser/chrome_notification_types.h"
8 #include "chrome/browser/extensions/api/image_writer_private/destroy_partitions_ operation.h" 8 #include "chrome/browser/extensions/api/image_writer_private/destroy_partitions_ operation.h"
9 #include "chrome/browser/extensions/api/image_writer_private/error_messages.h" 9 #include "chrome/browser/extensions/api/image_writer_private/error_messages.h"
10 #include "chrome/browser/extensions/api/image_writer_private/operation.h" 10 #include "chrome/browser/extensions/api/image_writer_private/operation.h"
11 #include "chrome/browser/extensions/api/image_writer_private/operation_manager.h " 11 #include "chrome/browser/extensions/api/image_writer_private/operation_manager.h "
12 #include "chrome/browser/extensions/api/image_writer_private/write_from_file_ope ration.h" 12 #include "chrome/browser/extensions/api/image_writer_private/write_from_file_ope ration.h"
13 #include "chrome/browser/extensions/api/image_writer_private/write_from_url_oper ation.h" 13 #include "chrome/browser/extensions/api/image_writer_private/write_from_url_oper ation.h"
14 #include "chrome/browser/extensions/event_router_forwarder.h" 14 #include "chrome/browser/extensions/event_router_forwarder.h"
15 #include "chrome/browser/extensions/extension_host.h" 15 #include "chrome/browser/extensions/extension_host.h"
16 #include "chrome/browser/extensions/extension_service.h" 16 #include "chrome/browser/extensions/extension_service.h"
17 #include "chrome/browser/profiles/profile.h"
17 #include "content/public/browser/browser_thread.h" 18 #include "content/public/browser/browser_thread.h"
18 #include "content/public/browser/notification_service.h" 19 #include "content/public/browser/notification_service.h"
19 #include "extensions/browser/event_router.h" 20 #include "extensions/browser/event_router.h"
20 #include "extensions/browser/extension_system.h" 21 #include "extensions/browser/extension_system.h"
21 22
22 namespace image_writer_api = extensions::api::image_writer_private; 23 namespace image_writer_api = extensions::api::image_writer_private;
23 24
24 namespace extensions { 25 namespace extensions {
25 namespace image_writer { 26 namespace image_writer {
26 27
27 using content::BrowserThread; 28 using content::BrowserThread;
28 29
29 OperationManager::OperationManager(Profile* profile) 30 OperationManager::OperationManager(content::BrowserContext* context)
30 : profile_(profile), 31 : profile_(Profile::FromBrowserContext(context)), weak_factory_(this) {
31 weak_factory_(this) {
32 registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_UNINSTALLED, 32 registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_UNINSTALLED,
33 content::Source<Profile>(profile_)); 33 content::Source<Profile>(profile_));
34 registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_UNLOADED, 34 registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_UNLOADED,
35 content::Source<Profile>(profile_)); 35 content::Source<Profile>(profile_));
36 registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_PROCESS_TERMINATED, 36 registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_PROCESS_TERMINATED,
37 content::Source<Profile>(profile_)); 37 content::Source<Profile>(profile_));
38 registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_HOST_VIEW_SHOULD_CLOSE, 38 registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_HOST_VIEW_SHOULD_CLOSE,
39 content::Source<Profile>(profile_)); 39 content::Source<Profile>(profile_));
40 registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_HOST_DESTROYED, 40 registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_HOST_DESTROYED,
41 content::Source<Profile>(profile_)); 41 content::Source<Profile>(profile_));
(...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after
231 content::Details<ExtensionHost>(details)->extension()->id()); 231 content::Details<ExtensionHost>(details)->extension()->id());
232 break; 232 break;
233 } 233 }
234 default: { 234 default: {
235 NOTREACHED(); 235 NOTREACHED();
236 break; 236 break;
237 } 237 }
238 } 238 }
239 } 239 }
240 240
241 OperationManager* OperationManager::Get(Profile* profile) { 241 OperationManager* OperationManager::Get(content::BrowserContext* context) {
242 return ProfileKeyedAPIFactory<OperationManager>:: 242 return ProfileKeyedAPIFactory<OperationManager>::GetForProfile(context);
243 GetForProfile(profile);
244 } 243 }
245 244
246 static base::LazyInstance<ProfileKeyedAPIFactory<OperationManager> > 245 static base::LazyInstance<ProfileKeyedAPIFactory<OperationManager> >
247 g_factory = LAZY_INSTANCE_INITIALIZER; 246 g_factory = LAZY_INSTANCE_INITIALIZER;
248 247
249 ProfileKeyedAPIFactory<OperationManager>* 248 ProfileKeyedAPIFactory<OperationManager>*
250 OperationManager::GetFactoryInstance() { 249 OperationManager::GetFactoryInstance() {
251 return g_factory.Pointer(); 250 return g_factory.Pointer();
252 } 251 }
253 252
254 253
255 } // namespace image_writer 254 } // namespace image_writer
256 } // namespace extensions 255 } // namespace extensions
OLDNEW
« no previous file with comments | « chrome/browser/extensions/api/image_writer_private/operation_manager.h ('k') | chrome/browser/extensions/api/input/input.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698