| 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 460 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 471 base::Bind(&chromeos::version_loader::GetARCVersion), | 471 base::Bind(&chromeos::version_loader::GetARCVersion), |
| 472 base::Bind(&HelpHandler::OnARCVersion, weak_factory_.GetWeakPtr())); | 472 base::Bind(&HelpHandler::OnARCVersion, weak_factory_.GetWeakPtr())); |
| 473 base::PostTaskWithTraitsAndReplyWithResult( | 473 base::PostTaskWithTraitsAndReplyWithResult( |
| 474 FROM_HERE, base::TaskTraits().MayBlock().WithPriority( | 474 FROM_HERE, base::TaskTraits().MayBlock().WithPriority( |
| 475 base::TaskPriority::BACKGROUND), | 475 base::TaskPriority::BACKGROUND), |
| 476 base::Bind(&chromeos::version_loader::GetFirmware), | 476 base::Bind(&chromeos::version_loader::GetFirmware), |
| 477 base::Bind(&HelpHandler::OnOSFirmware, weak_factory_.GetWeakPtr())); | 477 base::Bind(&HelpHandler::OnOSFirmware, weak_factory_.GetWeakPtr())); |
| 478 | 478 |
| 479 web_ui()->CallJavascriptFunctionUnsafe( | 479 web_ui()->CallJavascriptFunctionUnsafe( |
| 480 "help.HelpPage.updateEnableReleaseChannel", | 480 "help.HelpPage.updateEnableReleaseChannel", |
| 481 base::FundamentalValue(CanChangeChannel(Profile::FromWebUI(web_ui())))); | 481 base::Value(CanChangeChannel(Profile::FromWebUI(web_ui())))); |
| 482 | 482 |
| 483 base::Time build_time = base::SysInfo::GetLsbReleaseTime(); | 483 base::Time build_time = base::SysInfo::GetLsbReleaseTime(); |
| 484 base::string16 build_date = base::TimeFormatFriendlyDate(build_time); | 484 base::string16 build_date = base::TimeFormatFriendlyDate(build_time); |
| 485 web_ui()->CallJavascriptFunctionUnsafe("help.HelpPage.setBuildDate", | 485 web_ui()->CallJavascriptFunctionUnsafe("help.HelpPage.setBuildDate", |
| 486 base::StringValue(build_date)); | 486 base::StringValue(build_date)); |
| 487 #endif // defined(OS_CHROMEOS) | 487 #endif // defined(OS_CHROMEOS) |
| 488 | 488 |
| 489 RefreshUpdateStatus(); | 489 RefreshUpdateStatus(); |
| 490 | 490 |
| 491 web_ui()->CallJavascriptFunctionUnsafe( | 491 web_ui()->CallJavascriptFunctionUnsafe( |
| 492 "help.HelpPage.setObsoleteSystem", | 492 "help.HelpPage.setObsoleteSystem", |
| 493 base::FundamentalValue(ObsoleteSystem::IsObsoleteNowOrSoon())); | 493 base::Value(ObsoleteSystem::IsObsoleteNowOrSoon())); |
| 494 web_ui()->CallJavascriptFunctionUnsafe( | 494 web_ui()->CallJavascriptFunctionUnsafe( |
| 495 "help.HelpPage.setObsoleteSystemEndOfTheLine", | 495 "help.HelpPage.setObsoleteSystemEndOfTheLine", |
| 496 base::FundamentalValue(ObsoleteSystem::IsObsoleteNowOrSoon() && | 496 base::Value(ObsoleteSystem::IsObsoleteNowOrSoon() && |
| 497 ObsoleteSystem::IsEndOfTheLine())); | 497 ObsoleteSystem::IsEndOfTheLine())); |
| 498 | 498 |
| 499 #if defined(OS_CHROMEOS) | 499 #if defined(OS_CHROMEOS) |
| 500 web_ui()->CallJavascriptFunctionUnsafe( | 500 web_ui()->CallJavascriptFunctionUnsafe( |
| 501 "help.HelpPage.updateIsEnterpriseManaged", | 501 "help.HelpPage.updateIsEnterpriseManaged", |
| 502 base::FundamentalValue(IsEnterpriseManaged())); | 502 base::Value(IsEnterpriseManaged())); |
| 503 // First argument to GetChannel() is a flag that indicates whether | 503 // First argument to GetChannel() is a flag that indicates whether |
| 504 // current channel should be returned (if true) or target channel | 504 // current channel should be returned (if true) or target channel |
| 505 // (otherwise). | 505 // (otherwise). |
| 506 version_updater_->GetChannel(true, | 506 version_updater_->GetChannel(true, |
| 507 base::Bind(&HelpHandler::OnCurrentChannel, weak_factory_.GetWeakPtr())); | 507 base::Bind(&HelpHandler::OnCurrentChannel, weak_factory_.GetWeakPtr())); |
| 508 version_updater_->GetChannel(false, | 508 version_updater_->GetChannel(false, |
| 509 base::Bind(&HelpHandler::OnTargetChannel, weak_factory_.GetWeakPtr())); | 509 base::Bind(&HelpHandler::OnTargetChannel, weak_factory_.GetWeakPtr())); |
| 510 | 510 |
| 511 if (!base::CommandLine::ForCurrentProcess()->HasSwitch( | 511 if (!base::CommandLine::ForCurrentProcess()->HasSwitch( |
| 512 chromeos::switches::kDisableEolNotification)) { | 512 chromeos::switches::kDisableEolNotification)) { |
| (...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 635 status_str = "disabled_by_admin"; | 635 status_str = "disabled_by_admin"; |
| 636 break; | 636 break; |
| 637 } | 637 } |
| 638 | 638 |
| 639 web_ui()->CallJavascriptFunctionUnsafe("help.HelpPage.setUpdateStatus", | 639 web_ui()->CallJavascriptFunctionUnsafe("help.HelpPage.setUpdateStatus", |
| 640 base::StringValue(status_str), | 640 base::StringValue(status_str), |
| 641 base::StringValue(message)); | 641 base::StringValue(message)); |
| 642 | 642 |
| 643 if (status == VersionUpdater::UPDATING) { | 643 if (status == VersionUpdater::UPDATING) { |
| 644 web_ui()->CallJavascriptFunctionUnsafe("help.HelpPage.setProgress", | 644 web_ui()->CallJavascriptFunctionUnsafe("help.HelpPage.setProgress", |
| 645 base::FundamentalValue(progress)); | 645 base::Value(progress)); |
| 646 } | 646 } |
| 647 | 647 |
| 648 #if defined(OS_CHROMEOS) | 648 #if defined(OS_CHROMEOS) |
| 649 if (status == VersionUpdater::FAILED_OFFLINE || | 649 if (status == VersionUpdater::FAILED_OFFLINE || |
| 650 status == VersionUpdater::FAILED_CONNECTION_TYPE_DISALLOWED) { | 650 status == VersionUpdater::FAILED_CONNECTION_TYPE_DISALLOWED) { |
| 651 base::string16 types_msg = GetAllowedConnectionTypesMessage(); | 651 base::string16 types_msg = GetAllowedConnectionTypesMessage(); |
| 652 if (!types_msg.empty()) { | 652 if (!types_msg.empty()) { |
| 653 web_ui()->CallJavascriptFunctionUnsafe( | 653 web_ui()->CallJavascriptFunctionUnsafe( |
| 654 "help.HelpPage.setAndShowAllowedConnectionTypesMsg", | 654 "help.HelpPage.setAndShowAllowedConnectionTypesMsg", |
| 655 base::StringValue(types_msg)); | 655 base::StringValue(types_msg)); |
| 656 } else { | 656 } else { |
| 657 web_ui()->CallJavascriptFunctionUnsafe( | 657 web_ui()->CallJavascriptFunctionUnsafe( |
| 658 "help.HelpPage.showAllowedConnectionTypesMsg", | 658 "help.HelpPage.showAllowedConnectionTypesMsg", base::Value(false)); |
| 659 base::FundamentalValue(false)); | |
| 660 } | 659 } |
| 661 } else { | 660 } else { |
| 662 web_ui()->CallJavascriptFunctionUnsafe( | 661 web_ui()->CallJavascriptFunctionUnsafe( |
| 663 "help.HelpPage.showAllowedConnectionTypesMsg", | 662 "help.HelpPage.showAllowedConnectionTypesMsg", base::Value(false)); |
| 664 base::FundamentalValue(false)); | |
| 665 } | 663 } |
| 666 #endif // defined(OS_CHROMEOS) | 664 #endif // defined(OS_CHROMEOS) |
| 667 } | 665 } |
| 668 | 666 |
| 669 #if defined(OS_MACOSX) | 667 #if defined(OS_MACOSX) |
| 670 void HelpHandler::SetPromotionState(VersionUpdater::PromotionState state) { | 668 void HelpHandler::SetPromotionState(VersionUpdater::PromotionState state) { |
| 671 std::string state_str; | 669 std::string state_str; |
| 672 switch (state) { | 670 switch (state) { |
| 673 case VersionUpdater::PROMOTE_HIDDEN: | 671 case VersionUpdater::PROMOTE_HIDDEN: |
| 674 case VersionUpdater::PROMOTED: | 672 case VersionUpdater::PROMOTED: |
| (...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 754 "help.HelpPage.updateEolMessage", base::StringValue("device_supported"), | 752 "help.HelpPage.updateEolMessage", base::StringValue("device_supported"), |
| 755 base::StringValue("")); | 753 base::StringValue("")); |
| 756 } else { | 754 } else { |
| 757 web_ui()->CallJavascriptFunctionUnsafe( | 755 web_ui()->CallJavascriptFunctionUnsafe( |
| 758 "help.HelpPage.updateEolMessage", base::StringValue("device_endoflife"), | 756 "help.HelpPage.updateEolMessage", base::StringValue("device_endoflife"), |
| 759 base::StringValue(l10n_util::GetStringUTF16(IDS_ABOUT_PAGE_EOL_EOL))); | 757 base::StringValue(l10n_util::GetStringUTF16(IDS_ABOUT_PAGE_EOL_EOL))); |
| 760 } | 758 } |
| 761 } | 759 } |
| 762 | 760 |
| 763 #endif // defined(OS_CHROMEOS) | 761 #endif // defined(OS_CHROMEOS) |
| OLD | NEW |