| Index: chrome/browser/ui/webui/help/help_handler.cc
|
| diff --git a/chrome/browser/ui/webui/help/help_handler.cc b/chrome/browser/ui/webui/help/help_handler.cc
|
| index b88247f3f3061447b0ef0f9e38ef3f2e5bed1c6b..532fe51bac0ee08950016f49aa35b146502e86c5 100644
|
| --- a/chrome/browser/ui/webui/help/help_handler.cc
|
| +++ b/chrome/browser/ui/webui/help/help_handler.cc
|
| @@ -49,6 +49,7 @@
|
| #include "base/i18n/time_formatting.h"
|
| #include "base/prefs/pref_service.h"
|
| #include "base/sys_info.h"
|
| +#include "base/task_runner_util.h"
|
| #include "chrome/browser/chromeos/ownership/owner_settings_service_chromeos.h"
|
| #include "chrome/browser/chromeos/ownership/owner_settings_service_chromeos_factory.h"
|
| #include "chrome/browser/chromeos/policy/browser_policy_connector_chromeos.h"
|
| @@ -126,6 +127,19 @@ bool CanChangeChannel(Profile* profile) {
|
| return false;
|
| }
|
|
|
| +// Reads the file containing the FCC label text, if found. Must be called from
|
| +// the blocking pool.
|
| +std::string ReadFCCLabelText() {
|
| + const base::FilePath asset_dir(FILE_PATH_LITERAL(chrome::kChromeOSAssetPath));
|
| + const base::FilePath label_file_path =
|
| + asset_dir.AppendASCII(kFCCLabelTextPath);
|
| +
|
| + std::string contents;
|
| + if (base::ReadFileToString(label_file_path, &contents))
|
| + return contents;
|
| + return std::string();
|
| +}
|
| +
|
| #endif // defined(OS_CHROMEOS)
|
|
|
| } // namespace
|
| @@ -403,9 +417,12 @@ void HelpHandler::OnPageLoaded(const base::ListValue* args) {
|
| version_updater_->GetChannel(false,
|
| base::Bind(&HelpHandler::OnTargetChannel, weak_factory_.GetWeakPtr()));
|
|
|
| - BrowserThread::PostTask(
|
| - BrowserThread::FILE, FROM_HERE,
|
| - base::Bind(&HelpHandler::LoadFCCLabelText, weak_factory_.GetWeakPtr()));
|
| + base::PostTaskAndReplyWithResult(
|
| + content::BrowserThread::GetBlockingPool(),
|
| + FROM_HERE,
|
| + base::Bind(&ReadFCCLabelText),
|
| + base::Bind(&HelpHandler::OnFCCLabelTextRead,
|
| + weak_factory_.GetWeakPtr()));
|
| #endif
|
| }
|
|
|
| @@ -587,16 +604,11 @@ void HelpHandler::OnTargetChannel(const std::string& channel) {
|
| "help.HelpPage.updateTargetChannel", base::StringValue(channel));
|
| }
|
|
|
| -void HelpHandler::LoadFCCLabelText() {
|
| - base::FilePath path(std::string(chrome::kChromeOSAssetPath) +
|
| - kFCCLabelTextPath);
|
| - std::string contents;
|
| - if (base::ReadFileToString(path, &contents)) {
|
| - // Remove unnecessary whitespace.
|
| - base::StringValue label(base::CollapseWhitespaceASCII(contents, true));
|
| - web_ui()->CallJavascriptFunction("help.HelpPage.setProductLabelText",
|
| - label);
|
| - }
|
| +void HelpHandler::OnFCCLabelTextRead(const std::string& text) {
|
| + // Remove unnecessary whitespace.
|
| + web_ui()->CallJavascriptFunction(
|
| + "help.HelpPage.setProductLabelText",
|
| + base::StringValue(base::CollapseWhitespaceASCII(text, true)));
|
| }
|
|
|
| #endif // defined(OS_CHROMEOS)
|
|
|