| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "chrome/installer/util/version.h" | 5 #include "chrome/installer/util/version.h" |
| 6 | 6 |
| 7 #include <vector> | 7 #include <vector> |
| 8 | 8 |
| 9 #include "base/format_macros.h" | 9 #include "base/format_macros.h" |
| 10 #include "base/string_number_conversions.h" | 10 #include "base/string_number_conversions.h" |
| (...skipping 22 matching lines...) Expand all Loading... |
| 33 ((major_ == other->major_) && (minor_ == other->minor_) | 33 ((major_ == other->major_) && (minor_ == other->minor_) |
| 34 && (build_ > other->build_)) || | 34 && (build_ > other->build_)) || |
| 35 ((major_ == other->major_) && (minor_ == other->minor_) | 35 ((major_ == other->major_) && (minor_ == other->minor_) |
| 36 && (build_ == other->build_) | 36 && (build_ == other->build_) |
| 37 && (patch_ > other->patch_))); | 37 && (patch_ > other->patch_))); |
| 38 } | 38 } |
| 39 | 39 |
| 40 installer::Version* installer::Version::GetVersionFromString( | 40 installer::Version* installer::Version::GetVersionFromString( |
| 41 const string16& version_str) { | 41 const string16& version_str) { |
| 42 std::vector<string16> numbers; | 42 std::vector<string16> numbers; |
| 43 SplitString(version_str, '.', &numbers); | 43 base::SplitString(version_str, '.', &numbers); |
| 44 | 44 |
| 45 if (numbers.size() != 4) { | 45 if (numbers.size() != 4) { |
| 46 LOG(ERROR) << "Invalid version string: " << version_str; | 46 LOG(ERROR) << "Invalid version string: " << version_str; |
| 47 return NULL; | 47 return NULL; |
| 48 } | 48 } |
| 49 | 49 |
| 50 int64 v0, v1, v2, v3; | 50 int64 v0, v1, v2, v3; |
| 51 base::StringToInt64(numbers[0], &v0); | 51 base::StringToInt64(numbers[0], &v0); |
| 52 base::StringToInt64(numbers[1], &v1); | 52 base::StringToInt64(numbers[1], &v1); |
| 53 base::StringToInt64(numbers[2], &v2); | 53 base::StringToInt64(numbers[2], &v2); |
| 54 base::StringToInt64(numbers[3], &v3); | 54 base::StringToInt64(numbers[3], &v3); |
| 55 return new Version(v0, v1, v2, v3); | 55 return new Version(v0, v1, v2, v3); |
| 56 } | 56 } |
| OLD | NEW |