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 "extensions/common/update_manifest.h" | 5 #include "extensions/common/update_manifest.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 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
160 *error_detail += "'."; | 160 *error_detail += "'."; |
161 return false; | 161 return false; |
162 } | 162 } |
163 | 163 |
164 // Get the version. | 164 // Get the version. |
165 result->version = GetAttribute(updatecheck, "version"); | 165 result->version = GetAttribute(updatecheck, "version"); |
166 if (result->version.length() == 0) { | 166 if (result->version.length() == 0) { |
167 *error_detail = "Missing version for updatecheck."; | 167 *error_detail = "Missing version for updatecheck."; |
168 return false; | 168 return false; |
169 } | 169 } |
170 base::Version version(result->version); | 170 Version version(result->version); |
171 if (!version.IsValid()) { | 171 if (!version.IsValid()) { |
172 *error_detail = "Invalid version: '"; | 172 *error_detail = "Invalid version: '"; |
173 *error_detail += result->version; | 173 *error_detail += result->version; |
174 *error_detail += "'."; | 174 *error_detail += "'."; |
175 return false; | 175 return false; |
176 } | 176 } |
177 | 177 |
178 // Get the minimum browser version (not required). | 178 // Get the minimum browser version (not required). |
179 result->browser_min_version = GetAttribute(updatecheck, "prodversionmin"); | 179 result->browser_min_version = GetAttribute(updatecheck, "prodversionmin"); |
180 if (result->browser_min_version.length()) { | 180 if (result->browser_min_version.length()) { |
181 base::Version browser_min_version(result->browser_min_version); | 181 Version browser_min_version(result->browser_min_version); |
182 if (!browser_min_version.IsValid()) { | 182 if (!browser_min_version.IsValid()) { |
183 *error_detail = "Invalid prodversionmin: '"; | 183 *error_detail = "Invalid prodversionmin: '"; |
184 *error_detail += result->browser_min_version; | 184 *error_detail += result->browser_min_version; |
185 *error_detail += "'."; | 185 *error_detail += "'."; |
186 return false; | 186 return false; |
187 } | 187 } |
188 } | 188 } |
189 | 189 |
190 // package_hash is optional. It is a sha256 hash of the package in hex | 190 // package_hash is optional. It is a sha256 hash of the package in hex |
191 // format. | 191 // format. |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
276 std::string error; | 276 std::string error; |
277 if (!ParseSingleAppTag(apps[i], gupdate_ns, ¤t, &error)) { | 277 if (!ParseSingleAppTag(apps[i], gupdate_ns, ¤t, &error)) { |
278 ParseError("%s", error.c_str()); | 278 ParseError("%s", error.c_str()); |
279 } else { | 279 } else { |
280 results_.list.push_back(current); | 280 results_.list.push_back(current); |
281 } | 281 } |
282 } | 282 } |
283 | 283 |
284 return true; | 284 return true; |
285 } | 285 } |
OLD | NEW |