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