blob: f82015d8479f9cbb8e51ab37df45d51901324928 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
|
// Copyright (c) 2018 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef COMPONENTS_UPDATE_CLIENT_PROTOCOL_DEFINITION_H_
#define COMPONENTS_UPDATE_CLIENT_PROTOCOL_DEFINITION_H_
#include <stdint.h>
#include <string>
#include <vector>
#include "base/containers/flat_map.h"
#include "base/macros.h"
#include "base/optional.h"
#include "base/values.h"
#include "build/build_config.h"
namespace update_client {
// The protocol versions so far are:
// * Version 3.1: it changes how the run actions are serialized.
// * Version 3.0: it is the version implemented by the desktop updaters.
constexpr char kProtocolVersion[] = "3.1";
// Due to implementation constraints of the JSON parser and serializer,
// precision of integer numbers greater than 2^53 is lost.
constexpr int64_t kProtocolMaxInt = 1LL << 53;
namespace protocol_request {
struct HW {
uint32_t physmemory = 0; // Physical memory rounded down to the closest GB.
};
struct OS {
OS();
OS(OS&&);
~OS();
std::string platform;
std::string version;
std::string service_pack;
std::string arch;
private:
DISALLOW_COPY_AND_ASSIGN(OS);
};
struct Updater {
Updater();
Updater(const Updater&);
~Updater();
std::string name;
std::string version;
bool is_machine = false;
bool autoupdate_check_enabled = false;
base::Optional<int> last_started;
base::Optional<int> last_checked;
int update_policy = 0;
};
struct UpdateCheck {
UpdateCheck();
~UpdateCheck();
bool is_update_disabled = false;
};
// didrun element. The element is named "ping" for legacy reasons.
struct Ping {
Ping();
Ping(const Ping&);
~Ping();
// Preferred user count metrics ("ad" and "rd").
base::Optional<int> date_last_active;
base::Optional<int> date_last_roll_call;
// Legacy user count metrics ("a" and "r").
base::Optional<int> days_since_last_active_ping;
int days_since_last_roll_call = 0;
std::string ping_freshness;
};
struct App {
App();
App(App&&);
~App();
std::string app_id;
std::string version;
base::flat_map<std::string, std::string> installer_attributes;
std::string lang;
std::string brand_code;
std::string install_source;
std::string install_location;
std::string fingerprint;
std::string cohort; // Opaque string.
std::string cohort_hint; // Server may use to move the app to a new cohort.
std::string cohort_name; // Human-readable interpretation of the cohort.
std::string release_channel;
base::Optional<bool> enabled;
base::Optional<std::vector<int>> disabled_reasons;
// Optional update check.
base::Optional<UpdateCheck> update_check;
// Optional 'did run' ping.
base::Optional<Ping> ping;
// Progress/result pings.
base::Optional<std::vector<base::Value>> events;
private:
DISALLOW_COPY_AND_ASSIGN(App);
};
struct Request {
Request();
Request(Request&&);
~Request();
std::string protocol_version;
// Unique identifier for this session, used to correlate multiple requests
// associated with a single update operation.
std::string session_id;
// Unique identifier for this request, used to associate the same request
// received multiple times on the server.
std::string request_id;
std::string updatername;
std::string updaterversion;
std::string prodversion;
std::string lang;
std::string updaterchannel;
std::string prodchannel;
std::string operating_system;
std::string arch;
std::string nacl_arch;
#if defined(OS_WIN)
bool is_wow64 = false;
#endif
// Provides a hint for what download urls should be returned by server.
// This data member is controlled by group policy settings.
// The only group policy value supported so far is |cacheable|.
std::string dlpref;
// True if this machine is part of a managed enterprise domain.
base::Optional<bool> domain_joined;
base::flat_map<std::string, std::string> additional_attributes;
HW hw;
OS os;
base::Optional<Updater> updater;
std::vector<App> apps;
private:
DISALLOW_COPY_AND_ASSIGN(Request);
};
} // namespace protocol_request
} // namespace update_client
#endif // COMPONENTS_UPDATE_CLIENT_PROTOCOL_DEFINITION_H_
|