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

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

Issue 2340113002: Inject the prodid for the extensions and component updaters. (Closed)
Patch Set: Remove "chromium" as a possible value in comment. Created 4 years, 3 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
« no previous file with comments | « components/update_client/update_checker_unittest.cc ('k') | components/update_client/utils.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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_UTILS_H_ 5 #ifndef COMPONENTS_UPDATE_CLIENT_UTILS_H_
6 #define COMPONENTS_UPDATE_CLIENT_UTILS_H_ 6 #define COMPONENTS_UPDATE_CLIENT_UTILS_H_
7 7
8 #include <memory> 8 #include <memory>
9 #include <string> 9 #include <string>
10 #include <utility> 10 #include <utility>
(...skipping 22 matching lines...) Expand all
33 // Installer attributes are component-specific metadata, which may be serialized 33 // Installer attributes are component-specific metadata, which may be serialized
34 // in an update check request. 34 // in an update check request.
35 using InstallerAttribute = std::pair<std::string, std::string>; 35 using InstallerAttribute = std::pair<std::string, std::string>;
36 36
37 // An update protocol request starts with a common preamble which includes 37 // An update protocol request starts with a common preamble which includes
38 // version and platform information for Chrome and the operating system, 38 // version and platform information for Chrome and the operating system,
39 // followed by a request body, which is the actual payload of the request. 39 // followed by a request body, which is the actual payload of the request.
40 // For example: 40 // For example:
41 // 41 //
42 // <?xml version="1.0" encoding="UTF-8"?> 42 // <?xml version="1.0" encoding="UTF-8"?>
43 // <request protocol="3.0" version="chrome-32.0.1.0" prodversion="32.0.1.0" 43 // <request protocol="3.0" version="chrome-32.0.1.0" prodversion="32.0.1.0"
44 // requestid="{7383396D-B4DD-46E1-9104-AAC6B918E792}" 44 // requestid="{7383396D-B4DD-46E1-9104-AAC6B918E792}"
45 // updaterchannel="canary" arch="x86" nacl_arch="x86-64" 45 // updaterchannel="canary" arch="x86" nacl_arch="x86-64"
46 // ADDITIONAL ATTRIBUTES> 46 // ADDITIONAL ATTRIBUTES>
47 // <hw physmemory="16"/> 47 // <hw physmemory="16"/>
48 // <os platform="win" version="6.1" arch="x86"/> 48 // <os platform="win" version="6.1" arch="x86"/>
49 // ... REQUEST BODY ... 49 // ... REQUEST BODY ...
50 // </request> 50 // </request>
51 51
52 // Builds a protocol request string by creating the outer envelope for 52 // Builds a protocol request string by creating the outer envelope for
53 // the request and including the request body specified as a parameter. 53 // the request and including the request body specified as a parameter.
54 // If present, the |download_preference| specifies a group policy that 54 // If present, the |download_preference| specifies a group policy that
55 // affects the list of download URLs returned in the update response. 55 // affects the list of download URLs returned in the update response.
56 // If specified, |additional_attributes| are appended as attributes of the 56 // If specified, |additional_attributes| are appended as attributes of the
57 // request element. The additional attributes have to be well-formed for 57 // request element. The additional attributes have to be well-formed for
58 // insertion in the request element. 58 // insertion in the request element.
59 std::string BuildProtocolRequest(const std::string& browser_version, 59 std::string BuildProtocolRequest(const std::string& prod_id,
60 const std::string& browser_version,
60 const std::string& channel, 61 const std::string& channel,
61 const std::string& lang, 62 const std::string& lang,
62 const std::string& os_long_name, 63 const std::string& os_long_name,
63 const std::string& download_preference, 64 const std::string& download_preference,
64 const std::string& request_body, 65 const std::string& request_body,
65 const std::string& additional_attributes); 66 const std::string& additional_attributes);
66 67
67 // Sends a protocol request to the the service endpoint specified by |url|. 68 // Sends a protocol request to the the service endpoint specified by |url|.
68 // The body of the request is provided by |protocol_request| and it is 69 // The body of the request is provided by |protocol_request| and it is
69 // expected to contain XML data. The caller owns the returned object. 70 // expected to contain XML data. The caller owns the returned object.
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
109 // ^[-_a-zA-Z0-9]{1,256}$ and the value part of the |attr| parameter 110 // ^[-_a-zA-Z0-9]{1,256}$ and the value part of the |attr| parameter
110 // matches ^[-.,;+_=a-zA-Z0-9]{0,256}$ . 111 // matches ^[-.,;+_=a-zA-Z0-9]{0,256}$ .
111 bool IsValidInstallerAttribute(const InstallerAttribute& attr); 112 bool IsValidInstallerAttribute(const InstallerAttribute& attr);
112 113
113 // Removes the unsecure urls in the |urls| parameter. 114 // Removes the unsecure urls in the |urls| parameter.
114 void RemoveUnsecureUrls(std::vector<GURL>* urls); 115 void RemoveUnsecureUrls(std::vector<GURL>* urls);
115 116
116 } // namespace update_client 117 } // namespace update_client
117 118
118 #endif // COMPONENTS_UPDATE_CLIENT_UTILS_H_ 119 #endif // COMPONENTS_UPDATE_CLIENT_UTILS_H_
OLDNEW
« no previous file with comments | « components/update_client/update_checker_unittest.cc ('k') | components/update_client/utils.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698