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/ui/webui/chromeos/login/enterprise_oauth_enrollment_scr
een_handler.h" | 5 #include "chrome/browser/ui/webui/chromeos/login/enterprise_oauth_enrollment_scr
een_handler.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/values.h" | 10 #include "base/values.h" |
(...skipping 394 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
405 | 405 |
406 void EnterpriseOAuthEnrollmentScreenHandler::HandleRetry() { | 406 void EnterpriseOAuthEnrollmentScreenHandler::HandleRetry() { |
407 if (!controller_) { | 407 if (!controller_) { |
408 NOTREACHED(); | 408 NOTREACHED(); |
409 return; | 409 return; |
410 } | 410 } |
411 controller_->OnRetry(); | 411 controller_->OnRetry(); |
412 } | 412 } |
413 | 413 |
414 void EnterpriseOAuthEnrollmentScreenHandler::ShowStep(const char* step) { | 414 void EnterpriseOAuthEnrollmentScreenHandler::ShowStep(const char* step) { |
415 base::StringValue step_value(step); | 415 CallJS("oobe.OAuthEnrollmentScreen.showStep", std::string(step)); |
416 CallJS("oobe.OAuthEnrollmentScreen.showStep", | |
417 step_value); | |
418 } | 416 } |
419 | 417 |
420 void EnterpriseOAuthEnrollmentScreenHandler::ShowError(int message_id, | 418 void EnterpriseOAuthEnrollmentScreenHandler::ShowError(int message_id, |
421 bool retry) { | 419 bool retry) { |
422 ShowErrorMessage(l10n_util::GetStringUTF8(message_id), retry); | 420 ShowErrorMessage(l10n_util::GetStringUTF8(message_id), retry); |
423 } | 421 } |
424 | 422 |
425 void EnterpriseOAuthEnrollmentScreenHandler::ShowErrorMessage( | 423 void EnterpriseOAuthEnrollmentScreenHandler::ShowErrorMessage( |
426 const std::string& message, | 424 const std::string& message, |
427 bool retry) { | 425 bool retry) { |
428 RevokeTokens(); | 426 RevokeTokens(); |
429 | 427 CallJS("oobe.OAuthEnrollmentScreen.showError", message, retry); |
430 base::StringValue message_value(message); | |
431 base::FundamentalValue retry_value(retry); | |
432 CallJS("oobe.OAuthEnrollmentScreen.showError", message_value, retry_value); | |
433 } | 428 } |
434 | 429 |
435 void EnterpriseOAuthEnrollmentScreenHandler::ShowWorking(int message_id) { | 430 void EnterpriseOAuthEnrollmentScreenHandler::ShowWorking(int message_id) { |
436 const std::string message(l10n_util::GetStringUTF8(message_id)); | 431 CallJS("oobe.OAuthEnrollmentScreen.showWorking", |
437 base::StringValue message_value(message); | 432 l10n_util::GetStringUTF16(message_id)); |
438 CallJS("oobe.OAuthEnrollmentScreen.showWorking", message_value); | |
439 } | 433 } |
440 | 434 |
441 void EnterpriseOAuthEnrollmentScreenHandler::RevokeTokens() { | 435 void EnterpriseOAuthEnrollmentScreenHandler::RevokeTokens() { |
442 Profile* profile = Profile::FromBrowserContext( | 436 Profile* profile = Profile::FromBrowserContext( |
443 web_ui()->GetWebContents()->GetBrowserContext()); | 437 web_ui()->GetWebContents()->GetBrowserContext()); |
444 | 438 |
445 if (!access_token_.empty()) { | 439 if (!access_token_.empty()) { |
446 token_revokers_.push_back( | 440 token_revokers_.push_back( |
447 new TokenRevoker(access_token_, access_token_secret_, profile, this)); | 441 new TokenRevoker(access_token_, access_token_secret_, profile, this)); |
448 access_token_.clear(); | 442 access_token_.clear(); |
(...skipping 28 matching lines...) Expand all Loading... |
477 screen_data.SetBoolean("is_auto_enrollment", is_auto_enrollment_); | 471 screen_data.SetBoolean("is_auto_enrollment", is_auto_enrollment_); |
478 if (!test_email_.empty()) { | 472 if (!test_email_.empty()) { |
479 screen_data.SetString("test_email", test_email_); | 473 screen_data.SetString("test_email", test_email_); |
480 screen_data.SetString("test_password", test_password_); | 474 screen_data.SetString("test_password", test_password_); |
481 } | 475 } |
482 | 476 |
483 ShowScreen(OobeUI::kScreenOobeEnrollment, &screen_data); | 477 ShowScreen(OobeUI::kScreenOobeEnrollment, &screen_data); |
484 } | 478 } |
485 | 479 |
486 } // namespace chromeos | 480 } // namespace chromeos |
OLD | NEW |