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

Unified Diff: chrome/browser/chromeos/login/policy_oauth_fetcher.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/policy_oauth_fetcher.cc
diff --git a/chrome/browser/chromeos/login/policy_oauth_fetcher.cc b/chrome/browser/chromeos/login/policy_oauth_fetcher.cc
index deb93db0b4f261333fd21afd1c713c894fc377e9..add6120b5d70e4e1fa0d25f1335996ea9f99b799 100644
--- a/chrome/browser/chromeos/login/policy_oauth_fetcher.cc
+++ b/chrome/browser/chromeos/login/policy_oauth_fetcher.cc
@@ -7,7 +7,9 @@
#include "base/logging.h"
#include "chrome/browser/browser_process.h"
#include "chrome/browser/policy/browser_policy_connector.h"
+#include "chrome/browser/policy/user_cloud_policy_manager.h"
#include "chrome/browser/profiles/profile.h"
+#include "chrome/browser/profiles/profile_manager.h"
#include "chrome/common/net/gaia/gaia_constants.h"
#include "chrome/common/net/gaia/google_service_auth_error.h"
@@ -94,6 +96,18 @@ void PolicyOAuthFetcher::OnOAuthWrapBridgeFailure(
void PolicyOAuthFetcher::SetPolicyToken(const std::string& token) {
policy_token_ = token;
g_browser_process->browser_policy_connector()->RegisterForUserPolicy(token);
+
+ // The Profile object passed in to the constructor is destroyed after the
+ // login process is complete. Get the UserCloudPolicyManager from the user's
+ // default profile instead.
+ policy::UserCloudPolicyManager* cloud_policy_manager =
+ ProfileManager::GetDefaultProfile()->GetUserCloudPolicyManager();
Nikita (slow) 2012/08/07 16:35:09 User's default profile in context of Chrome OS whe
Andrew T Wilson (Slow) 2012/08/07 16:55:45 Yes. Once we've called UserManager->UserLoggedIn()
+ if (cloud_policy_manager) {
+ if (token.empty())
+ cloud_policy_manager->CancelWaitForPolicyFetch();
+ else
+ cloud_policy_manager->RegisterClient(token);
+ }
}
} // namespace chromeos

Powered by Google App Engine
This is Rietveld 408576698