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 <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
10 #include "base/stl_util.h" | 10 #include "base/stl_util.h" |
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
149 // Parses the <manifest> tag. | 149 // Parses the <manifest> tag. |
150 bool ParseManifestTag(xmlNode* manifest, | 150 bool ParseManifestTag(xmlNode* manifest, |
151 UpdateResponse::Result* result, | 151 UpdateResponse::Result* result, |
152 std::string* error) { | 152 std::string* error) { |
153 // Get the version. | 153 // Get the version. |
154 result->manifest.version = GetAttribute(manifest, "version"); | 154 result->manifest.version = GetAttribute(manifest, "version"); |
155 if (result->manifest.version.empty()) { | 155 if (result->manifest.version.empty()) { |
156 *error = "Missing version for manifest."; | 156 *error = "Missing version for manifest."; |
157 return false; | 157 return false; |
158 } | 158 } |
159 base::Version version(result->manifest.version); | 159 Version version(result->manifest.version); |
160 if (!version.IsValid()) { | 160 if (!version.IsValid()) { |
161 *error = "Invalid version: '"; | 161 *error = "Invalid version: '"; |
162 *error += result->manifest.version; | 162 *error += result->manifest.version; |
163 *error += "'."; | 163 *error += "'."; |
164 return false; | 164 return false; |
165 } | 165 } |
166 | 166 |
167 // Get the minimum browser version (not required). | 167 // Get the minimum browser version (not required). |
168 result->manifest.browser_min_version = | 168 result->manifest.browser_min_version = |
169 GetAttribute(manifest, "prodversionmin"); | 169 GetAttribute(manifest, "prodversionmin"); |
170 if (result->manifest.browser_min_version.length()) { | 170 if (result->manifest.browser_min_version.length()) { |
171 base::Version browser_min_version(result->manifest.browser_min_version); | 171 Version browser_min_version(result->manifest.browser_min_version); |
172 if (!browser_min_version.IsValid()) { | 172 if (!browser_min_version.IsValid()) { |
173 *error = "Invalid prodversionmin: '"; | 173 *error = "Invalid prodversionmin: '"; |
174 *error += result->manifest.browser_min_version; | 174 *error += result->manifest.browser_min_version; |
175 *error += "'."; | 175 *error += "'."; |
176 return false; | 176 return false; |
177 } | 177 } |
178 } | 178 } |
179 | 179 |
180 // Get the <packages> node. | 180 // Get the <packages> node. |
181 std::vector<xmlNode*> packages = GetChildren(manifest, "packages"); | 181 std::vector<xmlNode*> packages = GetChildren(manifest, "packages"); |
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
340 results_.list.push_back(result); | 340 results_.list.push_back(result); |
341 } else { | 341 } else { |
342 ParseError("%s", error.c_str()); | 342 ParseError("%s", error.c_str()); |
343 } | 343 } |
344 } | 344 } |
345 | 345 |
346 return true; | 346 return true; |
347 } | 347 } |
348 | 348 |
349 } // namespace update_client | 349 } // namespace update_client |
OLD | NEW |