1 // Copyright (c) 2010 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 CHROME_COMMON_EXTENSIONS_UPDATE_MANIFEST_H_
6 #define CHROME_COMMON_EXTENSIONS_UPDATE_MANIFEST_H_
13 class UpdateManifest
{
16 // An update manifest looks like this:
18 // <?xml version="1.0" encoding="UTF-8"?>
19 // <gupdate xmlns="http://www.google.com/update2/response" protocol="2.0">
20 // <daystart elapsed_seconds="300" />
21 // <app appid="12345" status="ok">
22 // <updatecheck codebase="http://example.com/extension_1.2.3.4.crx"
23 // hash="12345" size="9854" status="ok" version="1.2.3.4"
24 // prodversionmin="2.0.143.0"
25 // codebasediff="http://example.com/diff_1.2.3.4.crx"
26 // hashdiff="123" sizediff="101"
31 // The <daystart> tag contains a "elapsed_seconds" attribute which refers to
32 // the server's notion of how many seconds it has been since midnight.
34 // The "appid" attribute of the <app> tag refers to the unique id of the
35 // extension. The "codebase" attribute of the <updatecheck> tag is the url to
36 // fetch the updated crx file, and the "prodversionmin" attribute refers to
37 // the minimum version of the chrome browser that the update applies to.
39 // The diff data members correspond to the differential update package, if
40 // a differential update is specified in the response.
42 // The result of parsing one <app> tag in an xml update check manifest.
47 std::string extension_id
;
49 std::string browser_min_version
;
51 // Attributes for the full update.
53 std::string package_hash
;
55 std::string package_fingerprint
;
57 // Attributes for the differential update.
59 std::string diff_package_hash
;
63 static const int kNoDaystart
= -1;
68 std::vector
<Result
> list
;
69 // This will be >= 0, or kNoDaystart if the <daystart> tag was not present.
70 int daystart_elapsed_seconds
;
76 // Parses an update manifest xml string into Result data. Returns a bool
77 // indicating success or failure. On success, the results are available by
78 // calling results(). The details for any failures are available by calling
80 bool Parse(const std::string
& manifest_xml
);
82 const Results
& results() { return results_
; }
83 const std::string
& errors() { return errors_
; }
89 // Helper function that adds parse error details to our errors_ string.
90 void ParseError(const char* details
, ...);
92 DISALLOW_COPY_AND_ASSIGN(UpdateManifest
);
95 #endif // CHROME_COMMON_EXTENSIONS_UPDATE_MANIFEST_H_