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 |