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

Unified Diff: chrome/browser/policy/user_policy_signin_service_factory.cc

Issue 10693022: Add support for loading user cloud policy on desktop. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Tweaked some comments after self-review. Created 8 years, 5 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/policy/user_policy_signin_service_factory.cc
diff --git a/chrome/browser/policy/user_policy_signin_service_factory.cc b/chrome/browser/policy/user_policy_signin_service_factory.cc
new file mode 100644
index 0000000000000000000000000000000000000000..34cb028c2ee1e005144f69a81bd7e1e7fe573917
--- /dev/null
+++ b/chrome/browser/policy/user_policy_signin_service_factory.cc
@@ -0,0 +1,56 @@
+// Copyright (c) 2012 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/policy/user_policy_signin_service_factory.h"
+
+#include "chrome/browser/policy/user_policy_signin_service.h"
+#include "chrome/browser/prefs/pref_service.h"
+#include "chrome/browser/profiles/profile.h"
+#include "chrome/browser/profiles/profile_dependency_manager.h"
+#include "chrome/browser/signin/signin_manager_factory.h"
+#include "chrome/browser/signin/token_service_factory.h"
+#include "chrome/common/pref_names.h"
+
+namespace policy {
+
+UserPolicySigninServiceFactory::UserPolicySigninServiceFactory()
+ : ProfileKeyedServiceFactory("UserPolicySigninService",
+ ProfileDependencyManager::GetInstance()) {
+ DependsOn(TokenServiceFactory::GetInstance());
+ DependsOn(SigninManagerFactory::GetInstance());
+}
+
+UserPolicySigninServiceFactory::~UserPolicySigninServiceFactory() {}
+
+// static
+UserPolicySigninService* UserPolicySigninServiceFactory::GetForProfile(
+ Profile* profile) {
+ return static_cast<UserPolicySigninService*>(
+ GetInstance()->GetServiceForProfile(profile, true));
+}
+
+// static
+UserPolicySigninServiceFactory* UserPolicySigninServiceFactory::GetInstance() {
+ return Singleton<UserPolicySigninServiceFactory>::get();
+}
+
+ProfileKeyedService* UserPolicySigninServiceFactory::BuildServiceInstanceFor(
+ Profile* profile) const {
+ return new UserPolicySigninService(profile,
+ profile->GetUserCloudPolicyManager());
+}
+
+bool UserPolicySigninServiceFactory::ServiceIsCreatedWithProfile() {
+ // Create this object when the profile is created so it can track any
+ // user signin activity.
+ return true;
+}
+
+void UserPolicySigninServiceFactory::RegisterUserPrefs(
+ PrefService* user_prefs) {
+ user_prefs->RegisterBooleanPref(prefs::kLoadCloudPolicyOnSignin,
+ false, PrefService::UNSYNCABLE_PREF);
+}
+
+} // namespace policy

Powered by Google App Engine
This is Rietveld 408576698