Disable view source for Developer Tools.
[chromium-blink-merge.git] / chrome / browser / drive / drive_notification_manager_factory.cc
blob3583773061252885dca138fcb95d1e059cd31008
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"
14 namespace drive {
16 // static
17 DriveNotificationManager*
18 DriveNotificationManagerFactory::GetForBrowserContext(
19 content::BrowserContext* context) {
20 if (!ProfileSyncService::IsSyncEnabled())
21 return NULL;
23 return static_cast<DriveNotificationManager*>(
24 GetInstance()->GetServiceForBrowserContext(context, true));
27 // static
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)));
51 } // namespace drive