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

Side by Side Diff: components/update_client/update_response.h

Issue 2847023002: Parse update check run actions for the component updater. (Closed)
Patch Set: Merge branch 'master' of https://chromium.googlesource.com/chromium/src into run-action Created 3 years, 7 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
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 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 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 COMPONENTS_UPDATE_CLIENT_UPDATE_RESPONSE_H_ 5 #ifndef COMPONENTS_UPDATE_CLIENT_UPDATE_RESPONSE_H_
6 #define COMPONENTS_UPDATE_CLIENT_UPDATE_RESPONSE_H_ 6 #define COMPONENTS_UPDATE_CLIENT_UPDATE_RESPONSE_H_
7 7
8 #include <map> 8 #include <map>
9 #include <memory> 9 #include <memory>
10 #include <string> 10 #include <string>
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
65 struct Package { 65 struct Package {
66 Package(); 66 Package();
67 Package(const Package& other); 67 Package(const Package& other);
68 ~Package(); 68 ~Package();
69 69
70 std::string fingerprint; 70 std::string fingerprint;
71 71
72 // Attributes for the full update. 72 // Attributes for the full update.
73 std::string name; 73 std::string name;
74 std::string hash_sha256; 74 std::string hash_sha256;
75 int size; 75 int size = 0;
76 76
77 // Attributes for the differential update. 77 // Attributes for the differential update.
78 std::string namediff; 78 std::string namediff;
79 std::string hashdiff_sha256; 79 std::string hashdiff_sha256;
80 int sizediff; 80 int sizediff = 0;
81 }; 81 };
82 82
83 Manifest(); 83 Manifest();
84 Manifest(const Manifest& other); 84 Manifest(const Manifest& other);
85 ~Manifest(); 85 ~Manifest();
86 86
87 std::string version; 87 std::string version;
88 std::string browser_min_version; 88 std::string browser_min_version;
89 std::vector<Package> packages; 89 std::vector<Package> packages;
90 }; 90 };
(...skipping 15 matching lines...) Expand all
106 Manifest manifest; 106 Manifest manifest;
107 107
108 // The server has instructed the client to set its [key] to [value] for each 108 // The server has instructed the client to set its [key] to [value] for each
109 // key-value pair in this string. 109 // key-value pair in this string.
110 std::map<std::string, std::string> cohort_attrs; 110 std::map<std::string, std::string> cohort_attrs;
111 111
112 // The following are the only allowed keys in |cohort_attrs|. 112 // The following are the only allowed keys in |cohort_attrs|.
113 static const char kCohort[]; 113 static const char kCohort[];
114 static const char kCohortHint[]; 114 static const char kCohortHint[];
115 static const char kCohortName[]; 115 static const char kCohortName[];
116
117 // Contains the run action returned by the server as part of an update
118 // check response.
119 std::string action_run;
116 }; 120 };
117 121
118 static const int kNoDaystart = -1; 122 static const int kNoDaystart = -1;
119 struct Results { 123 struct Results {
120 Results(); 124 Results();
121 Results(const Results& other); 125 Results(const Results& other);
122 ~Results(); 126 ~Results();
123 127
124 // This will be >= 0, or kNoDaystart if the <daystart> tag was not present. 128 // This will be >= 0, or kNoDaystart if the <daystart> tag was not present.
125 int daystart_elapsed_seconds; 129 int daystart_elapsed_seconds = kNoDaystart;
130
126 // This will be >= 0, or kNoDaystart if the <daystart> tag was not present. 131 // This will be >= 0, or kNoDaystart if the <daystart> tag was not present.
127 int daystart_elapsed_days; 132 int daystart_elapsed_days = kNoDaystart;
128 std::vector<Result> list; 133 std::vector<Result> list;
129 }; 134 };
130 135
131 UpdateResponse(); 136 UpdateResponse();
132 ~UpdateResponse(); 137 ~UpdateResponse();
133 138
134 // Parses an update response xml string into Result data. Returns a bool 139 // Parses an update response xml string into Result data. Returns a bool
135 // indicating success or failure. On success, the results are available by 140 // indicating success or failure. On success, the results are available by
136 // calling results(). In case of success, only results corresponding to 141 // calling results(). In case of success, only results corresponding to
137 // the update check status |ok| or |noupdate| are included. 142 // the update check status |ok| or |noupdate| are included.
138 // The details for any failures are available by calling errors(). 143 // The details for any failures are available by calling errors().
139 bool Parse(const std::string& manifest_xml); 144 bool Parse(const std::string& manifest_xml);
140 145
141 const Results& results() const { return results_; } 146 const Results& results() const { return results_; }
142 const std::string& errors() const { return errors_; } 147 const std::string& errors() const { return errors_; }
143 148
144 private: 149 private:
145 Results results_; 150 Results results_;
146 std::string errors_; 151 std::string errors_;
147 152
148 // Adds parse error details to |errors_| string. 153 // Adds parse error details to |errors_| string.
149 void ParseError(const char* details, ...); 154 void ParseError(const char* details, ...);
150 155
151 DISALLOW_COPY_AND_ASSIGN(UpdateResponse); 156 DISALLOW_COPY_AND_ASSIGN(UpdateResponse);
152 }; 157 };
153 158
154 } // namespace update_client 159 } // namespace update_client
155 160
156 #endif // COMPONENTS_UPDATE_CLIENT_UPDATE_RESPONSE_H_ 161 #endif // COMPONENTS_UPDATE_CLIENT_UPDATE_RESPONSE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698