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

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

Issue 10693022: Add support for loading user cloud policy on desktop. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: removed redundant #ifdef OS_CHROMEOS guard Created 8 years, 4 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/login_utils.cc
diff --git a/chrome/browser/chromeos/login/login_utils.cc b/chrome/browser/chromeos/login/login_utils.cc
index b7e8bc8f8793907ae98d0d05e4651698f5011f71..047e67ff1b46c8206dd359bb57067c27aee28bdb 100644
--- a/chrome/browser/chromeos/login/login_utils.cc
+++ b/chrome/browser/chromeos/login/login_utils.cc
@@ -49,6 +49,9 @@
#include "chrome/browser/net/chrome_url_request_context.h"
#include "chrome/browser/net/preconnect.h"
#include "chrome/browser/policy/browser_policy_connector.h"
+#include "chrome/browser/policy/cloud_policy_client.h"
+#include "chrome/browser/policy/cloud_policy_service.h"
+#include "chrome/browser/policy/user_cloud_policy_manager.h"
#include "chrome/browser/prefs/pref_member.h"
#include "chrome/browser/prefs/pref_service.h"
#include "chrome/browser/profiles/profile.h"
@@ -487,6 +490,23 @@ void LoginUtilsImpl::PrepareProfile(
// initialization code sees the cached policy settings.
connector->InitializeUserPolicy(username, wait_for_policy_fetch);
+ // The default profile will have been changed because the ProfileManager
+ // will process the notification that the UserManager sends out.
+ ProfileManager::CreateDefaultProfileAsync(
+ base::Bind(&LoginUtilsImpl::OnProfileCreated, AsWeakPtr()));
+
+ // The default profile is only partially initialized at this point.
+ // Setup the UserCloudPolicyManager so profile initialization can complete.
+ Profile* user_profile = ProfileManager::GetDefaultProfile();
Nikita (slow) 2012/08/07 16:35:09 Please make sure that you're grabbing the correct
Andrew T Wilson (Slow) 2012/08/07 16:55:45 Yes. Before we call this, the code above calls Use
+
+ // Initialize the new cloud policy framework, if enabled.
+ if (user_profile->GetUserCloudPolicyManager()) {
+ user_profile->GetUserCloudPolicyManager()->Initialize(
+ g_browser_process->local_state(),
+ connector->device_management_service(),
+ connector->GetUserAffiliation(username));
+ }
+
if (wait_for_policy_fetch) {
// Profile creation will block until user policy is fetched, which
// requires the DeviceManagement token. Try to fetch it now.
@@ -495,11 +515,6 @@ void LoginUtilsImpl::PrepareProfile(
new PolicyOAuthFetcher(authenticator_->authentication_profile()));
policy_oauth_fetcher_->Start();
}
-
- // The default profile will have been changed because the ProfileManager
- // will process the notification that the UserManager sends out.
- ProfileManager::CreateDefaultProfileAsync(
- base::Bind(&LoginUtilsImpl::OnProfileCreated, AsWeakPtr()));
}
void LoginUtilsImpl::DelegateDeleted(LoginUtils::Delegate* delegate) {

Powered by Google App Engine
This is Rietveld 408576698