OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 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 | 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 #ifndef CHROME_COMMON_EXTENSIONS_UPDATE_MANIFEST_H_ | 5 #ifndef CHROME_COMMON_EXTENSIONS_UPDATE_MANIFEST_H_ |
6 #define CHROME_COMMON_EXTENSIONS_UPDATE_MANIFEST_H_ | 6 #define CHROME_COMMON_EXTENSIONS_UPDATE_MANIFEST_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
11 #include "googleurl/src/gurl.h" | 11 #include "googleurl/src/gurl.h" |
12 | 12 |
13 class UpdateManifest { | 13 class UpdateManifest { |
14 public: | 14 public: |
15 | 15 |
16 // An update manifest looks like this: | 16 // An update manifest looks like this: |
17 // | 17 // |
18 // <?xml version='1.0' encoding='UTF-8'?> | 18 // <?xml version="1.0" encoding="UTF-8"?> |
19 // <gupdate xmlns='http://www.google.com/update2/response' protocol='2.0'> | 19 // <gupdate xmlns="http://www.google.com/update2/response" protocol="2.0"> |
20 // <daystart elapsed_seconds='300' /> | 20 // <daystart elapsed_seconds="300" /> |
21 // <app appid='12345'> | 21 // <app appid="12345" status="ok"> |
22 // <updatecheck codebase='http://example.com/extension_1.2.3.4.crx' | 22 // <updatecheck codebase="http://example.com/extension_1.2.3.4.crx" |
23 // version='1.2.3.4' prodversionmin='2.0.143.0' | 23 // hash="12345" size="9854" status="ok" version="1.2.3.4" |
24 // hash="12345"/> | 24 // prodversionmin="2.0.143.0" |
| 25 // codebasediff="http://example.com/diff_1.2.3.4.crx" |
| 26 // hashdiff="123" sizediff="101" /> |
25 // </app> | 27 // </app> |
26 // </gupdate> | 28 // </gupdate> |
27 // | 29 // |
28 // The <daystart> tag contains a "elapsed_seconds" attribute which refers to | 30 // The <daystart> tag contains a "elapsed_seconds" attribute which refers to |
29 // the server's notion of how many seconds it has been since midnight. | 31 // the server's notion of how many seconds it has been since midnight. |
30 // | 32 // |
31 // The "appid" attribute of the <app> tag refers to the unique id of the | 33 // The "appid" attribute of the <app> tag refers to the unique id of the |
32 // extension. The "codebase" attribute of the <updatecheck> tag is the url to | 34 // extension. The "codebase" attribute of the <updatecheck> tag is the url to |
33 // fetch the updated crx file, and the "prodversionmin" attribute refers to | 35 // fetch the updated crx file, and the "prodversionmin" attribute refers to |
34 // the minimum version of the chrome browser that the update applies to. | 36 // the minimum version of the chrome browser that the update applies to. |
35 | 37 |
| 38 // The diff data members correspond to the differential update package, if |
| 39 // a differential update is specified in the response. |
| 40 |
36 // The result of parsing one <app> tag in an xml update check manifest. | 41 // The result of parsing one <app> tag in an xml update check manifest. |
37 struct Result { | 42 struct Result { |
38 Result(); | 43 Result(); |
39 ~Result(); | 44 ~Result(); |
40 | 45 |
41 std::string extension_id; | 46 std::string extension_id; |
42 std::string version; | 47 std::string version; |
43 std::string browser_min_version; | 48 std::string browser_min_version; |
| 49 |
| 50 // Attributes for the full update. |
| 51 GURL crx_url; |
44 std::string package_hash; | 52 std::string package_hash; |
45 GURL crx_url; | 53 int size; |
| 54 std::string package_fingerprint; |
| 55 |
| 56 // Attributes for the differential update. |
| 57 GURL diff_crx_url; |
| 58 std::string diff_package_hash; |
| 59 int diff_size; |
46 }; | 60 }; |
47 | 61 |
48 static const int kNoDaystart = -1; | 62 static const int kNoDaystart = -1; |
49 struct Results { | 63 struct Results { |
50 Results(); | 64 Results(); |
51 ~Results(); | 65 ~Results(); |
52 | 66 |
53 std::vector<Result> list; | 67 std::vector<Result> list; |
54 // This will be >= 0, or kNoDaystart if the <daystart> tag was not present. | 68 // This will be >= 0, or kNoDaystart if the <daystart> tag was not present. |
55 int daystart_elapsed_seconds; | 69 int daystart_elapsed_seconds; |
(...skipping 15 matching lines...) Expand all Loading... |
71 Results results_; | 85 Results results_; |
72 std::string errors_; | 86 std::string errors_; |
73 | 87 |
74 // Helper function that adds parse error details to our errors_ string. | 88 // Helper function that adds parse error details to our errors_ string. |
75 void ParseError(const char* details, ...); | 89 void ParseError(const char* details, ...); |
76 | 90 |
77 DISALLOW_COPY_AND_ASSIGN(UpdateManifest); | 91 DISALLOW_COPY_AND_ASSIGN(UpdateManifest); |
78 }; | 92 }; |
79 | 93 |
80 #endif // CHROME_COMMON_EXTENSIONS_UPDATE_MANIFEST_H_ | 94 #endif // CHROME_COMMON_EXTENSIONS_UPDATE_MANIFEST_H_ |
OLD | NEW |