Index: chrome/browser/chromeos/login/owner_settings_service_factory.cc |
diff --git a/chrome/browser/chromeos/login/owner_settings_service_factory.cc b/chrome/browser/chromeos/login/owner_settings_service_factory.cc |
new file mode 100644 |
index 0000000000000000000000000000000000000000..53e62c2d7712e9a596cfdcab665b0f62314206c9 |
--- /dev/null |
+++ b/chrome/browser/chromeos/login/owner_settings_service_factory.cc |
@@ -0,0 +1,53 @@ |
+// Copyright 2014 The Chromium Authors. All rights reserved. |
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+#include "chrome/browser/chromeos/login/owner_settings_service_factory.h" |
+ |
+#include "chrome/browser/chromeos/login/owner_settings_service.h" |
+#include "chrome/browser/chromeos/profiles/profile_helper.h" |
+#include "chrome/browser/profiles/profile.h" |
+#include "components/keyed_service/content/browser_context_dependency_manager.h" |
+ |
+namespace chromeos { |
+ |
+OwnerSettingsServiceFactory::OwnerSettingsServiceFactory() |
+ : BrowserContextKeyedServiceFactory( |
+ "OwnerSettingsService", |
+ BrowserContextDependencyManager::GetInstance()) { |
+} |
+ |
+OwnerSettingsServiceFactory::~OwnerSettingsServiceFactory() { |
+} |
+ |
+// static |
+OwnerSettingsService* OwnerSettingsServiceFactory::GetForProfile( |
+ Profile* profile) { |
+ return static_cast<OwnerSettingsService*>( |
+ GetInstance()->GetServiceForBrowserContext(profile, true)); |
+} |
+ |
+// static |
+OwnerSettingsServiceFactory* OwnerSettingsServiceFactory::GetInstance() { |
+ return Singleton<OwnerSettingsServiceFactory>::get(); |
+} |
+ |
+// static |
+KeyedService* OwnerSettingsServiceFactory::BuildInstanceFor( |
+ content::BrowserContext* browser_context) { |
+ Profile* profile = static_cast<Profile*>(browser_context); |
+ if (profile->IsGuestSession() || ProfileHelper::IsSigninProfile(profile)) |
+ 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.
|
+ return new OwnerSettingsService(profile); |
+} |
+ |
+bool OwnerSettingsServiceFactory::ServiceIsCreatedWithBrowserContext() const { |
+ return true; |
+} |
+ |
+KeyedService* OwnerSettingsServiceFactory::BuildServiceInstanceFor( |
+ content::BrowserContext* context) const { |
+ return BuildInstanceFor(context); |
+} |
+ |
+} // namespace chromeos |