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

Unified Diff: chrome/common/chrome_version_info.cc

Issue 5815001: Fixed file_version_info so that it finds Mac values correctly. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Changed logging to vlog Created 10 years 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
Index: chrome/common/chrome_version_info.cc
diff --git a/chrome/common/chrome_version_info.cc b/chrome/common/chrome_version_info.cc
index 5157c4a4e3a81c6790b4974e33977a4393f9cacf..e53b149a889dd81c63fd58dcde408aec538eb5b2 100644
--- a/chrome/common/chrome_version_info.cc
+++ b/chrome/common/chrome_version_info.cc
@@ -9,12 +9,14 @@
#include "base/string_util.h"
#include "base/thread_restrictions.h"
#include "build/build_config.h"
+#include "chrome/common/chrome_constants.h"
namespace chrome {
#if defined(OS_WIN) || defined(OS_MACOSX)
-// On Windows and Mac, we get the Chrome version info by querying
-// FileVersionInfo for the current module.
+// On Windows and Mac we get the Chrome version info by querying FileVersionInfo
+// for the current module if it is available, otherwise we fall back to coded
+// values.
VersionInfo::VersionInfo() {
// The current module is already loaded in memory, so this will be cheap.
@@ -25,30 +27,27 @@ VersionInfo::VersionInfo() {
VersionInfo::~VersionInfo() {
}
-bool VersionInfo::is_valid() const {
- return version_info_.get() != NULL;
-}
-
std::string VersionInfo::Name() const {
- if (!is_valid())
- return std::string();
- return WideToASCII(version_info_->product_name());
+ std::wstring name =
+ version_info_.get() ? version_info_->product_name()
+ : kBrowserProcessExecutableName;
+ return WideToASCII(name);
}
std::string VersionInfo::Version() const {
- if (!is_valid())
- return std::string();
+ if (!version_info_.get())
+ return kChromeVersion;
Erik does not do reviews 2010/12/14 19:16:32 I think you've lost me here. What are we trying t
return WideToASCII(version_info_->product_version());
}
std::string VersionInfo::LastChange() const {
- if (!is_valid())
- return std::string();
+ if (!version_info_.get())
+ return "0";
return WideToASCII(version_info_->last_change());
}
bool VersionInfo::IsOfficialBuild() const {
- if (!is_valid())
+ if (!version_info_.get())
return false;
return version_info_->is_official_build();
}
@@ -65,10 +64,6 @@ VersionInfo::VersionInfo() {
VersionInfo::~VersionInfo() {
}
-bool VersionInfo::is_valid() const {
- return true;
-}
-
std::string VersionInfo::Name() const {
return PRODUCT_NAME;
}

Powered by Google App Engine
This is Rietveld 408576698