This source file includes following definitions.
- FindForBrowserContext
- GetForBrowserContext
- GetInstance
- BuildServiceInstanceFor
#include "chrome/browser/drive/drive_notification_manager_factory.h"
#include "chrome/browser/drive/drive_notification_manager.h"
#include "chrome/browser/invalidation/invalidation_service_factory.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/sync/profile_sync_service.h"
#include "chrome/browser/sync/profile_sync_service_factory.h"
#include "components/keyed_service/content/browser_context_dependency_manager.h"
namespace drive {
DriveNotificationManager*
DriveNotificationManagerFactory::FindForBrowserContext(
content::BrowserContext* context) {
return static_cast<DriveNotificationManager*>(
GetInstance()->GetServiceForBrowserContext(context, false));
}
DriveNotificationManager*
DriveNotificationManagerFactory::GetForBrowserContext(
content::BrowserContext* context) {
if (!ProfileSyncService::IsSyncEnabled())
return NULL;
return static_cast<DriveNotificationManager*>(
GetInstance()->GetServiceForBrowserContext(context, true));
}
DriveNotificationManagerFactory*
DriveNotificationManagerFactory::GetInstance() {
return Singleton<DriveNotificationManagerFactory>::get();
}
DriveNotificationManagerFactory::DriveNotificationManagerFactory()
: BrowserContextKeyedServiceFactory(
"DriveNotificationManager",
BrowserContextDependencyManager::GetInstance()) {
DependsOn(ProfileSyncServiceFactory::GetInstance());
DependsOn(invalidation::InvalidationServiceFactory::GetInstance());
}
DriveNotificationManagerFactory::~DriveNotificationManagerFactory() {}
KeyedService* DriveNotificationManagerFactory::BuildServiceInstanceFor(
content::BrowserContext* context) const {
return new DriveNotificationManager(
invalidation::InvalidationServiceFactory::GetForProfile(
Profile::FromBrowserContext(context)));
}
}