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

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

Issue 2326063005: Use the device name instead of "device" in enrollment success messages. (Closed)
Patch Set: 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 "ash/common/system/chromeos/devicetype_utils.h"
9 #include "base/bind.h" 10 #include "base/bind.h"
10 #include "base/bind_helpers.h" 11 #include "base/bind_helpers.h"
11 #include "base/logging.h" 12 #include "base/logging.h"
12 #include "base/macros.h" 13 #include "base/macros.h"
13 #include "base/strings/stringprintf.h" 14 #include "base/strings/stringprintf.h"
14 #include "base/values.h" 15 #include "base/values.h"
15 #include "chrome/browser/browser_process.h" 16 #include "chrome/browser/browser_process.h"
16 #include "chrome/browser/browser_process_platform_part.h" 17 #include "chrome/browser/browser_process_platform_part.h"
17 #include "chrome/browser/chromeos/login/error_screens_histogram_helper.h" 18 #include "chrome/browser/chromeos/login/error_screens_histogram_helper.h"
18 #include "chrome/browser/chromeos/login/help_app_launcher.h" 19 #include "chrome/browser/chromeos/login/help_app_launcher.h"
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after
181 const std::string& location) { 182 const std::string& location) {
182 CallJS("showAttributePromptStep", asset_id, location); 183 CallJS("showAttributePromptStep", asset_id, location);
183 } 184 }
184 185
185 void EnrollmentScreenHandler::ShowEnrollmentSpinnerScreen() { 186 void EnrollmentScreenHandler::ShowEnrollmentSpinnerScreen() {
186 ShowStep(kEnrollmentStepWorking); 187 ShowStep(kEnrollmentStepWorking);
187 } 188 }
188 189
189 void EnrollmentScreenHandler::ShowAttestationBasedEnrollmentSuccessScreen( 190 void EnrollmentScreenHandler::ShowAttestationBasedEnrollmentSuccessScreen(
190 const std::string& enterprise_domain) { 191 const std::string& enterprise_domain) {
191 CallJS("showAttestationBasedEnrollmentSuccess", enterprise_domain); 192 CallJS("showAttestationBasedEnrollmentSuccess", ash::GetChromeOSDeviceName(),
193 enterprise_domain);
192 } 194 }
193 195
194 void EnrollmentScreenHandler::ShowAuthError( 196 void EnrollmentScreenHandler::ShowAuthError(
195 const GoogleServiceAuthError& error) { 197 const GoogleServiceAuthError& error) {
196 switch (error.state()) { 198 switch (error.state()) {
197 case GoogleServiceAuthError::NONE: 199 case GoogleServiceAuthError::NONE:
198 case GoogleServiceAuthError::CAPTCHA_REQUIRED: 200 case GoogleServiceAuthError::CAPTCHA_REQUIRED:
199 case GoogleServiceAuthError::TWO_FACTOR: 201 case GoogleServiceAuthError::TWO_FACTOR:
200 case GoogleServiceAuthError::HOSTED_NOT_ALLOWED: 202 case GoogleServiceAuthError::HOSTED_NOT_ALLOWED:
201 case GoogleServiceAuthError::INVALID_GAIA_CREDENTIALS: 203 case GoogleServiceAuthError::INVALID_GAIA_CREDENTIALS:
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after
334 status.validation_status())), 336 status.validation_status())),
335 true); 337 true);
336 return; 338 return;
337 case policy::EnrollmentStatus::STATUS_STORE_TOKEN_AND_ID_FAILED: 339 case policy::EnrollmentStatus::STATUS_STORE_TOKEN_AND_ID_FAILED:
338 // This error should not happen for enterprise enrollment. 340 // This error should not happen for enterprise enrollment.
339 ShowError(IDS_ENTERPRISE_ENROLLMENT_STATUS_STORE_TOKEN_AND_ID_FAILED, 341 ShowError(IDS_ENTERPRISE_ENROLLMENT_STATUS_STORE_TOKEN_AND_ID_FAILED,
340 true); 342 true);
341 NOTREACHED(); 343 NOTREACHED();
342 return; 344 return;
343 case policy::EnrollmentStatus::STATUS_ATTRIBUTE_UPDATE_FAILED: 345 case policy::EnrollmentStatus::STATUS_ATTRIBUTE_UPDATE_FAILED:
344 ShowError(IDS_ENTERPRISE_ENROLLMENT_ATTRIBUTE_ERROR, false); 346 ShowErrorForDevice(IDS_ENTERPRISE_ENROLLMENT_ATTRIBUTE_ERROR, false);
345 return; 347 return;
346 } 348 }
347 NOTREACHED(); 349 NOTREACHED();
348 } 350 }
349 351
350 // EnrollmentScreenHandler BaseScreenHandler implementation ----- 352 // EnrollmentScreenHandler BaseScreenHandler implementation -----
351 353
352 void EnrollmentScreenHandler::Initialize() { 354 void EnrollmentScreenHandler::Initialize() {
353 if (show_on_init_) { 355 if (show_on_init_) {
354 Show(); 356 Show();
355 show_on_init_ = false; 357 show_on_init_ = false;
356 } 358 }
357 } 359 }
358 360
359 void EnrollmentScreenHandler::DeclareLocalizedValues( 361 void EnrollmentScreenHandler::DeclareLocalizedValues(
360 ::login::LocalizedValuesBuilder* builder) { 362 ::login::LocalizedValuesBuilder* builder) {
361 builder->Add("oauthEnrollScreenTitle", 363 builder->Add("oauthEnrollScreenTitle",
362 IDS_ENTERPRISE_ENROLLMENT_SCREEN_TITLE); 364 IDS_ENTERPRISE_ENROLLMENT_SCREEN_TITLE);
363 builder->Add("oauthEnrollRetry", IDS_ENTERPRISE_ENROLLMENT_RETRY); 365 builder->Add("oauthEnrollRetry", IDS_ENTERPRISE_ENROLLMENT_RETRY);
364 builder->Add("oauthEnrollDone", IDS_ENTERPRISE_ENROLLMENT_DONE); 366 builder->Add("oauthEnrollDone", IDS_ENTERPRISE_ENROLLMENT_DONE);
365 builder->Add("oauthEnrollNextBtn", IDS_OFFLINE_LOGIN_NEXT_BUTTON_TEXT); 367 builder->Add("oauthEnrollNextBtn", IDS_OFFLINE_LOGIN_NEXT_BUTTON_TEXT);
366 builder->Add("oauthEnrollSkip", IDS_ENTERPRISE_ENROLLMENT_SKIP); 368 builder->Add("oauthEnrollSkip", IDS_ENTERPRISE_ENROLLMENT_SKIP);
367 builder->Add("oauthEnrollSuccess", IDS_ENTERPRISE_ENROLLMENT_SUCCESS); 369 builder->AddF("oauthEnrollSuccess", IDS_ENTERPRISE_ENROLLMENT_SUCCESS,
368 builder->Add("oauthEnrollAbeSuccess", IDS_ENTERPRISE_ENROLLMENT_ABE_SUCCESS); 370 ash::GetChromeOSDeviceName());
369 builder->Add("oauthEnrollDeviceInformation", 371 builder->Add("oauthEnrollDeviceInformation",
370 IDS_ENTERPRISE_ENROLLMENT_DEVICE_INFORMATION); 372 IDS_ENTERPRISE_ENROLLMENT_DEVICE_INFORMATION);
371 builder->Add("oauthEnrollExplaneAttributeLink", 373 builder->Add("oauthEnrollExplaneAttributeLink",
372 IDS_ENTERPRISE_ENROLLMENT_EXPLAIN_ATTRIBUTE_LINK); 374 IDS_ENTERPRISE_ENROLLMENT_EXPLAIN_ATTRIBUTE_LINK);
373 builder->Add("oauthEnrollAttributeExplanation", 375 builder->Add("oauthEnrollAttributeExplanation",
374 IDS_ENTERPRISE_ENROLLMENT_ATTRIBUTE_EXPLANATION); 376 IDS_ENTERPRISE_ENROLLMENT_ATTRIBUTE_EXPLANATION);
375 builder->Add("oauthEnrollAssetIdLabel", 377 builder->Add("oauthEnrollAssetIdLabel",
376 IDS_ENTERPRISE_ENROLLMENT_ASSET_ID_LABEL); 378 IDS_ENTERPRISE_ENROLLMENT_ASSET_ID_LABEL);
377 builder->Add("oauthEnrollLocationLabel", 379 builder->Add("oauthEnrollLocationLabel",
378 IDS_ENTERPRISE_ENROLLMENT_LOCATION_LABEL); 380 IDS_ENTERPRISE_ENROLLMENT_LOCATION_LABEL);
381 // Do not use AddF for this string as it will be rendered by the JS code.
382 builder->Add("oauthEnrollAbeSuccess", IDS_ENTERPRISE_ENROLLMENT_ABE_SUCCESS);
379 } 383 }
380 384
381 bool EnrollmentScreenHandler::IsOnEnrollmentScreen() const { 385 bool EnrollmentScreenHandler::IsOnEnrollmentScreen() const {
382 return (GetCurrentScreen() == OobeScreen::SCREEN_OOBE_ENROLLMENT); 386 return (GetCurrentScreen() == OobeScreen::SCREEN_OOBE_ENROLLMENT);
383 } 387 }
384 388
385 bool EnrollmentScreenHandler::IsEnrollmentScreenHiddenByError() const { 389 bool EnrollmentScreenHandler::IsEnrollmentScreenHiddenByError() const {
386 return (GetCurrentScreen() == OobeScreen::SCREEN_ERROR_MESSAGE && 390 return (GetCurrentScreen() == OobeScreen::SCREEN_ERROR_MESSAGE &&
387 network_error_model_->GetParentScreen() == 391 network_error_model_->GetParentScreen() ==
388 OobeScreen::SCREEN_OOBE_ENROLLMENT); 392 OobeScreen::SCREEN_OOBE_ENROLLMENT);
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after
530 } 534 }
531 535
532 void EnrollmentScreenHandler::ShowStep(const char* step) { 536 void EnrollmentScreenHandler::ShowStep(const char* step) {
533 CallJS("showStep", std::string(step)); 537 CallJS("showStep", std::string(step));
534 } 538 }
535 539
536 void EnrollmentScreenHandler::ShowError(int message_id, bool retry) { 540 void EnrollmentScreenHandler::ShowError(int message_id, bool retry) {
537 ShowErrorMessage(l10n_util::GetStringUTF8(message_id), retry); 541 ShowErrorMessage(l10n_util::GetStringUTF8(message_id), retry);
538 } 542 }
539 543
544 void EnrollmentScreenHandler::ShowErrorForDevice(int message_id, bool retry) {
545 ShowErrorMessage(
546 l10n_util::GetStringFUTF8(message_id, ash::GetChromeOSDeviceName()),
547 retry);
548 }
549
540 void EnrollmentScreenHandler::ShowErrorMessage(const std::string& message, 550 void EnrollmentScreenHandler::ShowErrorMessage(const std::string& message,
541 bool retry) { 551 bool retry) {
542 CallJS("showError", message, retry); 552 CallJS("showError", message, retry);
543 } 553 }
544 554
545 void EnrollmentScreenHandler::DoShow() { 555 void EnrollmentScreenHandler::DoShow() {
546 base::DictionaryValue screen_data; 556 base::DictionaryValue screen_data;
547 screen_data.SetString("gaiaUrl", GaiaUrls::GetInstance()->gaia_url().spec()); 557 screen_data.SetString("gaiaUrl", GaiaUrls::GetInstance()->gaia_url().spec());
548 screen_data.SetString("clientId", 558 screen_data.SetString("clientId",
549 GaiaUrls::GetInstance()->oauth2_chrome_client_id()); 559 GaiaUrls::GetInstance()->oauth2_chrome_client_id());
550 screen_data.SetString("enrollment_mode", 560 screen_data.SetString("enrollment_mode",
551 EnrollmentModeToUIMode(config_.mode)); 561 EnrollmentModeToUIMode(config_.mode));
552 screen_data.SetString("management_domain", config_.management_domain); 562 screen_data.SetString("management_domain", config_.management_domain);
553 563
554 const bool cfm = g_browser_process->platform_part() 564 const bool cfm = g_browser_process->platform_part()
555 ->browser_policy_connector_chromeos() 565 ->browser_policy_connector_chromeos()
556 ->GetDeviceCloudPolicyManager() 566 ->GetDeviceCloudPolicyManager()
557 ->IsRemoraRequisition(); 567 ->IsRemoraRequisition();
558 screen_data.SetString("flow", cfm ? "cfm" : "enterprise"); 568 screen_data.SetString("flow", cfm ? "cfm" : "enterprise");
559 569
560 ShowScreenWithData(OobeScreen::SCREEN_OOBE_ENROLLMENT, &screen_data); 570 ShowScreenWithData(OobeScreen::SCREEN_OOBE_ENROLLMENT, &screen_data);
561 if (first_show_) { 571 if (first_show_) {
562 first_show_ = false; 572 first_show_ = false;
563 UpdateStateInternal(NetworkError::ERROR_REASON_UPDATE, true); 573 UpdateStateInternal(NetworkError::ERROR_REASON_UPDATE, true);
564 } 574 }
565 histogram_helper_->OnScreenShow(); 575 histogram_helper_->OnScreenShow();
566 } 576 }
567 577
568 } // namespace chromeos 578 } // 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