This source file includes following definitions.
- GetForProfile
- GetInstance
- BuildServiceInstanceFor
#include "chrome/browser/ui/ash/app_sync_ui_state_factory.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/sync/profile_sync_service_factory.h"
#include "chrome/browser/ui/ash/app_sync_ui_state.h"
#include "components/keyed_service/content/browser_context_dependency_manager.h"
AppSyncUIState* AppSyncUIStateFactory::GetForProfile(Profile* profile) {
if (!AppSyncUIState::ShouldObserveAppSyncForProfile(profile))
return NULL;
return static_cast<AppSyncUIState*>(
GetInstance()->GetServiceForBrowserContext(profile, true));
}
AppSyncUIStateFactory* AppSyncUIStateFactory::GetInstance() {
return Singleton<AppSyncUIStateFactory>::get();
}
AppSyncUIStateFactory::AppSyncUIStateFactory()
: BrowserContextKeyedServiceFactory(
"AppSyncUIState",
BrowserContextDependencyManager::GetInstance()) {
DependsOn(ProfileSyncServiceFactory::GetInstance());
}
AppSyncUIStateFactory::~AppSyncUIStateFactory() {
}
KeyedService* AppSyncUIStateFactory::BuildServiceInstanceFor(
content::BrowserContext* context) const {
Profile* profile = static_cast<Profile*>(context);
DCHECK(AppSyncUIState::ShouldObserveAppSyncForProfile(profile));
return new AppSyncUIState(profile);
}