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


CrOS-Libchrome-Original-Commit: 30c157c0312dd978500c5ede8cc06849b4c13f77
diff --git a/base/version.cc b/base/version.cc
index cdd15a0..1f9bd20 100644
--- a/base/version.cc
+++ b/base/version.cc
@@ -45,6 +45,13 @@
   return (!components_.empty());
 }
 
+bool Version::IsOlderThan(const std::string& version_str) const {
+  Version proposed_ver(version_str);
+  if (!proposed_ver.IsValid())
+    return false;
+  return (CompareTo(proposed_ver) < 0);
+}
+
 // TODO(cpu): remove this method.
 Version* Version::GetVersionFromString(const std::string& version_str) {
   Version* vers = new Version(version_str);