OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/browser/component_updater/update_response.h" | 5 #include "chrome/browser/component_updater/update_response.h" |
6 #include <algorithm> | 6 #include <algorithm> |
7 #include "base/memory/scoped_ptr.h" | 7 #include "base/memory/scoped_ptr.h" |
8 #include "base/stl_util.h" | 8 #include "base/stl_util.h" |
9 #include "base/strings/string_number_conversions.h" | 9 #include "base/strings/string_number_conversions.h" |
10 #include "base/strings/string_util.h" | 10 #include "base/strings/string_util.h" |
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
139 // Parses the <manifest> tag. | 139 // Parses the <manifest> tag. |
140 bool ParseManifestTag(xmlNode* manifest, | 140 bool ParseManifestTag(xmlNode* manifest, |
141 UpdateResponse::Result* result, | 141 UpdateResponse::Result* result, |
142 std::string* error) { | 142 std::string* error) { |
143 // Get the version. | 143 // Get the version. |
144 result->manifest.version = GetAttribute(manifest, "version"); | 144 result->manifest.version = GetAttribute(manifest, "version"); |
145 if (result->manifest.version.empty()) { | 145 if (result->manifest.version.empty()) { |
146 *error = "Missing version for manifest."; | 146 *error = "Missing version for manifest."; |
147 return false; | 147 return false; |
148 } | 148 } |
149 base::Version version(result->manifest.version); | 149 Version version(result->manifest.version); |
150 if (!version.IsValid()) { | 150 if (!version.IsValid()) { |
151 *error = "Invalid version: '"; | 151 *error = "Invalid version: '"; |
152 *error += result->manifest.version; | 152 *error += result->manifest.version; |
153 *error += "'."; | 153 *error += "'."; |
154 return false; | 154 return false; |
155 } | 155 } |
156 | 156 |
157 // Get the minimum browser version (not required). | 157 // Get the minimum browser version (not required). |
158 result->manifest.browser_min_version = | 158 result->manifest.browser_min_version = |
159 GetAttribute(manifest, "prodversionmin"); | 159 GetAttribute(manifest, "prodversionmin"); |
160 if (result->manifest.browser_min_version.length()) { | 160 if (result->manifest.browser_min_version.length()) { |
161 base::Version browser_min_version(result->manifest.browser_min_version); | 161 Version browser_min_version(result->manifest.browser_min_version); |
162 if (!browser_min_version.IsValid()) { | 162 if (!browser_min_version.IsValid()) { |
163 *error = "Invalid prodversionmin: '"; | 163 *error = "Invalid prodversionmin: '"; |
164 *error += result->manifest.browser_min_version; | 164 *error += result->manifest.browser_min_version; |
165 *error += "'."; | 165 *error += "'."; |
166 return false; | 166 return false; |
167 } | 167 } |
168 } | 168 } |
169 | 169 |
170 // Get the <packages> node. | 170 // Get the <packages> node. |
171 std::vector<xmlNode*> packages = GetChildren(manifest, "packages"); | 171 std::vector<xmlNode*> packages = GetChildren(manifest, "packages"); |
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
329 } else { | 329 } else { |
330 ParseError("%s", error.c_str()); | 330 ParseError("%s", error.c_str()); |
331 } | 331 } |
332 } | 332 } |
333 | 333 |
334 return true; | 334 return true; |
335 } | 335 } |
336 | 336 |
337 } // namespace component_updater | 337 } // namespace component_updater |
338 | 338 |
OLD | NEW |