| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "chrome/browser/ui/ash/app_sync_ui_state_factory.h" | 5 #include "chrome/browser/ui/ash/app_sync_ui_state_factory.h" |
| 6 | 6 |
| 7 #include "chrome/browser/profiles/profile.h" | 7 #include "chrome/browser/profiles/profile.h" |
| 8 #include "chrome/browser/sync/profile_sync_service_factory.h" | 8 #include "chrome/browser/sync/profile_sync_service_factory.h" |
| 9 #include "chrome/browser/ui/ash/app_sync_ui_state.h" | 9 #include "chrome/browser/ui/ash/app_sync_ui_state.h" |
| 10 #include "components/keyed_service/content/browser_context_dependency_manager.h" | 10 #include "components/keyed_service/content/browser_context_dependency_manager.h" |
| 11 #include "extensions/browser/extension_registry_factory.h" | 11 #include "extensions/browser/extension_registry_factory.h" |
| 12 | 12 |
| 13 // static | 13 // static |
| 14 AppSyncUIState* AppSyncUIStateFactory::GetForProfile(Profile* profile) { | 14 AppSyncUIState* AppSyncUIStateFactory::GetForProfile(Profile* profile) { |
| 15 if (!AppSyncUIState::ShouldObserveAppSyncForProfile(profile)) | 15 if (!AppSyncUIState::ShouldObserveAppSyncForProfile(profile)) |
| 16 return NULL; | 16 return NULL; |
| 17 | 17 |
| 18 return static_cast<AppSyncUIState*>( | 18 return static_cast<AppSyncUIState*>( |
| 19 GetInstance()->GetServiceForBrowserContext(profile, true)); | 19 GetInstance()->GetServiceForBrowserContext(profile, true)); |
| 20 } | 20 } |
| 21 | 21 |
| 22 // static | 22 // static |
| 23 AppSyncUIStateFactory* AppSyncUIStateFactory::GetInstance() { | 23 AppSyncUIStateFactory* AppSyncUIStateFactory::GetInstance() { |
| 24 return Singleton<AppSyncUIStateFactory>::get(); | 24 return base::Singleton<AppSyncUIStateFactory>::get(); |
| 25 } | 25 } |
| 26 | 26 |
| 27 AppSyncUIStateFactory::AppSyncUIStateFactory() | 27 AppSyncUIStateFactory::AppSyncUIStateFactory() |
| 28 : BrowserContextKeyedServiceFactory( | 28 : BrowserContextKeyedServiceFactory( |
| 29 "AppSyncUIState", | 29 "AppSyncUIState", |
| 30 BrowserContextDependencyManager::GetInstance()) { | 30 BrowserContextDependencyManager::GetInstance()) { |
| 31 DependsOn(extensions::ExtensionRegistryFactory::GetInstance()); | 31 DependsOn(extensions::ExtensionRegistryFactory::GetInstance()); |
| 32 DependsOn(ProfileSyncServiceFactory::GetInstance()); | 32 DependsOn(ProfileSyncServiceFactory::GetInstance()); |
| 33 } | 33 } |
| 34 | 34 |
| 35 AppSyncUIStateFactory::~AppSyncUIStateFactory() { | 35 AppSyncUIStateFactory::~AppSyncUIStateFactory() { |
| 36 } | 36 } |
| 37 | 37 |
| 38 KeyedService* AppSyncUIStateFactory::BuildServiceInstanceFor( | 38 KeyedService* AppSyncUIStateFactory::BuildServiceInstanceFor( |
| 39 content::BrowserContext* context) const { | 39 content::BrowserContext* context) const { |
| 40 Profile* profile = static_cast<Profile*>(context); | 40 Profile* profile = static_cast<Profile*>(context); |
| 41 DCHECK(AppSyncUIState::ShouldObserveAppSyncForProfile(profile)); | 41 DCHECK(AppSyncUIState::ShouldObserveAppSyncForProfile(profile)); |
| 42 return new AppSyncUIState(profile); | 42 return new AppSyncUIState(profile); |
| 43 } | 43 } |
| OLD | NEW |