Chromium Code Reviews| 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 d0326c27b4f7bc4d9d3896bd204fe55e6d2a1f2c..97a636af9a22845ca5068b39bf0421082ba7ea21 100644 |
| --- a/chrome/browser/ui/webui/help/help_handler.cc |
| +++ b/chrome/browser/ui/webui/help/help_handler.cc |
| @@ -10,8 +10,11 @@ |
| #include "base/bind.h" |
| #include "base/bind_helpers.h" |
| #include "base/command_line.h" |
| +#include "base/files/file_util.h" |
| +#include "base/location.h" |
| #include "base/strings/string16.h" |
| #include "base/strings/string_number_conversions.h" |
| +#include "base/strings/string_util.h" |
| #include "base/strings/utf_string_conversions.h" |
| #include "base/values.h" |
| #include "chrome/browser/browser_process.h" |
| @@ -64,6 +67,8 @@ namespace { |
| #if defined(OS_CHROMEOS) |
| +const char kFCCLabelTextPath[] = "fcc/label.txt"; |
| + |
| // Returns message that informs user that for update it's better to |
| // connect to a network of one of the allowed types. |
| base::string16 GetAllowedConnectionTypesMessage() { |
| @@ -384,6 +389,10 @@ void HelpHandler::OnPageLoaded(const base::ListValue* args) { |
| base::Bind(&HelpHandler::OnCurrentChannel, weak_factory_.GetWeakPtr())); |
| version_updater_->GetChannel(false, |
| base::Bind(&HelpHandler::OnTargetChannel, weak_factory_.GetWeakPtr())); |
| + |
| + BrowserThread::PostTask( |
| + BrowserThread::FILE, FROM_HERE, |
| + base::Bind(&HelpHandler::LoadFCCLabelText, weak_factory_.GetWeakPtr())); |
|
satorux1
2014/12/04 08:20:04
This code is incorrect. You cannot use a UI-thread
|
| #endif |
| } |
| @@ -565,4 +574,16 @@ 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", |
|
satorux1
2014/12/04 08:20:04
This code is probably incorrect too. It looks unsa
|
| + label); |
| + } |
| +} |
| + |
| #endif // defined(OS_CHROMEOS) |