Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1066)

Unified Diff: chrome/browser/chromeos/login/owner_settings_service_factory.cc

Issue 270663002: Implemented profile-aware owner key loading. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fixes. Created 6 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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

Powered by Google App Engine
This is Rietveld 408576698