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
3 // found in the LICENSE file.
5 #ifndef EXTENSIONS_COMMON_UPDATE_MANIFEST_H_
6 #define EXTENSIONS_COMMON_UPDATE_MANIFEST_H_
13 class UpdateManifest
{
15 // An update manifest looks like this:
17 // <?xml version="1.0" encoding="UTF-8"?>
18 // <gupdate xmlns="http://www.google.com/update2/response" protocol="2.0">
19 // <daystart elapsed_seconds="300" />
20 // <app appid="12345" status="ok">
21 // <updatecheck codebase="http://example.com/extension_1.2.3.4.crx"
22 // hash="12345" size="9854" status="ok" version="1.2.3.4"
23 // prodversionmin="2.0.143.0"
24 // codebasediff="http://example.com/diff_1.2.3.4.crx"
25 // hashdiff="123" sizediff="101"
30 // The <daystart> tag contains a "elapsed_seconds" attribute which refers to
31 // the server's notion of how many seconds it has been since midnight.
33 // The "appid" attribute of the <app> tag refers to the unique id of the
34 // extension. The "codebase" attribute of the <updatecheck> tag is the url to
35 // fetch the updated crx file, and the "prodversionmin" attribute refers to
36 // the minimum version of the chrome browser that the update applies to.
38 // The diff data members correspond to the differential update package, if
39 // a differential update is specified in the response.
41 // The result of parsing one <app> tag in an xml update check manifest.
46 std::string extension_id
;
48 std::string browser_min_version
;
50 // Attributes for the full update.
52 std::string package_hash
;
54 std::string package_fingerprint
;
56 // Attributes for the differential update.
58 std::string diff_package_hash
;
62 static const int kNoDaystart
= -1;
67 std::vector
<Result
> list
;
68 // This will be >= 0, or kNoDaystart if the <daystart> tag was not present.
69 int daystart_elapsed_seconds
;
75 // Parses an update manifest xml string into Result data. Returns a bool
76 // indicating success or failure. On success, the results are available by
77 // calling results(). The details for any failures are available by calling
79 bool Parse(const std::string
& manifest_xml
);
81 const Results
& results() { return results_
; }
82 const std::string
& errors() { return errors_
; }
88 // Helper function that adds parse error details to our errors_ string.
89 void ParseError(const char* details
, ...);
91 DISALLOW_COPY_AND_ASSIGN(UpdateManifest
);
94 #endif // EXTENSIONS_COMMON_UPDATE_MANIFEST_H_