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

Side by Side Diff: chrome/browser/ui/webui/chromeos/login/enrollment_screen_handler.cc

Issue 2323593002: Messaging for successful attestation-based enrollment. (Closed)
Patch Set: Changes for JavaScript style. Created 4 years, 3 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
« no previous file with comments | « chrome/browser/ui/webui/chromeos/login/enrollment_screen_handler.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/ui/webui/chromeos/login/enrollment_screen_handler.h" 5 #include "chrome/browser/ui/webui/chromeos/login/enrollment_screen_handler.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/bind_helpers.h" 10 #include "base/bind_helpers.h"
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
86 reason == NetworkError::ERROR_REASON_PORTAL_DETECTED; 86 reason == NetworkError::ERROR_REASON_PORTAL_DETECTED;
87 } 87 }
88 88
89 bool IsProxyError(NetworkStateInformer::State state, 89 bool IsProxyError(NetworkStateInformer::State state,
90 NetworkError::ErrorReason reason) { 90 NetworkError::ErrorReason reason) {
91 return state == NetworkStateInformer::PROXY_AUTH_REQUIRED || 91 return state == NetworkStateInformer::PROXY_AUTH_REQUIRED ||
92 reason == NetworkError::ERROR_REASON_PROXY_AUTH_CANCELLED || 92 reason == NetworkError::ERROR_REASON_PROXY_AUTH_CANCELLED ||
93 reason == NetworkError::ERROR_REASON_PROXY_CONNECTION_FAILED; 93 reason == NetworkError::ERROR_REASON_PROXY_CONNECTION_FAILED;
94 } 94 }
95 95
96
97 // Returns the enterprise domain after enrollment, or an empty string.
98 std::string GetEnterpriseDomain() {
99 policy::BrowserPolicyConnectorChromeOS* connector =
100 g_browser_process->platform_part()->browser_policy_connector_chromeos();
101 return connector->GetEnterpriseDomain();
102 }
103
96 } // namespace 104 } // namespace
97 105
98 // EnrollmentScreenHandler, public ------------------------------ 106 // EnrollmentScreenHandler, public ------------------------------
99 107
100 EnrollmentScreenHandler::EnrollmentScreenHandler( 108 EnrollmentScreenHandler::EnrollmentScreenHandler(
101 const scoped_refptr<NetworkStateInformer>& network_state_informer, 109 const scoped_refptr<NetworkStateInformer>& network_state_informer,
102 NetworkErrorModel* network_error_model) 110 NetworkErrorModel* network_error_model)
103 : BaseScreenHandler(kJsScreenPath), 111 : BaseScreenHandler(kJsScreenPath),
104 controller_(NULL), 112 controller_(NULL),
105 show_on_init_(false), 113 show_on_init_(false),
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
171 void EnrollmentScreenHandler::ShowAttributePromptScreen( 179 void EnrollmentScreenHandler::ShowAttributePromptScreen(
172 const std::string& asset_id, 180 const std::string& asset_id,
173 const std::string& location) { 181 const std::string& location) {
174 CallJS("showAttributePromptStep", asset_id, location); 182 CallJS("showAttributePromptStep", asset_id, location);
175 } 183 }
176 184
177 void EnrollmentScreenHandler::ShowEnrollmentSpinnerScreen() { 185 void EnrollmentScreenHandler::ShowEnrollmentSpinnerScreen() {
178 ShowStep(kEnrollmentStepWorking); 186 ShowStep(kEnrollmentStepWorking);
179 } 187 }
180 188
189 void EnrollmentScreenHandler::ShowAttestationBasedEnrollmentSuccessScreen(
190 const std::string& enterprise_domain) {
191 CallJS("showAttestationBasedEnrollmentSuccess", enterprise_domain);
192 }
193
181 void EnrollmentScreenHandler::ShowAuthError( 194 void EnrollmentScreenHandler::ShowAuthError(
182 const GoogleServiceAuthError& error) { 195 const GoogleServiceAuthError& error) {
183 switch (error.state()) { 196 switch (error.state()) {
184 case GoogleServiceAuthError::NONE: 197 case GoogleServiceAuthError::NONE:
185 case GoogleServiceAuthError::CAPTCHA_REQUIRED: 198 case GoogleServiceAuthError::CAPTCHA_REQUIRED:
186 case GoogleServiceAuthError::TWO_FACTOR: 199 case GoogleServiceAuthError::TWO_FACTOR:
187 case GoogleServiceAuthError::HOSTED_NOT_ALLOWED: 200 case GoogleServiceAuthError::HOSTED_NOT_ALLOWED:
188 case GoogleServiceAuthError::INVALID_GAIA_CREDENTIALS: 201 case GoogleServiceAuthError::INVALID_GAIA_CREDENTIALS:
189 case GoogleServiceAuthError::REQUEST_CANCELED: 202 case GoogleServiceAuthError::REQUEST_CANCELED:
190 case GoogleServiceAuthError::UNEXPECTED_SERVICE_RESPONSE: 203 case GoogleServiceAuthError::UNEXPECTED_SERVICE_RESPONSE:
(...skipping 26 matching lines...) Expand all
217 ShowError(IDS_ENTERPRISE_ENROLLMENT_FATAL_ENROLLMENT_ERROR, true); 230 ShowError(IDS_ENTERPRISE_ENROLLMENT_FATAL_ENROLLMENT_ERROR, true);
218 return; 231 return;
219 } 232 }
220 NOTREACHED(); 233 NOTREACHED();
221 } 234 }
222 235
223 void EnrollmentScreenHandler::ShowEnrollmentStatus( 236 void EnrollmentScreenHandler::ShowEnrollmentStatus(
224 policy::EnrollmentStatus status) { 237 policy::EnrollmentStatus status) {
225 switch (status.status()) { 238 switch (status.status()) {
226 case policy::EnrollmentStatus::STATUS_SUCCESS: 239 case policy::EnrollmentStatus::STATUS_SUCCESS:
227 ShowStep(kEnrollmentStepSuccess); 240 if (config_.is_mode_attestation())
241 ShowAttestationBasedEnrollmentSuccessScreen(GetEnterpriseDomain());
242 else
243 ShowStep(kEnrollmentStepSuccess);
228 return; 244 return;
229 case policy::EnrollmentStatus::STATUS_NO_STATE_KEYS: 245 case policy::EnrollmentStatus::STATUS_NO_STATE_KEYS:
230 ShowError(IDS_ENTERPRISE_ENROLLMENT_STATUS_NO_STATE_KEYS, false); 246 ShowError(IDS_ENTERPRISE_ENROLLMENT_STATUS_NO_STATE_KEYS, false);
231 return; 247 return;
232 case policy::EnrollmentStatus::STATUS_REGISTRATION_FAILED: 248 case policy::EnrollmentStatus::STATUS_REGISTRATION_FAILED:
233 // Some special cases for generating a nicer message that's more helpful. 249 // Some special cases for generating a nicer message that's more helpful.
234 switch (status.client_status()) { 250 switch (status.client_status()) {
235 case policy::DM_STATUS_SERVICE_MANAGEMENT_NOT_SUPPORTED: 251 case policy::DM_STATUS_SERVICE_MANAGEMENT_NOT_SUPPORTED:
236 ShowError(IDS_ENTERPRISE_ENROLLMENT_ACCOUNT_ERROR, true); 252 ShowError(IDS_ENTERPRISE_ENROLLMENT_ACCOUNT_ERROR, true);
237 break; 253 break;
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
342 358
343 void EnrollmentScreenHandler::DeclareLocalizedValues( 359 void EnrollmentScreenHandler::DeclareLocalizedValues(
344 ::login::LocalizedValuesBuilder* builder) { 360 ::login::LocalizedValuesBuilder* builder) {
345 builder->Add("oauthEnrollScreenTitle", 361 builder->Add("oauthEnrollScreenTitle",
346 IDS_ENTERPRISE_ENROLLMENT_SCREEN_TITLE); 362 IDS_ENTERPRISE_ENROLLMENT_SCREEN_TITLE);
347 builder->Add("oauthEnrollRetry", IDS_ENTERPRISE_ENROLLMENT_RETRY); 363 builder->Add("oauthEnrollRetry", IDS_ENTERPRISE_ENROLLMENT_RETRY);
348 builder->Add("oauthEnrollDone", IDS_ENTERPRISE_ENROLLMENT_DONE); 364 builder->Add("oauthEnrollDone", IDS_ENTERPRISE_ENROLLMENT_DONE);
349 builder->Add("oauthEnrollNextBtn", IDS_OFFLINE_LOGIN_NEXT_BUTTON_TEXT); 365 builder->Add("oauthEnrollNextBtn", IDS_OFFLINE_LOGIN_NEXT_BUTTON_TEXT);
350 builder->Add("oauthEnrollSkip", IDS_ENTERPRISE_ENROLLMENT_SKIP); 366 builder->Add("oauthEnrollSkip", IDS_ENTERPRISE_ENROLLMENT_SKIP);
351 builder->Add("oauthEnrollSuccess", IDS_ENTERPRISE_ENROLLMENT_SUCCESS); 367 builder->Add("oauthEnrollSuccess", IDS_ENTERPRISE_ENROLLMENT_SUCCESS);
368 builder->Add("oauthEnrollAbeSuccess", IDS_ENTERPRISE_ENROLLMENT_ABE_SUCCESS);
352 builder->Add("oauthEnrollDeviceInformation", 369 builder->Add("oauthEnrollDeviceInformation",
353 IDS_ENTERPRISE_ENROLLMENT_DEVICE_INFORMATION); 370 IDS_ENTERPRISE_ENROLLMENT_DEVICE_INFORMATION);
354 builder->Add("oauthEnrollExplaneAttributeLink", 371 builder->Add("oauthEnrollExplaneAttributeLink",
355 IDS_ENTERPRISE_ENROLLMENT_EXPLAIN_ATTRIBUTE_LINK); 372 IDS_ENTERPRISE_ENROLLMENT_EXPLAIN_ATTRIBUTE_LINK);
356 builder->Add("oauthEnrollAttributeExplanation", 373 builder->Add("oauthEnrollAttributeExplanation",
357 IDS_ENTERPRISE_ENROLLMENT_ATTRIBUTE_EXPLANATION); 374 IDS_ENTERPRISE_ENROLLMENT_ATTRIBUTE_EXPLANATION);
358 builder->Add("oauthEnrollAssetIdLabel", 375 builder->Add("oauthEnrollAssetIdLabel",
359 IDS_ENTERPRISE_ENROLLMENT_ASSET_ID_LABEL); 376 IDS_ENTERPRISE_ENROLLMENT_ASSET_ID_LABEL);
360 builder->Add("oauthEnrollLocationLabel", 377 builder->Add("oauthEnrollLocationLabel",
361 IDS_ENTERPRISE_ENROLLMENT_LOCATION_LABEL); 378 IDS_ENTERPRISE_ENROLLMENT_LOCATION_LABEL);
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after
542 559
543 ShowScreenWithData(OobeScreen::SCREEN_OOBE_ENROLLMENT, &screen_data); 560 ShowScreenWithData(OobeScreen::SCREEN_OOBE_ENROLLMENT, &screen_data);
544 if (first_show_) { 561 if (first_show_) {
545 first_show_ = false; 562 first_show_ = false;
546 UpdateStateInternal(NetworkError::ERROR_REASON_UPDATE, true); 563 UpdateStateInternal(NetworkError::ERROR_REASON_UPDATE, true);
547 } 564 }
548 histogram_helper_->OnScreenShow(); 565 histogram_helper_->OnScreenShow();
549 } 566 }
550 567
551 } // namespace chromeos 568 } // namespace chromeos
OLDNEW
« no previous file with comments | « chrome/browser/ui/webui/chromeos/login/enrollment_screen_handler.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698