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

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

Issue 10823212: Relanding this as this did not fix the chromiumos breakage. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: 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
===================================================================
--- chrome/browser/chromeos/login/policy_oauth_fetcher.cc (revision 150399)
+++ chrome/browser/chromeos/login/policy_oauth_fetcher.cc (working copy)
@@ -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::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();
+ if (cloud_policy_manager) {
+ if (token.empty())
+ cloud_policy_manager->CancelWaitForPolicyFetch();
+ else
+ cloud_policy_manager->RegisterClient(token);
+ }
}
} // namespace chromeos
« no previous file with comments | « chrome/browser/chromeos/login/login_utils_browsertest.cc ('k') | chrome/browser/policy/auto_enrollment_client.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698