Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(3713)

Unified Diff: chrome/browser/ui/webui/help/help_handler.cc

Issue 23588009: Parse /etc/lsb-release only once on ChromeOS (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase Created 7 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/ui/webui/help/help_handler.h ('k') | chrome/chrome_tests_unit.gypi » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 6fdc04f7a7067af9ba1d0cef33cfc5ffbcf91cd4..f1891ac5b151ed4d0527e9ee0c5c8c11c1865b43 100644
--- a/chrome/browser/ui/webui/help/help_handler.cc
+++ b/chrome/browser/ui/webui/help/help_handler.cc
@@ -125,11 +125,6 @@ bool CanChangeChannel() {
return false;
}
-// Pointer to a |StringValue| holding the date of the build date to Chromium
-// OS. Because this value is obtained by reading a file, it is cached here to
-// prevent the need to read from the file system multiple times unnecessarily.
-Value* g_build_date_string = NULL;
-
#endif // defined(OS_CHROMEOS)
} // namespace
@@ -343,18 +338,10 @@ void HelpHandler::OnPageLoaded(const ListValue* args) {
"help.HelpPage.updateEnableReleaseChannel",
base::FundamentalValue(CanChangeChannel()));
- if (g_build_date_string == NULL) {
- // If |g_build_date_string| is |NULL|, the date has not yet been assigned.
- // Get the date of the last lsb-release file modification.
- base::FileUtilProxy::GetFileInfo(
- BrowserThread::GetMessageLoopProxyForThread(BrowserThread::FILE).get(),
- base::SysInfo::GetLsbReleaseFilePath(),
- base::Bind(&HelpHandler::ProcessLsbFileInfo,
- weak_factory_.GetWeakPtr()));
- } else {
- web_ui()->CallJavascriptFunction("help.HelpPage.setBuildDate",
- *g_build_date_string);
- }
+ base::Time build_time = base::SysInfo::GetLsbReleaseTime();
+ string16 build_date = base::TimeFormatFriendlyDate(build_time);
+ web_ui()->CallJavascriptFunction("help.HelpPage.setBuildDate",
+ base::StringValue(build_date));
#endif // defined(OS_CHROMEOS)
version_updater_->CheckForUpdate(
@@ -546,31 +533,4 @@ void HelpHandler::OnTargetChannel(const std::string& channel) {
"help.HelpPage.updateTargetChannel", base::StringValue(channel));
}
-void HelpHandler::ProcessLsbFileInfo(
- base::PlatformFileError error, const base::PlatformFileInfo& file_info) {
- DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
-
- // If |g_build_date_string| is not |NULL|, then the file's information has
- // already been retrieved by another tab.
- if (g_build_date_string == NULL) {
- base::Time time;
- if (error == base::PLATFORM_FILE_OK) {
- // Retrieves the time at which the Chrome OS build was created.
- // Each time a new build is created, /etc/lsb-release is modified with the
- // new version numbers of the release.
- time = file_info.last_modified;
- } else {
- // If the time of the build cannot be retrieved, return and do not
- // display the "Build Date" section.
- return;
- }
-
- // Note that this string will be internationalized.
- string16 build_date = base::TimeFormatFriendlyDate(time);
- g_build_date_string = Value::CreateStringValue(build_date);
- }
-
- web_ui()->CallJavascriptFunction("help.HelpPage.setBuildDate",
- *g_build_date_string);
-}
#endif // defined(OS_CHROMEOS)
« no previous file with comments | « chrome/browser/ui/webui/help/help_handler.h ('k') | chrome/chrome_tests_unit.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698