[go: nahoru, domu]

Add a convenience function to Version

Came up as in item in a component updater review. It is a common pattern used in extension updater and component updater.

TEST=included
BUG=none
Review URL: http://codereview.chromium.org/7541015

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@94928 0039d316-1c4b-4281-b951-d872f2087c98
diff --git a/base/version.h b/base/version.h
index e03b01a..b61cbb55 100644
--- a/base/version.h
+++ b/base/version.h
@@ -31,6 +31,12 @@
   // Returns true if the object contains a valid version number.
   bool IsValid() const;
 
+  // Commonly used pattern. Given a valid version object, compare if a
+  // |version_str| results in a newer version. Returns true if the
+  // string represents valid version and if the version is greater than
+  // than the version of this object.
+  bool IsOlderThan(const std::string& version_str) const;
+
   // Returns NULL if the string is not in the proper format.
   // Caller is responsible for freeing the Version object once done.
   // DO NOT USE FOR NEWER CODE.