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

Side by Side Diff: chrome/browser/chromeos/login/enterprise_enrollment_screen.cc

Issue 6882038: Move writing information to the lockbox after registering with the DM server. (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: Fixed nits and rebase issues. Created 9 years, 8 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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/enterprise_enrollment_screen.h" 5 #include "chrome/browser/chromeos/login/enterprise_enrollment_screen.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "chrome/browser/browser_process.h" 8 #include "chrome/browser/browser_process.h"
9 #include "chrome/browser/chromeos/cros/cros_library.h" 9 #include "chrome/browser/chromeos/cros/cros_library.h"
10 #include "chrome/browser/chromeos/cros/cryptohome_library.h" 10 #include "chrome/browser/chromeos/cros/cryptohome_library.h"
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
93 } 93 }
94 } 94 }
95 LOG(ERROR) << "Enrollment will not finish because the InstallAttrs has " 95 LOG(ERROR) << "Enrollment will not finish because the InstallAttrs has "
96 << "been locked already but does not contain valid data."; 96 << "been locked already but does not contain valid data.";
97 } 97 }
98 return false; 98 return false;
99 } 99 }
100 100
101 void EnterpriseEnrollmentScreen::OnClientLoginSuccess( 101 void EnterpriseEnrollmentScreen::OnClientLoginSuccess(
102 const ClientLoginResult& result) { 102 const ClientLoginResult& result) {
103 WriteInstallAttributesData(result); 103 auth_fetcher_->StartIssueAuthToken(
104 result.sid, result.lsid, GaiaConstants::kDeviceManagementService);
104 } 105 }
105 106
106 void EnterpriseEnrollmentScreen::OnClientLoginFailure( 107 void EnterpriseEnrollmentScreen::OnClientLoginFailure(
107 const GoogleServiceAuthError& error) { 108 const GoogleServiceAuthError& error) {
108 HandleAuthError(error); 109 HandleAuthError(error);
109 } 110 }
110 111
111 void EnterpriseEnrollmentScreen::OnIssueAuthTokenSuccess( 112 void EnterpriseEnrollmentScreen::OnIssueAuthTokenSuccess(
112 const std::string& service, 113 const std::string& service,
113 const std::string& auth_token) { 114 const std::string& auth_token) {
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
158 case policy::CloudPolicySubsystem::BAD_GAIA_TOKEN: 159 case policy::CloudPolicySubsystem::BAD_GAIA_TOKEN:
159 case policy::CloudPolicySubsystem::LOCAL_ERROR: 160 case policy::CloudPolicySubsystem::LOCAL_ERROR:
160 view()->ShowFatalEnrollmentError(); 161 view()->ShowFatalEnrollmentError();
161 break; 162 break;
162 case policy::CloudPolicySubsystem::UNMANAGED: 163 case policy::CloudPolicySubsystem::UNMANAGED:
163 view()->ShowAccountError(); 164 view()->ShowAccountError();
164 break; 165 break;
165 case policy::CloudPolicySubsystem::NETWORK_ERROR: 166 case policy::CloudPolicySubsystem::NETWORK_ERROR:
166 view()->ShowNetworkEnrollmentError(); 167 view()->ShowNetworkEnrollmentError();
167 break; 168 break;
169 case policy::CloudPolicySubsystem::TOKEN_FETCHED:
170 WriteInstallAttributesData();
171 return;
168 case policy::CloudPolicySubsystem::SUCCESS: 172 case policy::CloudPolicySubsystem::SUCCESS:
169 // Success! 173 // Success!
170 registrar_.reset(); 174 registrar_.reset();
171 view()->ShowConfirmationScreen(); 175 view()->ShowConfirmationScreen();
172 return; 176 return;
173 } 177 }
174 178
175 // We have an error. 179 // We have an error.
176 LOG(WARNING) << "Policy subsystem error during enrollment: " << state 180 LOG(WARNING) << "Policy subsystem error during enrollment: " << state
177 << " details: " << error_details; 181 << " details: " << error_details;
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
212 // fall through. 216 // fall through.
213 case GoogleServiceAuthError::REQUEST_CANCELED: 217 case GoogleServiceAuthError::REQUEST_CANCELED:
214 LOG(ERROR) << "Unexpected GAIA auth error: " << error.state(); 218 LOG(ERROR) << "Unexpected GAIA auth error: " << error.state();
215 view()->ShowFatalAuthError(); 219 view()->ShowFatalAuthError();
216 return; 220 return;
217 } 221 }
218 222
219 NOTREACHED() << error.state(); 223 NOTREACHED() << error.state();
220 } 224 }
221 225
222 void EnterpriseEnrollmentScreen::WriteInstallAttributesData( 226 void EnterpriseEnrollmentScreen::WriteInstallAttributesData() {
223 const ClientLoginResult& result) {
224 // Since this method is also called directly. 227 // Since this method is also called directly.
225 runnable_method_factory_.RevokeAll(); 228 runnable_method_factory_.RevokeAll();
226 229
227 if (!view()) 230 if (!view())
228 return; 231 return;
229 232
230 switch (g_browser_process->browser_policy_connector()->LockDevice(user_)) { 233 switch (g_browser_process->browser_policy_connector()->LockDevice(user_)) {
231 case policy::EnterpriseInstallAttributes::LOCK_SUCCESS: 234 case policy::EnterpriseInstallAttributes::LOCK_SUCCESS: {
232 // Proceed with register and policy fetch. 235 // Proceed with policy fetch.
233 auth_fetcher_->StartIssueAuthToken( 236 policy::BrowserPolicyConnector* connector =
234 result.sid, result.lsid, GaiaConstants::kDeviceManagementService); 237 g_browser_process->browser_policy_connector();
238 connector->FetchPolicy();
235 return; 239 return;
236 case policy::EnterpriseInstallAttributes::LOCK_NOT_READY: 240 }
241 case policy::EnterpriseInstallAttributes::LOCK_NOT_READY: {
237 // InstallAttributes not ready yet, retry later. 242 // InstallAttributes not ready yet, retry later.
238 LOG(WARNING) << "Install Attributes not ready yet will retry in " 243 LOG(WARNING) << "Install Attributes not ready yet will retry in "
239 << kLockRetryIntervalMs << "ms."; 244 << kLockRetryIntervalMs << "ms.";
240 MessageLoop::current()->PostDelayedTask( 245 MessageLoop::current()->PostDelayedTask(
241 FROM_HERE, 246 FROM_HERE,
242 runnable_method_factory_.NewRunnableMethod( 247 runnable_method_factory_.NewRunnableMethod(
243 &EnterpriseEnrollmentScreen::WriteInstallAttributesData, result), 248 &EnterpriseEnrollmentScreen::WriteInstallAttributesData),
244 kLockRetryIntervalMs); 249 kLockRetryIntervalMs);
245 return; 250 return;
246 case policy::EnterpriseInstallAttributes::LOCK_BACKEND_ERROR: 251 }
252 case policy::EnterpriseInstallAttributes::LOCK_BACKEND_ERROR: {
247 view()->ShowFatalEnrollmentError(); 253 view()->ShowFatalEnrollmentError();
248 return; 254 return;
249 case policy::EnterpriseInstallAttributes::LOCK_WRONG_USER: 255 }
256 case policy::EnterpriseInstallAttributes::LOCK_WRONG_USER: {
250 LOG(ERROR) << "Enrollment can not proceed because the InstallAttrs " 257 LOG(ERROR) << "Enrollment can not proceed because the InstallAttrs "
251 << "has been locked already!"; 258 << "has been locked already!";
252 view()->ShowFatalEnrollmentError(); 259 view()->ShowFatalEnrollmentError();
253 return; 260 return;
261 }
254 } 262 }
255 263
256 NOTREACHED(); 264 NOTREACHED();
257 } 265 }
258 266
259 } // namespace chromeos 267 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698