No longer register app window placement preference keys on
[chromium-blink-merge.git] / chrome / browser / ui / ash / app_sync_ui_state_factory.cc
blob89e560538fc61228a84e05ebc350d4dc887248a1
1 // Copyright (c) 2012 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/ui/ash/app_sync_ui_state_factory.h"
7 #include "chrome/browser/profiles/profile.h"
8 #include "chrome/browser/sync/profile_sync_service_factory.h"
9 #include "chrome/browser/ui/ash/app_sync_ui_state.h"
10 #include "components/keyed_service/content/browser_context_dependency_manager.h"
11 #include "extensions/browser/extension_registry_factory.h"
13 // static
14 AppSyncUIState* AppSyncUIStateFactory::GetForProfile(Profile* profile) {
15 if (!AppSyncUIState::ShouldObserveAppSyncForProfile(profile))
16 return NULL;
18 return static_cast<AppSyncUIState*>(
19 GetInstance()->GetServiceForBrowserContext(profile, true));
22 // static
23 AppSyncUIStateFactory* AppSyncUIStateFactory::GetInstance() {
24 return Singleton<AppSyncUIStateFactory>::get();
27 AppSyncUIStateFactory::AppSyncUIStateFactory()
28 : BrowserContextKeyedServiceFactory(
29 "AppSyncUIState",
30 BrowserContextDependencyManager::GetInstance()) {
31 DependsOn(extensions::ExtensionRegistryFactory::GetInstance());
32 DependsOn(ProfileSyncServiceFactory::GetInstance());
35 AppSyncUIStateFactory::~AppSyncUIStateFactory() {
38 KeyedService* AppSyncUIStateFactory::BuildServiceInstanceFor(
39 content::BrowserContext* context) const {
40 Profile* profile = static_cast<Profile*>(context);
41 DCHECK(AppSyncUIState::ShouldObserveAppSyncForProfile(profile));
42 return new AppSyncUIState(profile);