Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(61)

Side by Side Diff: trunk/src/chrome/common/extensions/update_manifest.cc

Issue 17551004: Revert 207805 "Differential updates for components. We are addin..." (Closed) Base URL: svn://svn.chromium.org/chrome/
Patch Set: Created 7 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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"
11 #include "base/strings/string_number_conversions.h" 11 #include "base/strings/string_number_conversions.h"
12 #include "base/strings/string_util.h" 12 #include "base/strings/string_util.h"
13 #include "base/strings/stringprintf.h" 13 #include "base/strings/stringprintf.h"
14 #include "base/version.h" 14 #include "base/version.h"
15 #include "libxml/tree.h" 15 #include "libxml/tree.h"
16 #include "third_party/libxml/chromium/libxml_utils.h" 16 #include "third_party/libxml/chromium/libxml_utils.h"
17 17
18 static const char* kExpectedGupdateProtocol = "2.0"; 18 static const char* kExpectedGupdateProtocol = "2.0";
19 static const char* kExpectedGupdateXmlns = 19 static const char* kExpectedGupdateXmlns =
20 "http://www.google.com/update2/response"; 20 "http://www.google.com/update2/response";
21 21
22 UpdateManifest::Result::Result() 22 UpdateManifest::Result::Result() {}
23 : size(0),
24 diff_size(0) {}
25 23
26 UpdateManifest::Result::~Result() {} 24 UpdateManifest::Result::~Result() {}
27 25
28 UpdateManifest::Results::Results() : daystart_elapsed_seconds(kNoDaystart) {} 26 UpdateManifest::Results::Results() : daystart_elapsed_seconds(kNoDaystart) {}
29 27
30 UpdateManifest::Results::~Results() {} 28 UpdateManifest::Results::~Results() {}
31 29
32 UpdateManifest::UpdateManifest() { 30 UpdateManifest::UpdateManifest() {
33 } 31 }
34 32
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after
149 xmlNode *updatecheck = updates[0]; 147 xmlNode *updatecheck = updates[0];
150 148
151 if (GetAttribute(updatecheck, "status") == "noupdate") { 149 if (GetAttribute(updatecheck, "status") == "noupdate") {
152 return true; 150 return true;
153 } 151 }
154 152
155 // Find the url to the crx file. 153 // Find the url to the crx file.
156 result->crx_url = GURL(GetAttribute(updatecheck, "codebase")); 154 result->crx_url = GURL(GetAttribute(updatecheck, "codebase"));
157 if (!result->crx_url.is_valid()) { 155 if (!result->crx_url.is_valid()) {
158 *error_detail = "Invalid codebase url: '"; 156 *error_detail = "Invalid codebase url: '";
159 *error_detail += result->crx_url.possibly_invalid_spec(); 157 *error_detail += GetAttribute(updatecheck, "codebase");
160 *error_detail += "'."; 158 *error_detail += "'.";
161 return false; 159 return false;
162 } 160 }
163 161
164 // Get the version. 162 // Get the version.
165 result->version = GetAttribute(updatecheck, "version"); 163 result->version = GetAttribute(updatecheck, "version");
166 if (result->version.length() == 0) { 164 if (result->version.length() == 0) {
167 *error_detail = "Missing version for updatecheck."; 165 *error_detail = "Missing version for updatecheck.";
168 return false; 166 return false;
169 } 167 }
(...skipping 14 matching lines...) Expand all
184 *error_detail += result->browser_min_version; 182 *error_detail += result->browser_min_version;
185 *error_detail += "'."; 183 *error_detail += "'.";
186 return false; 184 return false;
187 } 185 }
188 } 186 }
189 187
190 // 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
191 // sha256 hash of the package in hex format. 189 // sha256 hash of the package in hex format.
192 result->package_hash = GetAttribute(updatecheck, "hash"); 190 result->package_hash = GetAttribute(updatecheck, "hash");
193 191
194 int size = 0;
195 if (base::StringToInt(GetAttribute(updatecheck, "size"), &size)) {
196 result->size = size;
197 }
198
199 // package_fingerprint is optional. It identifies the package, preferably
200 // with a modified sha256 hash of the package in hex format.
201 result->package_fingerprint = GetAttribute(updatecheck, "fp");
202
203 // Differential update information is optional.
204 result->diff_crx_url = GURL(GetAttribute(updatecheck, "codebasediff"));
205 result->diff_package_hash = GetAttribute(updatecheck, "hashdiff");
206 int sizediff = 0;
207 if (base::StringToInt(GetAttribute(updatecheck, "sizediff"), &sizediff)) {
208 result->diff_size = sizediff;
209 }
210
211 return true; 192 return true;
212 } 193 }
213 194
214 195
215 bool UpdateManifest::Parse(const std::string& manifest_xml) { 196 bool UpdateManifest::Parse(const std::string& manifest_xml) {
216 results_.list.resize(0); 197 results_.list.resize(0);
217 results_.daystart_elapsed_seconds = kNoDaystart; 198 results_.daystart_elapsed_seconds = kNoDaystart;
218 errors_ = ""; 199 errors_ = "";
219 200
220 if (manifest_xml.length() < 1) { 201 if (manifest_xml.length() < 1) {
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
276 std::string error; 257 std::string error;
277 if (!ParseSingleAppTag(apps[i], gupdate_ns, &current, &error)) { 258 if (!ParseSingleAppTag(apps[i], gupdate_ns, &current, &error)) {
278 ParseError("%s", error.c_str()); 259 ParseError("%s", error.c_str());
279 } else { 260 } else {
280 results_.list.push_back(current); 261 results_.list.push_back(current);
281 } 262 }
282 } 263 }
283 264
284 return true; 265 return true;
285 } 266 }
OLDNEW
« no previous file with comments | « trunk/src/chrome/common/extensions/update_manifest.h ('k') | trunk/src/chrome/common/omaha_query_params/omaha_query_params.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698