| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "components/update_client/update_response.h" | 5 #include "components/update_client/update_response.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include <algorithm> | 9 #include <algorithm> |
| 10 #include <memory> | 10 #include <memory> |
| (...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 155 // Parses the <manifest> tag. | 155 // Parses the <manifest> tag. |
| 156 bool ParseManifestTag(xmlNode* manifest, | 156 bool ParseManifestTag(xmlNode* manifest, |
| 157 UpdateResponse::Result* result, | 157 UpdateResponse::Result* result, |
| 158 std::string* error) { | 158 std::string* error) { |
| 159 // Get the version. | 159 // Get the version. |
| 160 result->manifest.version = GetAttribute(manifest, "version"); | 160 result->manifest.version = GetAttribute(manifest, "version"); |
| 161 if (result->manifest.version.empty()) { | 161 if (result->manifest.version.empty()) { |
| 162 *error = "Missing version for manifest."; | 162 *error = "Missing version for manifest."; |
| 163 return false; | 163 return false; |
| 164 } | 164 } |
| 165 Version version(result->manifest.version); | 165 base::Version version(result->manifest.version); |
| 166 if (!version.IsValid()) { | 166 if (!version.IsValid()) { |
| 167 *error = "Invalid version: '"; | 167 *error = "Invalid version: '"; |
| 168 *error += result->manifest.version; | 168 *error += result->manifest.version; |
| 169 *error += "'."; | 169 *error += "'."; |
| 170 return false; | 170 return false; |
| 171 } | 171 } |
| 172 | 172 |
| 173 // Get the minimum browser version (not required). | 173 // Get the minimum browser version (not required). |
| 174 result->manifest.browser_min_version = | 174 result->manifest.browser_min_version = |
| 175 GetAttribute(manifest, "prodversionmin"); | 175 GetAttribute(manifest, "prodversionmin"); |
| 176 if (result->manifest.browser_min_version.length()) { | 176 if (result->manifest.browser_min_version.length()) { |
| 177 Version browser_min_version(result->manifest.browser_min_version); | 177 base::Version browser_min_version(result->manifest.browser_min_version); |
| 178 if (!browser_min_version.IsValid()) { | 178 if (!browser_min_version.IsValid()) { |
| 179 *error = "Invalid prodversionmin: '"; | 179 *error = "Invalid prodversionmin: '"; |
| 180 *error += result->manifest.browser_min_version; | 180 *error += result->manifest.browser_min_version; |
| 181 *error += "'."; | 181 *error += "'."; |
| 182 return false; | 182 return false; |
| 183 } | 183 } |
| 184 } | 184 } |
| 185 | 185 |
| 186 // Get the <packages> node. | 186 // Get the <packages> node. |
| 187 std::vector<xmlNode*> packages = GetChildren(manifest, "packages"); | 187 std::vector<xmlNode*> packages = GetChildren(manifest, "packages"); |
| (...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 352 results_.list.push_back(result); | 352 results_.list.push_back(result); |
| 353 } else { | 353 } else { |
| 354 ParseError("%s", error.c_str()); | 354 ParseError("%s", error.c_str()); |
| 355 } | 355 } |
| 356 } | 356 } |
| 357 | 357 |
| 358 return true; | 358 return true; |
| 359 } | 359 } |
| 360 | 360 |
| 361 } // namespace update_client | 361 } // namespace update_client |
| OLD | NEW |