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..3417b036c7a93722d8e4ae2bc82b10e7e89b5f42 100644 |
--- a/chrome/browser/ui/webui/help/help_handler.cc |
+++ b/chrome/browser/ui/webui/help/help_handler.cc |
@@ -47,8 +47,10 @@ |
#if defined(OS_CHROMEOS) |
#include "base/files/file_util_proxy.h" |
#include "base/i18n/time_formatting.h" |
+#include "base/path_service.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" |
@@ -58,6 +60,7 @@ |
#include "chrome/browser/ui/webui/chromeos/image_source.h" |
#include "chrome/browser/ui/webui/help/help_utils_chromeos.h" |
#include "chrome/browser/ui/webui/help/version_updater_chromeos.h" |
+#include "chromeos/chromeos_paths.h" |
#include "chromeos/chromeos_switches.h" |
#include "chromeos/dbus/dbus_thread_manager.h" |
#include "chromeos/dbus/power_manager_client.h" |
@@ -126,6 +129,18 @@ bool CanChangeChannel(Profile* profile) { |
return false; |
} |
+// Reads the file containing the FCC label text, if found. |
+std::string ReadFCCLabelText() { |
+ base::FilePath shared_assets_dir; |
+ std::string contents; |
+ if (PathService::Get(chromeos::DIR_SHARED_ASSETS, &shared_assets_dir) && |
+ base::ReadFileToString(shared_assets_dir.AppendASCII(kFCCLabelTextPath), |
+ &contents)) { |
+ return contents; |
+ } |
+ return std::string(); |
+} |
+ |
#endif // defined(OS_CHROMEOS) |
} // namespace |
@@ -403,9 +418,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 +605,13 @@ 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(std::string text) { |
+ // Remove unnecessary whitespace. |
+ text = base::CollapseWhitespaceASCII(text, true); |
+ if (text.empty()) |
+ return; |
+ base::StringValue label(text); |
+ web_ui()->CallJavascriptFunction("help.HelpPage.setProductLabelText", label); |
} |
#endif // defined(OS_CHROMEOS) |