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/help/help_handler.h" | 5 #include "chrome/browser/ui/webui/help/help_handler.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include <string> | 9 #include <string> |
10 | 10 |
(...skipping 479 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
490 weak_factory_.GetWeakPtr())); | 490 weak_factory_.GetWeakPtr())); |
491 base::PostTaskAndReplyWithResult( | 491 base::PostTaskAndReplyWithResult( |
492 content::BrowserThread::GetBlockingPool(), | 492 content::BrowserThread::GetBlockingPool(), |
493 FROM_HERE, | 493 FROM_HERE, |
494 base::Bind(&chromeos::version_loader::GetFirmware), | 494 base::Bind(&chromeos::version_loader::GetFirmware), |
495 base::Bind(&HelpHandler::OnOSFirmware, | 495 base::Bind(&HelpHandler::OnOSFirmware, |
496 weak_factory_.GetWeakPtr())); | 496 weak_factory_.GetWeakPtr())); |
497 | 497 |
498 web_ui()->CallJavascriptFunctionUnsafe( | 498 web_ui()->CallJavascriptFunctionUnsafe( |
499 "help.HelpPage.updateEnableReleaseChannel", | 499 "help.HelpPage.updateEnableReleaseChannel", |
500 base::FundamentalValue(CanChangeChannel(Profile::FromWebUI(web_ui())))); | 500 base::Value(CanChangeChannel(Profile::FromWebUI(web_ui())))); |
501 | 501 |
502 base::Time build_time = base::SysInfo::GetLsbReleaseTime(); | 502 base::Time build_time = base::SysInfo::GetLsbReleaseTime(); |
503 base::string16 build_date = base::TimeFormatFriendlyDate(build_time); | 503 base::string16 build_date = base::TimeFormatFriendlyDate(build_time); |
504 web_ui()->CallJavascriptFunctionUnsafe("help.HelpPage.setBuildDate", | 504 web_ui()->CallJavascriptFunctionUnsafe("help.HelpPage.setBuildDate", |
505 base::StringValue(build_date)); | 505 base::StringValue(build_date)); |
506 #endif // defined(OS_CHROMEOS) | 506 #endif // defined(OS_CHROMEOS) |
507 | 507 |
508 RefreshUpdateStatus(); | 508 RefreshUpdateStatus(); |
509 | 509 |
510 web_ui()->CallJavascriptFunctionUnsafe( | 510 web_ui()->CallJavascriptFunctionUnsafe( |
511 "help.HelpPage.setObsoleteSystem", | 511 "help.HelpPage.setObsoleteSystem", |
512 base::FundamentalValue(ObsoleteSystem::IsObsoleteNowOrSoon())); | 512 base::Value(ObsoleteSystem::IsObsoleteNowOrSoon())); |
513 web_ui()->CallJavascriptFunctionUnsafe( | 513 web_ui()->CallJavascriptFunctionUnsafe( |
514 "help.HelpPage.setObsoleteSystemEndOfTheLine", | 514 "help.HelpPage.setObsoleteSystemEndOfTheLine", |
515 base::FundamentalValue(ObsoleteSystem::IsObsoleteNowOrSoon() && | 515 base::Value(ObsoleteSystem::IsObsoleteNowOrSoon() && |
516 ObsoleteSystem::IsEndOfTheLine())); | 516 ObsoleteSystem::IsEndOfTheLine())); |
517 | 517 |
518 #if defined(OS_CHROMEOS) | 518 #if defined(OS_CHROMEOS) |
519 web_ui()->CallJavascriptFunctionUnsafe( | 519 web_ui()->CallJavascriptFunctionUnsafe( |
520 "help.HelpPage.updateIsEnterpriseManaged", | 520 "help.HelpPage.updateIsEnterpriseManaged", |
521 base::FundamentalValue(IsEnterpriseManaged())); | 521 base::Value(IsEnterpriseManaged())); |
522 // First argument to GetChannel() is a flag that indicates whether | 522 // First argument to GetChannel() is a flag that indicates whether |
523 // current channel should be returned (if true) or target channel | 523 // current channel should be returned (if true) or target channel |
524 // (otherwise). | 524 // (otherwise). |
525 version_updater_->GetChannel(true, | 525 version_updater_->GetChannel(true, |
526 base::Bind(&HelpHandler::OnCurrentChannel, weak_factory_.GetWeakPtr())); | 526 base::Bind(&HelpHandler::OnCurrentChannel, weak_factory_.GetWeakPtr())); |
527 version_updater_->GetChannel(false, | 527 version_updater_->GetChannel(false, |
528 base::Bind(&HelpHandler::OnTargetChannel, weak_factory_.GetWeakPtr())); | 528 base::Bind(&HelpHandler::OnTargetChannel, weak_factory_.GetWeakPtr())); |
529 | 529 |
530 if (!base::CommandLine::ForCurrentProcess()->HasSwitch( | 530 if (!base::CommandLine::ForCurrentProcess()->HasSwitch( |
531 chromeos::switches::kDisableEolNotification)) { | 531 chromeos::switches::kDisableEolNotification)) { |
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
654 status_str = "disabled_by_admin"; | 654 status_str = "disabled_by_admin"; |
655 break; | 655 break; |
656 } | 656 } |
657 | 657 |
658 web_ui()->CallJavascriptFunctionUnsafe("help.HelpPage.setUpdateStatus", | 658 web_ui()->CallJavascriptFunctionUnsafe("help.HelpPage.setUpdateStatus", |
659 base::StringValue(status_str), | 659 base::StringValue(status_str), |
660 base::StringValue(message)); | 660 base::StringValue(message)); |
661 | 661 |
662 if (status == VersionUpdater::UPDATING) { | 662 if (status == VersionUpdater::UPDATING) { |
663 web_ui()->CallJavascriptFunctionUnsafe("help.HelpPage.setProgress", | 663 web_ui()->CallJavascriptFunctionUnsafe("help.HelpPage.setProgress", |
664 base::FundamentalValue(progress)); | 664 base::Value(progress)); |
665 } | 665 } |
666 | 666 |
667 #if defined(OS_CHROMEOS) | 667 #if defined(OS_CHROMEOS) |
668 if (status == VersionUpdater::FAILED_OFFLINE || | 668 if (status == VersionUpdater::FAILED_OFFLINE || |
669 status == VersionUpdater::FAILED_CONNECTION_TYPE_DISALLOWED) { | 669 status == VersionUpdater::FAILED_CONNECTION_TYPE_DISALLOWED) { |
670 base::string16 types_msg = GetAllowedConnectionTypesMessage(); | 670 base::string16 types_msg = GetAllowedConnectionTypesMessage(); |
671 if (!types_msg.empty()) { | 671 if (!types_msg.empty()) { |
672 web_ui()->CallJavascriptFunctionUnsafe( | 672 web_ui()->CallJavascriptFunctionUnsafe( |
673 "help.HelpPage.setAndShowAllowedConnectionTypesMsg", | 673 "help.HelpPage.setAndShowAllowedConnectionTypesMsg", |
674 base::StringValue(types_msg)); | 674 base::StringValue(types_msg)); |
675 } else { | 675 } else { |
676 web_ui()->CallJavascriptFunctionUnsafe( | 676 web_ui()->CallJavascriptFunctionUnsafe( |
677 "help.HelpPage.showAllowedConnectionTypesMsg", | 677 "help.HelpPage.showAllowedConnectionTypesMsg", |
678 base::FundamentalValue(false)); | 678 base::Value(false)); |
679 } | 679 } |
680 } else { | 680 } else { |
681 web_ui()->CallJavascriptFunctionUnsafe( | 681 web_ui()->CallJavascriptFunctionUnsafe( |
682 "help.HelpPage.showAllowedConnectionTypesMsg", | 682 "help.HelpPage.showAllowedConnectionTypesMsg", |
683 base::FundamentalValue(false)); | 683 base::Value(false)); |
684 } | 684 } |
685 #endif // defined(OS_CHROMEOS) | 685 #endif // defined(OS_CHROMEOS) |
686 } | 686 } |
687 | 687 |
688 #if defined(OS_MACOSX) | 688 #if defined(OS_MACOSX) |
689 void HelpHandler::SetPromotionState(VersionUpdater::PromotionState state) { | 689 void HelpHandler::SetPromotionState(VersionUpdater::PromotionState state) { |
690 std::string state_str; | 690 std::string state_str; |
691 switch (state) { | 691 switch (state) { |
692 case VersionUpdater::PROMOTE_HIDDEN: | 692 case VersionUpdater::PROMOTE_HIDDEN: |
693 state_str = "hidden"; | 693 state_str = "hidden"; |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
771 base::StringValue("")); | 771 base::StringValue("")); |
772 } else { | 772 } else { |
773 base::string16 message = GetEolMessage(status); | 773 base::string16 message = GetEolMessage(status); |
774 web_ui()->CallJavascriptFunctionUnsafe( | 774 web_ui()->CallJavascriptFunctionUnsafe( |
775 "help.HelpPage.updateEolMessage", base::StringValue("device_endoflife"), | 775 "help.HelpPage.updateEolMessage", base::StringValue("device_endoflife"), |
776 base::StringValue(message)); | 776 base::StringValue(message)); |
777 } | 777 } |
778 } | 778 } |
779 | 779 |
780 #endif // defined(OS_CHROMEOS) | 780 #endif // defined(OS_CHROMEOS) |
OLD | NEW |