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; |
} |