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
3 // found in the LICENSE file.
5 #include "chrome/browser/drive/drive_notification_manager_factory.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"
10 #include "chrome/browser/sync/profile_sync_service.h"
11 #include "chrome/browser/sync/profile_sync_service_factory.h"
12 #include "components/browser_context_keyed_service/browser_context_dependency_manager.h"
17 DriveNotificationManager
*
18 DriveNotificationManagerFactory::GetForBrowserContext(
19 content::BrowserContext
* context
) {
20 if (!ProfileSyncService::IsSyncEnabled())
23 return static_cast<DriveNotificationManager
*>(
24 GetInstance()->GetServiceForBrowserContext(context
, true));
28 DriveNotificationManagerFactory
*
29 DriveNotificationManagerFactory::GetInstance() {
30 return Singleton
<DriveNotificationManagerFactory
>::get();
33 DriveNotificationManagerFactory::DriveNotificationManagerFactory()
34 : BrowserContextKeyedServiceFactory(
35 "DriveNotificationManager",
36 BrowserContextDependencyManager::GetInstance()) {
37 DependsOn(ProfileSyncServiceFactory::GetInstance());
38 DependsOn(invalidation::InvalidationServiceFactory::GetInstance());
41 DriveNotificationManagerFactory::~DriveNotificationManagerFactory() {}
43 BrowserContextKeyedService
*
44 DriveNotificationManagerFactory::BuildServiceInstanceFor(
45 content::BrowserContext
* context
) const {
46 return new DriveNotificationManager(
47 invalidation::InvalidationServiceFactory::GetForProfile(
48 Profile::FromBrowserContext(context
)));