diff options
author | evan@chromium.org <evan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-08-27 20:28:42 +0000 |
---|---|---|
committer | evan@chromium.org <evan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-08-27 20:28:42 +0000 |
commit | 0211f57eabdc1a3e34aee1e1629c26e93b803ded (patch) | |
tree | 3bcbab3506e5f3dbcbc99825529cc803d223b017 /chrome/browser/metrics | |
parent | 1f8322043d302eb0f6a050a21d2f0f9a8c1df71e (diff) | |
download | chromium_src-0211f57eabdc1a3e34aee1e1629c26e93b803ded.zip chromium_src-0211f57eabdc1a3e34aee1e1629c26e93b803ded.tar.gz chromium_src-0211f57eabdc1a3e34aee1e1629c26e93b803ded.tar.bz2 |
Refactor version-getting info into a chrome::VersionInfo object.
I was trying to replace wstring usage in base::FileVersionInfo, but
that class is rather Windows-specific with strange fields like
"private_build()" where the value and encoding aren't clear. 95%
of the users of FileVersionInfo actually just care about the current
Chrome version, so we can provide a much simpler interface for them.
We still use FileVersionInfo for retrieving information from e.g.
plugin DLLs, but in those cases the usage is clearer.
Review URL: http://codereview.chromium.org/3135028
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@57725 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/metrics')
-rw-r--r-- | chrome/browser/metrics/metrics_log.cc | 23 |
1 files changed, 10 insertions, 13 deletions
diff --git a/chrome/browser/metrics/metrics_log.cc b/chrome/browser/metrics/metrics_log.cc index 9364427..396c533 100644 --- a/chrome/browser/metrics/metrics_log.cc +++ b/chrome/browser/metrics/metrics_log.cc @@ -9,7 +9,6 @@ #include "base/basictypes.h" #include "base/file_util.h" -#include "base/file_version_info.h" #include "base/perftimer.h" #include "base/scoped_ptr.h" #include "base/string_util.h" @@ -70,20 +69,18 @@ std::string MetricsLog::GetInstallDate() const { // static std::string MetricsLog::GetVersionString() { - scoped_ptr<FileVersionInfo> version_info( - chrome::GetChromeVersionInfo()); - if (version_info.get()) { - std::string version = WideToUTF8(version_info->product_version()); - if (!version_extension_.empty()) - version += version_extension_; - if (!version_info->is_official_build()) - version.append("-devel"); - return version; - } else { - NOTREACHED() << "Unable to retrieve version string."; + chrome::VersionInfo version_info; + if (!version_info.is_valid()) { + NOTREACHED() << "Unable to retrieve version info."; + return std::string(); } - return std::string(); + std::string version = version_info.Version(); + if (!version_extension_.empty()) + version += version_extension_; + if (!version_info.IsOfficialBuild()) + version.append("-devel"); + return version; } void MetricsLog::RecordIncrementalStabilityElements() { |