OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/common/extensions/update_manifest.h" | 5 #include "chrome/common/extensions/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 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
158 *error_detail += "'."; | 158 *error_detail += "'."; |
159 return false; | 159 return false; |
160 } | 160 } |
161 | 161 |
162 // Get the version. | 162 // Get the version. |
163 result->version = GetAttribute(updatecheck, "version"); | 163 result->version = GetAttribute(updatecheck, "version"); |
164 if (result->version.length() == 0) { | 164 if (result->version.length() == 0) { |
165 *error_detail = "Missing version for updatecheck."; | 165 *error_detail = "Missing version for updatecheck."; |
166 return false; | 166 return false; |
167 } | 167 } |
168 scoped_ptr<Version> version(Version::GetVersionFromString(result->version)); | 168 Version version(result->version); |
169 if (!version.get()) { | 169 if (!version.IsValid()) { |
170 *error_detail = "Invalid version: '"; | 170 *error_detail = "Invalid version: '"; |
171 *error_detail += result->version; | 171 *error_detail += result->version; |
172 *error_detail += "'."; | 172 *error_detail += "'."; |
173 return false; | 173 return false; |
174 } | 174 } |
175 | 175 |
176 // Get the minimum browser version (not required). | 176 // Get the minimum browser version (not required). |
177 result->browser_min_version = GetAttribute(updatecheck, "prodversionmin"); | 177 result->browser_min_version = GetAttribute(updatecheck, "prodversionmin"); |
178 if (result->browser_min_version.length()) { | 178 if (result->browser_min_version.length()) { |
179 scoped_ptr<Version> browser_min_version( | 179 Version browser_min_version(result->browser_min_version); |
180 Version::GetVersionFromString(result->browser_min_version)); | 180 if (!browser_min_version.IsValid()) { |
181 if (!browser_min_version.get()) { | |
182 *error_detail = "Invalid prodversionmin: '"; | 181 *error_detail = "Invalid prodversionmin: '"; |
183 *error_detail += result->browser_min_version; | 182 *error_detail += result->browser_min_version; |
184 *error_detail += "'."; | 183 *error_detail += "'."; |
185 return false; | 184 return false; |
186 } | 185 } |
187 } | 186 } |
188 | 187 |
189 // package_hash is optional. It is only required for blacklist. It is a | 188 // package_hash is optional. It is only required for blacklist. It is a |
190 // sha256 hash of the package in hex format. | 189 // sha256 hash of the package in hex format. |
191 result->package_hash = GetAttribute(updatecheck, "hash"); | 190 result->package_hash = GetAttribute(updatecheck, "hash"); |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
258 std::string error; | 257 std::string error; |
259 if (!ParseSingleAppTag(apps[i], gupdate_ns, ¤t, &error)) { | 258 if (!ParseSingleAppTag(apps[i], gupdate_ns, ¤t, &error)) { |
260 ParseError("%s", error.c_str()); | 259 ParseError("%s", error.c_str()); |
261 } else { | 260 } else { |
262 results_.list.push_back(current); | 261 results_.list.push_back(current); |
263 } | 262 } |
264 } | 263 } |
265 | 264 |
266 return true; | 265 return true; |
267 } | 266 } |
OLD | NEW |