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

Side by Side Diff: chrome/browser/drive/drive_notification_manager_factory.cc

Issue 23514025: Use GetForBrowserContext instead of GetForProfile for DriveNotificationManager (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase & resolve conflict Created 7 years, 3 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 "chrome/browser/drive/drive_notification_manager_factory.h" 5 #include "chrome/browser/drive/drive_notification_manager_factory.h"
6 6
7 #include "chrome/browser/drive/drive_notification_manager.h" 7 #include "chrome/browser/drive/drive_notification_manager.h"
8 #include "chrome/browser/invalidation/invalidation_service_factory.h" 8 #include "chrome/browser/invalidation/invalidation_service_factory.h"
9 #include "chrome/browser/profiles/profile.h" 9 #include "chrome/browser/profiles/profile.h"
10 #include "chrome/browser/sync/profile_sync_service.h" 10 #include "chrome/browser/sync/profile_sync_service.h"
11 #include "chrome/browser/sync/profile_sync_service_factory.h" 11 #include "chrome/browser/sync/profile_sync_service_factory.h"
12 #include "components/browser_context_keyed_service/browser_context_dependency_ma nager.h" 12 #include "components/browser_context_keyed_service/browser_context_dependency_ma nager.h"
13 13
14 namespace drive { 14 namespace drive {
15 15
16 // static 16 // static
17 DriveNotificationManager* 17 DriveNotificationManager*
18 DriveNotificationManagerFactory::GetForProfile(Profile* profile) { 18 DriveNotificationManagerFactory::GetForBrowserContext(
19 content::BrowserContext* context) {
19 if (!ProfileSyncService::IsSyncEnabled()) 20 if (!ProfileSyncService::IsSyncEnabled())
20 return NULL; 21 return NULL;
21 22
22 return static_cast<DriveNotificationManager*>( 23 return static_cast<DriveNotificationManager*>(
23 GetInstance()->GetServiceForBrowserContext(profile, true)); 24 GetInstance()->GetServiceForBrowserContext(context, true));
24 } 25 }
25 26
26 // static 27 // static
27 DriveNotificationManagerFactory* 28 DriveNotificationManagerFactory*
28 DriveNotificationManagerFactory::GetInstance() { 29 DriveNotificationManagerFactory::GetInstance() {
29 return Singleton<DriveNotificationManagerFactory>::get(); 30 return Singleton<DriveNotificationManagerFactory>::get();
30 } 31 }
31 32
32 DriveNotificationManagerFactory::DriveNotificationManagerFactory() 33 DriveNotificationManagerFactory::DriveNotificationManagerFactory()
33 : BrowserContextKeyedServiceFactory( 34 : BrowserContextKeyedServiceFactory(
34 "DriveNotificationManager", 35 "DriveNotificationManager",
35 BrowserContextDependencyManager::GetInstance()) { 36 BrowserContextDependencyManager::GetInstance()) {
36 DependsOn(ProfileSyncServiceFactory::GetInstance()); 37 DependsOn(ProfileSyncServiceFactory::GetInstance());
37 DependsOn(invalidation::InvalidationServiceFactory::GetInstance()); 38 DependsOn(invalidation::InvalidationServiceFactory::GetInstance());
38 } 39 }
39 40
40 DriveNotificationManagerFactory::~DriveNotificationManagerFactory() {} 41 DriveNotificationManagerFactory::~DriveNotificationManagerFactory() {}
41 42
42 BrowserContextKeyedService* 43 BrowserContextKeyedService*
43 DriveNotificationManagerFactory::BuildServiceInstanceFor( 44 DriveNotificationManagerFactory::BuildServiceInstanceFor(
44 content::BrowserContext* profile) const { 45 content::BrowserContext* context) const {
45 return new DriveNotificationManager(static_cast<Profile*>(profile)); 46 return new DriveNotificationManager(
47 invalidation::InvalidationServiceFactory::GetForProfile(
48 Profile::FromBrowserContext(context)));
46 } 49 }
47 50
48 } // namespace drive 51 } // namespace drive
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698