| 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/browser_context_keyed_service/browser_context_dependency_ma
nager.h" | 10 #include "components/browser_context_keyed_service/browser_context_dependency_ma
nager.h" |
| 11 | 11 |
| 12 // static | 12 // static |
| 13 AppSyncUIState* AppSyncUIStateFactory::GetForProfile(Profile* profile) { | 13 AppSyncUIState* AppSyncUIStateFactory::GetForProfile(Profile* profile) { |
| 14 if (!AppSyncUIState::ShouldObserveAppSyncForProfile(profile)) | 14 if (!AppSyncUIState::ShouldObserveAppSyncForProfile(profile)) |
| 15 return NULL; | 15 return NULL; |
| 16 | 16 |
| 17 return static_cast<AppSyncUIState*>( | 17 return static_cast<AppSyncUIState*>( |
| 18 GetInstance()->GetServiceForProfile(profile, true)); | 18 GetInstance()->GetServiceForBrowserContext(profile, true)); |
| 19 } | 19 } |
| 20 | 20 |
| 21 // static | 21 // static |
| 22 AppSyncUIStateFactory* AppSyncUIStateFactory::GetInstance() { | 22 AppSyncUIStateFactory* AppSyncUIStateFactory::GetInstance() { |
| 23 return Singleton<AppSyncUIStateFactory>::get(); | 23 return Singleton<AppSyncUIStateFactory>::get(); |
| 24 } | 24 } |
| 25 | 25 |
| 26 AppSyncUIStateFactory::AppSyncUIStateFactory() | 26 AppSyncUIStateFactory::AppSyncUIStateFactory() |
| 27 : ProfileKeyedServiceFactory("AppSyncUIState", | 27 : BrowserContextKeyedServiceFactory("AppSyncUIState", |
| 28 ProfileDependencyManager::GetInstance()) { | 28 BrowserContextDependencyManager::GetInstance())
{ |
| 29 DependsOn(ProfileSyncServiceFactory::GetInstance()); | 29 DependsOn(ProfileSyncServiceFactory::GetInstance()); |
| 30 } | 30 } |
| 31 | 31 |
| 32 AppSyncUIStateFactory::~AppSyncUIStateFactory() { | 32 AppSyncUIStateFactory::~AppSyncUIStateFactory() { |
| 33 } | 33 } |
| 34 | 34 |
| 35 ProfileKeyedService* AppSyncUIStateFactory::BuildServiceInstanceFor( | 35 BrowserContextKeyedService* AppSyncUIStateFactory::BuildServiceInstanceFor( |
| 36 content::BrowserContext* context) const { | 36 content::BrowserContext* context) const { |
| 37 Profile* profile = static_cast<Profile*>(context); | 37 Profile* profile = static_cast<Profile*>(context); |
| 38 DCHECK(AppSyncUIState::ShouldObserveAppSyncForProfile(profile)); | 38 DCHECK(AppSyncUIState::ShouldObserveAppSyncForProfile(profile)); |
| 39 return new AppSyncUIState(profile); | 39 return new AppSyncUIState(profile); |
| 40 } | 40 } |
| OLD | NEW |