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

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

Issue 2888183003: Consolidate the update_client serialization code. (Closed)
Patch Set: wip 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 2017 The Chromium Authors. All rights reserved. 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 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_PROTOCOL_BUILDER_H_ 5 #ifndef COMPONENTS_UPDATE_CLIENT_PROTOCOL_BUILDER_H_
6 #define COMPONENTS_UPDATE_CLIENT_PROTOCOL_BUILDER_H_ 6 #define COMPONENTS_UPDATE_CLIENT_PROTOCOL_BUILDER_H_
7 7
8 #include <memory> 8 #include <memory>
9 #include <string> 9 #include <string>
10 #include <vector> 10 #include <vector>
11 11
12 #include "components/update_client/component.h" 12 #include "components/update_client/component.h"
13 #include "components/update_client/crx_downloader.h"
13 #include "components/update_client/updater_state.h" 14 #include "components/update_client/updater_state.h"
14 15
15 namespace update_client { 16 namespace update_client {
16 17
17 class Configurator; 18 class Configurator;
18 class PersistedData; 19 class PersistedData;
19 20
20 // Builds an update check request for |components|. |additional_attributes| is 21 // 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 // 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 // with data that is not platform or component specific. For each |item|, a
(...skipping 27 matching lines...) Expand all
50 // version="1.0" nextversion="2.0"> 51 // version="1.0" nextversion="2.0">
51 // <event eventtype="3" eventresult="1"/> 52 // <event eventtype="3" eventresult="1"/>
52 // <event eventtype="14\" eventresult="0" downloader="direct" 53 // <event eventtype="14\" eventresult="0" downloader="direct"
53 // "errorcode="-1" url="http://host1/path1" downloaded="123" 54 // "errorcode="-1" url="http://host1/path1" downloaded="123"
54 // "total="456"/> 55 // "total="456"/>
55 // </app> 56 // </app>
56 // </request> 57 // </request>
57 std::string BuildEventPingRequest(const Configurator& config, 58 std::string BuildEventPingRequest(const Configurator& config,
58 const Component& component); 59 const Component& component);
59 60
61 // Returns a string representing one ping event for the update of a component.
62 // The event type for this ping event is 3.
63 std::string BuildUpdateCompleteEventElement(const Component& component);
64
65 // Returns a string representing one ping event for the uninstall of a
66 // component. The event type for this ping event is 4.
67 std::string BuildUninstalledEventElement(const Component& component);
68
69 // Returns a string representing a download complete event corresponding to
70 // one download metrics instance. The event type for this ping event is 14.
71 std::string BuildDownloadCompleteEventElement(
72 const CrxDownloader::DownloadMetrics& metrics);
73
60 // An update protocol request starts with a common preamble which includes 74 // An update protocol request starts with a common preamble which includes
61 // version and platform information for Chrome and the operating system, 75 // version and platform information for Chrome and the operating system,
62 // followed by a request body, which is the actual payload of the request. 76 // followed by a request body, which is the actual payload of the request.
63 // For example: 77 // For example:
64 // 78 //
65 // <?xml version="1.0" encoding="UTF-8"?> 79 // <?xml version="1.0" encoding="UTF-8"?>
66 // <request protocol="3.0" version="chrome-32.0.1.0" prodversion="32.0.1.0" 80 // <request protocol="3.0" version="chrome-32.0.1.0" prodversion="32.0.1.0"
67 // requestid="{7383396D-B4DD-46E1-9104-AAC6B918E792}" 81 // requestid="{7383396D-B4DD-46E1-9104-AAC6B918E792}"
68 // updaterchannel="canary" arch="x86" nacl_arch="x86-64" 82 // updaterchannel="canary" arch="x86" nacl_arch="x86-64"
69 // ADDITIONAL ATTRIBUTES> 83 // ADDITIONAL ATTRIBUTES>
(...skipping 18 matching lines...) Expand all
88 const std::string& lang, 102 const std::string& lang,
89 const std::string& os_long_name, 103 const std::string& os_long_name,
90 const std::string& download_preference, 104 const std::string& download_preference,
91 const std::string& request_body, 105 const std::string& request_body,
92 const std::string& additional_attributes, 106 const std::string& additional_attributes,
93 const std::unique_ptr<UpdaterState::Attributes>& updater_state_attributes); 107 const std::unique_ptr<UpdaterState::Attributes>& updater_state_attributes);
94 108
95 } // namespace update_client 109 } // namespace update_client
96 110
97 #endif // COMPONENTS_UPDATE_CLIENT_PROTOCOL_PARSER_H_ 111 #endif // COMPONENTS_UPDATE_CLIENT_PROTOCOL_PARSER_H_
OLDNEW
« no previous file with comments | « components/update_client/ping_manager_unittest.cc ('k') | components/update_client/protocol_builder.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698