summaryrefslogtreecommitdiffstats
path: root/chrome/common/chrome_version_info.h
diff options
context:
space:
mode:
authorevan@chromium.org <evan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-08-27 20:28:42 +0000
committerevan@chromium.org <evan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-08-27 20:28:42 +0000
commit0211f57eabdc1a3e34aee1e1629c26e93b803ded (patch)
tree3bcbab3506e5f3dbcbc99825529cc803d223b017 /chrome/common/chrome_version_info.h
parent1f8322043d302eb0f6a050a21d2f0f9a8c1df71e (diff)
downloadchromium_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/common/chrome_version_info.h')
-rw-r--r--chrome/common/chrome_version_info.h42
1 files changed, 39 insertions, 3 deletions
diff --git a/chrome/common/chrome_version_info.h b/chrome/common/chrome_version_info.h
index a539130..0ec911e 100644
--- a/chrome/common/chrome_version_info.h
+++ b/chrome/common/chrome_version_info.h
@@ -6,13 +6,49 @@
#define CHROME_COMMON_CHROME_VERSION_INFO_H_
#pragma once
+#include <string>
+
+#include "base/basictypes.h"
+#include "base/scoped_ptr.h"
+
class FileVersionInfo;
namespace chrome {
-// Creates a FileVersionInfo for the app, Chrome. Returns NULL in case of
-// error. The returned object should be deleted when you are done with it.
-FileVersionInfo* GetChromeVersionInfo();
+// An instance of chrome::VersionInfo has information about the
+// current running build of Chrome.
+class VersionInfo {
+ public:
+ VersionInfo();
+ ~VersionInfo();
+
+ // In the rare case where we fail to get the version info,
+ // is_valid() will return false. The other functions will return
+ // the empty string in this case, so it's not harmful if you don't
+ // check is_valid().
+ bool is_valid() const;
+
+ // E.g. "Chromium" or "Google Chrome".
+ std::string Name() const;
+
+ // Version number, e.g. "6.0.490.1".
+ std::string Version() const;
+
+ // The SVN revision of this release. E.g. "55800".
+ std::string LastChange() const;
+
+ // Whether this is an "official" release of the current Version():
+ // whether knowing Version() is enough to completely determine what
+ // LastChange() is.
+ bool IsOfficialBuild() const;
+
+ private:
+#if defined(OS_WIN) || defined(OS_MACOSX)
+ scoped_ptr<FileVersionInfo> version_info_;
+#endif
+
+ DISALLOW_COPY_AND_ASSIGN(VersionInfo);
+};
} // namespace chrome