Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright 2014 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. | |
| 4 | |
| 5 #include "chrome/browser/chromeos/login/owner_settings_service_factory.h" | |
| 6 | |
| 7 #include "chrome/browser/chromeos/login/owner_settings_service.h" | |
| 8 #include "chrome/browser/chromeos/profiles/profile_helper.h" | |
| 9 #include "chrome/browser/profiles/profile.h" | |
| 10 #include "components/keyed_service/content/browser_context_dependency_manager.h" | |
| 11 | |
| 12 namespace chromeos { | |
| 13 | |
| 14 OwnerSettingsServiceFactory::OwnerSettingsServiceFactory() | |
| 15 : BrowserContextKeyedServiceFactory( | |
| 16 "OwnerSettingsService", | |
| 17 BrowserContextDependencyManager::GetInstance()) { | |
| 18 } | |
| 19 | |
| 20 OwnerSettingsServiceFactory::~OwnerSettingsServiceFactory() { | |
| 21 } | |
| 22 | |
| 23 // static | |
| 24 OwnerSettingsService* OwnerSettingsServiceFactory::GetForProfile( | |
| 25 Profile* profile) { | |
| 26 return static_cast<OwnerSettingsService*>( | |
| 27 GetInstance()->GetServiceForBrowserContext(profile, true)); | |
| 28 } | |
| 29 | |
| 30 // static | |
| 31 OwnerSettingsServiceFactory* OwnerSettingsServiceFactory::GetInstance() { | |
| 32 return Singleton<OwnerSettingsServiceFactory>::get(); | |
| 33 } | |
| 34 | |
| 35 // static | |
| 36 KeyedService* OwnerSettingsServiceFactory::BuildInstanceFor( | |
| 37 content::BrowserContext* browser_context) { | |
| 38 Profile* profile = static_cast<Profile*>(browser_context); | |
| 39 if (profile->IsGuestSession() || ProfileHelper::IsSigninProfile(profile)) | |
| 40 return new OwnerSettingsBaseService(); | |
|
Mattias Nissler (ping if slow)
2014/05/14 16:00:36
What happens if you just return NULL here?
ygorshenin1
2014/05/15 08:39:56
Done.
| |
| 41 return new OwnerSettingsService(profile); | |
| 42 } | |
| 43 | |
| 44 bool OwnerSettingsServiceFactory::ServiceIsCreatedWithBrowserContext() const { | |
| 45 return true; | |
| 46 } | |
| 47 | |
| 48 KeyedService* OwnerSettingsServiceFactory::BuildServiceInstanceFor( | |
| 49 content::BrowserContext* context) const { | |
| 50 return BuildInstanceFor(context); | |
| 51 } | |
| 52 | |
| 53 } // namespace chromeos | |
| OLD | NEW |