| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "chrome/browser/chromeos/login/oauth2_policy_fetcher.h" | 5 #include "chrome/browser/chromeos/login/oauth2_policy_fetcher.h" |
| 6 | 6 |
| 7 #include <vector> | 7 #include <vector> |
| 8 | 8 |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "base/string_util.h" | 10 #include "base/string_util.h" |
| (...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 134 LOG(ERROR) << "Unrecoverable error or retry count max reached."; | 134 LOG(ERROR) << "Unrecoverable error or retry count max reached."; |
| 135 SetPolicyToken(EmptyString()); | 135 SetPolicyToken(EmptyString()); |
| 136 failed_ = true; | 136 failed_ = true; |
| 137 } | 137 } |
| 138 | 138 |
| 139 void OAuth2PolicyFetcher::SetPolicyToken(const std::string& token) { | 139 void OAuth2PolicyFetcher::SetPolicyToken(const std::string& token) { |
| 140 policy_token_ = token; | 140 policy_token_ = token; |
| 141 | 141 |
| 142 policy::BrowserPolicyConnector* browser_policy_connector = | 142 policy::BrowserPolicyConnector* browser_policy_connector = |
| 143 g_browser_process->browser_policy_connector(); | 143 g_browser_process->browser_policy_connector(); |
| 144 browser_policy_connector->RegisterForUserPolicy(token); | |
| 145 | |
| 146 policy::UserCloudPolicyManagerChromeOS* cloud_policy_manager = | 144 policy::UserCloudPolicyManagerChromeOS* cloud_policy_manager = |
| 147 browser_policy_connector->GetUserCloudPolicyManager(); | 145 browser_policy_connector->GetUserCloudPolicyManager(); |
| 148 if (cloud_policy_manager) { | 146 if (cloud_policy_manager) { |
| 149 if (token.empty()) | 147 if (token.empty()) |
| 150 cloud_policy_manager->CancelWaitForPolicyFetch(); | 148 cloud_policy_manager->CancelWaitForPolicyFetch(); |
| 151 else | 149 else |
| 152 cloud_policy_manager->RegisterClient(token); | 150 cloud_policy_manager->RegisterClient(token); |
| 153 } | 151 } |
| 154 } | 152 } |
| 155 | 153 |
| 156 } // namespace chromeos | 154 } // namespace chromeos |
| OLD | NEW |