| 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 442 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 453 static_cast<VersionUpdaterCros*>(version_updater_.get())->GetUpdateStatus( | 453 static_cast<VersionUpdaterCros*>(version_updater_.get())->GetUpdateStatus( |
| 454 base::Bind(&HelpHandler::SetUpdateStatus, base::Unretained(this))); | 454 base::Bind(&HelpHandler::SetUpdateStatus, base::Unretained(this))); |
| 455 #else | 455 #else |
| 456 RequestUpdate(NULL); | 456 RequestUpdate(NULL); |
| 457 #endif | 457 #endif |
| 458 } | 458 } |
| 459 | 459 |
| 460 void HelpHandler::OnPageLoaded(const base::ListValue* args) { | 460 void HelpHandler::OnPageLoaded(const base::ListValue* args) { |
| 461 #if defined(OS_CHROMEOS) | 461 #if defined(OS_CHROMEOS) |
| 462 base::PostTaskWithTraitsAndReplyWithResult( | 462 base::PostTaskWithTraitsAndReplyWithResult( |
| 463 FROM_HERE, base::TaskTraits().MayBlock().WithPriority( | 463 FROM_HERE, {base::MayBlock(), base::TaskPriority::BACKGROUND}, |
| 464 base::TaskPriority::BACKGROUND), | |
| 465 base::Bind(&chromeos::version_loader::GetVersion, | 464 base::Bind(&chromeos::version_loader::GetVersion, |
| 466 chromeos::version_loader::VERSION_FULL), | 465 chromeos::version_loader::VERSION_FULL), |
| 467 base::Bind(&HelpHandler::OnOSVersion, weak_factory_.GetWeakPtr())); | 466 base::Bind(&HelpHandler::OnOSVersion, weak_factory_.GetWeakPtr())); |
| 468 base::PostTaskWithTraitsAndReplyWithResult( | 467 base::PostTaskWithTraitsAndReplyWithResult( |
| 469 FROM_HERE, base::TaskTraits().MayBlock().WithPriority( | 468 FROM_HERE, {base::MayBlock(), base::TaskPriority::BACKGROUND}, |
| 470 base::TaskPriority::BACKGROUND), | |
| 471 base::Bind(&chromeos::version_loader::GetARCVersion), | 469 base::Bind(&chromeos::version_loader::GetARCVersion), |
| 472 base::Bind(&HelpHandler::OnARCVersion, weak_factory_.GetWeakPtr())); | 470 base::Bind(&HelpHandler::OnARCVersion, weak_factory_.GetWeakPtr())); |
| 473 base::PostTaskWithTraitsAndReplyWithResult( | 471 base::PostTaskWithTraitsAndReplyWithResult( |
| 474 FROM_HERE, base::TaskTraits().MayBlock().WithPriority( | 472 FROM_HERE, {base::MayBlock(), base::TaskPriority::BACKGROUND}, |
| 475 base::TaskPriority::BACKGROUND), | |
| 476 base::Bind(&chromeos::version_loader::GetFirmware), | 473 base::Bind(&chromeos::version_loader::GetFirmware), |
| 477 base::Bind(&HelpHandler::OnOSFirmware, weak_factory_.GetWeakPtr())); | 474 base::Bind(&HelpHandler::OnOSFirmware, weak_factory_.GetWeakPtr())); |
| 478 | 475 |
| 479 web_ui()->CallJavascriptFunctionUnsafe( | 476 web_ui()->CallJavascriptFunctionUnsafe( |
| 480 "help.HelpPage.updateEnableReleaseChannel", | 477 "help.HelpPage.updateEnableReleaseChannel", |
| 481 base::Value(CanChangeChannel(Profile::FromWebUI(web_ui())))); | 478 base::Value(CanChangeChannel(Profile::FromWebUI(web_ui())))); |
| 482 | 479 |
| 483 base::Time build_time = base::SysInfo::GetLsbReleaseTime(); | 480 base::Time build_time = base::SysInfo::GetLsbReleaseTime(); |
| 484 base::string16 build_date = base::TimeFormatFriendlyDate(build_time); | 481 base::string16 build_date = base::TimeFormatFriendlyDate(build_time); |
| 485 web_ui()->CallJavascriptFunctionUnsafe("help.HelpPage.setBuildDate", | 482 web_ui()->CallJavascriptFunctionUnsafe("help.HelpPage.setBuildDate", |
| (...skipping 22 matching lines...) Expand all Loading... |
| 508 version_updater_->GetChannel(false, | 505 version_updater_->GetChannel(false, |
| 509 base::Bind(&HelpHandler::OnTargetChannel, weak_factory_.GetWeakPtr())); | 506 base::Bind(&HelpHandler::OnTargetChannel, weak_factory_.GetWeakPtr())); |
| 510 | 507 |
| 511 if (!base::CommandLine::ForCurrentProcess()->HasSwitch( | 508 if (!base::CommandLine::ForCurrentProcess()->HasSwitch( |
| 512 chromeos::switches::kDisableEolNotification)) { | 509 chromeos::switches::kDisableEolNotification)) { |
| 513 version_updater_->GetEolStatus( | 510 version_updater_->GetEolStatus( |
| 514 base::Bind(&HelpHandler::OnEolStatus, weak_factory_.GetWeakPtr())); | 511 base::Bind(&HelpHandler::OnEolStatus, weak_factory_.GetWeakPtr())); |
| 515 } | 512 } |
| 516 | 513 |
| 517 base::PostTaskWithTraitsAndReplyWithResult( | 514 base::PostTaskWithTraitsAndReplyWithResult( |
| 518 FROM_HERE, base::TaskTraits().MayBlock().WithPriority( | 515 FROM_HERE, {base::MayBlock(), base::TaskPriority::BACKGROUND}, |
| 519 base::TaskPriority::BACKGROUND), | |
| 520 base::Bind(&FindRegulatoryLabelDir), | 516 base::Bind(&FindRegulatoryLabelDir), |
| 521 base::Bind(&HelpHandler::OnRegulatoryLabelDirFound, | 517 base::Bind(&HelpHandler::OnRegulatoryLabelDirFound, |
| 522 weak_factory_.GetWeakPtr())); | 518 weak_factory_.GetWeakPtr())); |
| 523 #endif | 519 #endif |
| 524 } | 520 } |
| 525 | 521 |
| 526 #if defined(OS_MACOSX) | 522 #if defined(OS_MACOSX) |
| 527 void HelpHandler::PromoteUpdater(const base::ListValue* args) { | 523 void HelpHandler::PromoteUpdater(const base::ListValue* args) { |
| 528 version_updater_->PromoteUpdater(); | 524 version_updater_->PromoteUpdater(); |
| 529 } | 525 } |
| (...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 710 void HelpHandler::OnTargetChannel(const std::string& channel) { | 706 void HelpHandler::OnTargetChannel(const std::string& channel) { |
| 711 web_ui()->CallJavascriptFunctionUnsafe("help.HelpPage.updateTargetChannel", | 707 web_ui()->CallJavascriptFunctionUnsafe("help.HelpPage.updateTargetChannel", |
| 712 base::Value(channel)); | 708 base::Value(channel)); |
| 713 } | 709 } |
| 714 | 710 |
| 715 void HelpHandler::OnRegulatoryLabelDirFound(const base::FilePath& path) { | 711 void HelpHandler::OnRegulatoryLabelDirFound(const base::FilePath& path) { |
| 716 if (path.empty()) | 712 if (path.empty()) |
| 717 return; | 713 return; |
| 718 | 714 |
| 719 base::PostTaskWithTraitsAndReplyWithResult( | 715 base::PostTaskWithTraitsAndReplyWithResult( |
| 720 FROM_HERE, base::TaskTraits().MayBlock().WithPriority( | 716 FROM_HERE, {base::MayBlock(), base::TaskPriority::BACKGROUND}, |
| 721 base::TaskPriority::BACKGROUND), | |
| 722 base::Bind(&ReadRegulatoryLabelText, path), | 717 base::Bind(&ReadRegulatoryLabelText, path), |
| 723 base::Bind(&HelpHandler::OnRegulatoryLabelTextRead, | 718 base::Bind(&HelpHandler::OnRegulatoryLabelTextRead, |
| 724 weak_factory_.GetWeakPtr())); | 719 weak_factory_.GetWeakPtr())); |
| 725 | 720 |
| 726 // Send the image path to the WebUI. | 721 // Send the image path to the WebUI. |
| 727 OnRegulatoryLabelImageFound(path.AppendASCII(kRegulatoryLabelImageFilename)); | 722 OnRegulatoryLabelImageFound(path.AppendASCII(kRegulatoryLabelImageFilename)); |
| 728 } | 723 } |
| 729 | 724 |
| 730 void HelpHandler::OnRegulatoryLabelImageFound(const base::FilePath& path) { | 725 void HelpHandler::OnRegulatoryLabelImageFound(const base::FilePath& path) { |
| 731 std::string url = std::string("chrome://") + chrome::kChromeOSAssetHost + | 726 std::string url = std::string("chrome://") + chrome::kChromeOSAssetHost + |
| (...skipping 21 matching lines...) Expand all Loading... |
| 753 base::Value("device_supported"), | 748 base::Value("device_supported"), |
| 754 base::Value("")); | 749 base::Value("")); |
| 755 } else { | 750 } else { |
| 756 web_ui()->CallJavascriptFunctionUnsafe( | 751 web_ui()->CallJavascriptFunctionUnsafe( |
| 757 "help.HelpPage.updateEolMessage", base::Value("device_endoflife"), | 752 "help.HelpPage.updateEolMessage", base::Value("device_endoflife"), |
| 758 base::Value(l10n_util::GetStringUTF16(IDS_ABOUT_PAGE_EOL_EOL))); | 753 base::Value(l10n_util::GetStringUTF16(IDS_ABOUT_PAGE_EOL_EOL))); |
| 759 } | 754 } |
| 760 } | 755 } |
| 761 | 756 |
| 762 #endif // defined(OS_CHROMEOS) | 757 #endif // defined(OS_CHROMEOS) |
| OLD | NEW |