Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright 2017 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. | |
| 4 | |
| 5 #ifndef COMPONENTS_UPDATE_CLIENT_PROTOCOL_BUILDER_H_ | |
| 6 #define COMPONENTS_UPDATE_CLIENT_PROTOCOL_BUILDER_H_ | |
| 7 | |
| 8 #include <memory> | |
| 9 #include <string> | |
| 10 #include <vector> | |
| 11 | |
| 12 #include "components/update_client/component.h" | |
| 13 #include "components/update_client/updater_state.h" | |
| 14 | |
| 15 namespace update_client { | |
| 16 | |
| 17 class Configurator; | |
| 18 class PersistedData; | |
| 19 | |
| 20 // Builds an update check request for |components|. |additional_attributes| is | |
| 21 // serialized as part of the <request> element of the request to customize it | |
| 22 // with data that is not platform or component specific. For each |item|, a | |
| 23 // corresponding <app> element is created and inserted as a child node of | |
| 24 // the <request>. | |
| 25 // | |
| 26 // An app element looks like this: | |
| 27 // <app appid="hnimpnehoodheedghdeeijklkeaacbdc" | |
| 28 // version="0.1.2.3" installsource="ondemand"> | |
| 29 // <updatecheck/> | |
| 30 // <packages> | |
| 31 // <package fp="abcd"/> | |
| 32 // </packages> | |
| 33 // </app> | |
| 34 std::string BuildUpdateCheckRequest( | |
| 35 const Configurator& config, | |
| 36 const std::vector<std::string>& ids_checked, | |
| 37 const IdToComponentPtrMap& components, | |
| 38 PersistedData* metadata, | |
| 39 const std::string& additional_attributes, | |
| 40 bool enabled_component_updates, | |
| 41 const std::unique_ptr<UpdaterState::Attributes>& updater_state_attributes); | |
| 42 | |
| 43 // Builds a ping request for the specified component. | |
|
waffles
2017/05/17 23:58:05
Worth documenting what "an event ping request elem
Sorin Jianu
2017/05/18 00:25:08
Done.
| |
| 44 std::string BuildPing(const Configurator& config, const Component& component); | |
|
waffles
2017/05/17 23:58:05
BuildPingRequest to match BuildUpdateCheckRequest?
Sorin Jianu
2017/05/18 00:25:08
Done.
| |
| 45 | |
| 46 // An update protocol request starts with a common preamble which includes | |
| 47 // version and platform information for Chrome and the operating system, | |
| 48 // followed by a request body, which is the actual payload of the request. | |
| 49 // For example: | |
| 50 // | |
| 51 // <?xml version="1.0" encoding="UTF-8"?> | |
| 52 // <request protocol="3.0" version="chrome-32.0.1.0" prodversion="32.0.1.0" | |
| 53 // requestid="{7383396D-B4DD-46E1-9104-AAC6B918E792}" | |
| 54 // updaterchannel="canary" arch="x86" nacl_arch="x86-64" | |
| 55 // ADDITIONAL ATTRIBUTES> | |
| 56 // <hw physmemory="16"/> | |
| 57 // <os platform="win" version="6.1" arch="x86"/> | |
| 58 // ... REQUEST BODY ... | |
| 59 // </request> | |
| 60 | |
| 61 // Builds a protocol request string by creating the outer envelope for | |
| 62 // the request and including the request body specified as a parameter. | |
| 63 // If present, the |download_preference| specifies a group policy that | |
| 64 // affects the list of download URLs returned in the update response. | |
| 65 // If specified, |additional_attributes| are appended as attributes of the | |
| 66 // request element. The additional attributes have to be well-formed for | |
| 67 // insertion in the request element. |updater_state_attributes| is an optional | |
| 68 // parameter specifying that an <updater> element is serialized as part of | |
| 69 // the request. | |
| 70 std::string BuildProtocolRequest( | |
| 71 const std::string& prod_id, | |
| 72 const std::string& browser_version, | |
| 73 const std::string& channel, | |
| 74 const std::string& lang, | |
| 75 const std::string& os_long_name, | |
| 76 const std::string& download_preference, | |
| 77 const std::string& request_body, | |
| 78 const std::string& additional_attributes, | |
| 79 const std::unique_ptr<UpdaterState::Attributes>& updater_state_attributes); | |
| 80 | |
| 81 } // namespace update_client | |
| 82 | |
| 83 #endif // COMPONENTS_UPDATE_CLIENT_PROTOCOL_PARSER_H_ | |
| OLD | NEW |