| OLD | NEW |
| 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" | |
| 9 #include "chrome/browser/profiles/profile.h" | 8 #include "chrome/browser/profiles/profile.h" |
| 10 #include "chrome/browser/sync/profile_sync_service.h" | 9 #include "chrome/browser/sync/profile_sync_service.h" |
| 11 #include "chrome/browser/sync/profile_sync_service_factory.h" | 10 #include "chrome/browser/sync/profile_sync_service_factory.h" |
| 12 #include "components/browser_context_keyed_service/browser_context_dependency_ma
nager.h" | 11 #include "components/browser_context_keyed_service/browser_context_dependency_ma
nager.h" |
| 13 | 12 |
| 14 namespace drive { | 13 namespace drive { |
| 15 | 14 |
| 16 // static | 15 // static |
| 17 DriveNotificationManager* | 16 DriveNotificationManager* |
| 18 DriveNotificationManagerFactory::GetForProfile(Profile* profile) { | 17 DriveNotificationManagerFactory::GetForProfile(Profile* profile) { |
| 19 if (!ProfileSyncService::IsSyncEnabled()) | 18 if (!ProfileSyncService::IsSyncEnabled()) |
| 20 return NULL; | 19 return NULL; |
| 21 | 20 |
| 22 return static_cast<DriveNotificationManager*>( | 21 return static_cast<DriveNotificationManager*>( |
| 23 GetInstance()->GetServiceForBrowserContext(profile, true)); | 22 GetInstance()->GetServiceForBrowserContext(profile, true)); |
| 24 } | 23 } |
| 25 | 24 |
| 26 // static | 25 // static |
| 27 DriveNotificationManagerFactory* | 26 DriveNotificationManagerFactory* |
| 28 DriveNotificationManagerFactory::GetInstance() { | 27 DriveNotificationManagerFactory::GetInstance() { |
| 29 return Singleton<DriveNotificationManagerFactory>::get(); | 28 return Singleton<DriveNotificationManagerFactory>::get(); |
| 30 } | 29 } |
| 31 | 30 |
| 32 DriveNotificationManagerFactory::DriveNotificationManagerFactory() | 31 DriveNotificationManagerFactory::DriveNotificationManagerFactory() |
| 33 : BrowserContextKeyedServiceFactory( | 32 : BrowserContextKeyedServiceFactory( |
| 34 "DriveNotificationManager", | 33 "DriveNotificationManager", |
| 35 BrowserContextDependencyManager::GetInstance()) { | 34 BrowserContextDependencyManager::GetInstance()) { |
| 36 DependsOn(ProfileSyncServiceFactory::GetInstance()); | 35 DependsOn(ProfileSyncServiceFactory::GetInstance()); |
| 37 DependsOn(invalidation::InvalidationServiceFactory::GetInstance()); | |
| 38 } | 36 } |
| 39 | 37 |
| 40 DriveNotificationManagerFactory::~DriveNotificationManagerFactory() {} | 38 DriveNotificationManagerFactory::~DriveNotificationManagerFactory() {} |
| 41 | 39 |
| 42 BrowserContextKeyedService* | 40 BrowserContextKeyedService* |
| 43 DriveNotificationManagerFactory::BuildServiceInstanceFor( | 41 DriveNotificationManagerFactory::BuildServiceInstanceFor( |
| 44 content::BrowserContext* profile) const { | 42 content::BrowserContext* profile) const { |
| 45 return new DriveNotificationManager(static_cast<Profile*>(profile)); | 43 return new DriveNotificationManager(static_cast<Profile*>(profile)); |
| 46 } | 44 } |
| 47 | 45 |
| 48 } // namespace drive | 46 } // namespace drive |
| OLD | NEW |