OLD | NEW |
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 #include "components/update_client/utils.h" | 5 #include "components/update_client/utils.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include <algorithm> | 10 #include <algorithm> |
(...skipping 17 matching lines...) Expand all Loading... |
28 #include "components/data_use_measurement/core/data_use_user_data.h" | 28 #include "components/data_use_measurement/core/data_use_user_data.h" |
29 #include "components/update_client/configurator.h" | 29 #include "components/update_client/configurator.h" |
30 #include "components/update_client/crx_update_item.h" | 30 #include "components/update_client/crx_update_item.h" |
31 #include "components/update_client/update_client.h" | 31 #include "components/update_client/update_client.h" |
32 #include "components/update_client/update_client_errors.h" | 32 #include "components/update_client/update_client_errors.h" |
33 #include "components/update_client/update_query_params.h" | 33 #include "components/update_client/update_query_params.h" |
34 #include "components/update_client/updater_state.h" | 34 #include "components/update_client/updater_state.h" |
35 #include "crypto/secure_hash.h" | 35 #include "crypto/secure_hash.h" |
36 #include "crypto/sha2.h" | 36 #include "crypto/sha2.h" |
37 #include "net/base/load_flags.h" | 37 #include "net/base/load_flags.h" |
| 38 #include "net/traffic_annotation/network_traffic_annotation.h" |
38 #include "net/url_request/url_fetcher.h" | 39 #include "net/url_request/url_fetcher.h" |
39 #include "net/url_request/url_request_context_getter.h" | 40 #include "net/url_request/url_request_context_getter.h" |
40 #include "net/url_request/url_request_status.h" | 41 #include "net/url_request/url_request_status.h" |
41 #include "url/gurl.h" | 42 #include "url/gurl.h" |
42 | 43 |
43 #if defined(OS_WIN) | 44 #if defined(OS_WIN) |
44 #include "base/win/windows_version.h" | 45 #include "base/win/windows_version.h" |
45 #endif | 46 #endif |
46 | 47 |
47 namespace update_client { | 48 namespace update_client { |
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
181 base::StringAppendF(&request, "%s</request>", request_body.c_str()); | 182 base::StringAppendF(&request, "%s</request>", request_body.c_str()); |
182 | 183 |
183 return request; | 184 return request; |
184 } | 185 } |
185 | 186 |
186 std::unique_ptr<net::URLFetcher> SendProtocolRequest( | 187 std::unique_ptr<net::URLFetcher> SendProtocolRequest( |
187 const GURL& url, | 188 const GURL& url, |
188 const std::string& protocol_request, | 189 const std::string& protocol_request, |
189 net::URLFetcherDelegate* url_fetcher_delegate, | 190 net::URLFetcherDelegate* url_fetcher_delegate, |
190 net::URLRequestContextGetter* url_request_context_getter) { | 191 net::URLRequestContextGetter* url_request_context_getter) { |
| 192 net::NetworkTrafficAnnotationTag traffic_annotation = |
| 193 net::DefineNetworkTrafficAnnotation("component_updater_utils", R"( |
| 194 semantics { |
| 195 sender: "Component Updater" |
| 196 description: |
| 197 "The component updater in Chrome is responsible for updating code " |
| 198 "and data modules such as Flash, CrlSet, Origin Trials, etc. These " |
| 199 "modules are updated on cycles independent of the Chrome release " |
| 200 "tracks. It runs in the browser process and communicates with a " |
| 201 "set of servers using the Omaha protocol to find the latest " |
| 202 "versions of components, download them, and register them with the " |
| 203 "rest of Chrome." |
| 204 trigger: "Manual or automatic software updates." |
| 205 data: |
| 206 "Various OS and Chrome parameters such as version, bitness, " |
| 207 "release tracks, etc." |
| 208 destination: GOOGLE_OWNED_SERVICE |
| 209 } |
| 210 policy { |
| 211 cookies_allowed: false |
| 212 setting: "This feature cannot be disabled." |
| 213 policy_exception_justification: "Not implemented." |
| 214 })"); |
191 std::unique_ptr<net::URLFetcher> url_fetcher = net::URLFetcher::Create( | 215 std::unique_ptr<net::URLFetcher> url_fetcher = net::URLFetcher::Create( |
192 0, url, net::URLFetcher::POST, url_fetcher_delegate); | 216 0, url, net::URLFetcher::POST, url_fetcher_delegate, traffic_annotation); |
193 if (!url_fetcher.get()) | 217 if (!url_fetcher.get()) |
194 return url_fetcher; | 218 return url_fetcher; |
195 | 219 |
196 data_use_measurement::DataUseUserData::AttachToFetcher( | 220 data_use_measurement::DataUseUserData::AttachToFetcher( |
197 url_fetcher.get(), data_use_measurement::DataUseUserData::UPDATE_CLIENT); | 221 url_fetcher.get(), data_use_measurement::DataUseUserData::UPDATE_CLIENT); |
198 url_fetcher->SetUploadData("application/xml", protocol_request); | 222 url_fetcher->SetUploadData("application/xml", protocol_request); |
199 url_fetcher->SetRequestContext(url_request_context_getter); | 223 url_fetcher->SetRequestContext(url_request_context_getter); |
200 url_fetcher->SetLoadFlags(net::LOAD_DO_NOT_SEND_COOKIES | | 224 url_fetcher->SetLoadFlags(net::LOAD_DO_NOT_SEND_COOKIES | |
201 net::LOAD_DO_NOT_SAVE_COOKIES | | 225 net::LOAD_DO_NOT_SAVE_COOKIES | |
202 net::LOAD_DISABLE_CACHE); | 226 net::LOAD_DISABLE_CACHE); |
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
340 [](const GURL& url) { return !url.SchemeIsCryptographic(); }), | 364 [](const GURL& url) { return !url.SchemeIsCryptographic(); }), |
341 urls->end()); | 365 urls->end()); |
342 } | 366 } |
343 | 367 |
344 CrxInstaller::Result InstallFunctionWrapper(base::Callback<bool()> callback) { | 368 CrxInstaller::Result InstallFunctionWrapper(base::Callback<bool()> callback) { |
345 return CrxInstaller::Result(callback.Run() ? InstallError::NONE | 369 return CrxInstaller::Result(callback.Run() ? InstallError::NONE |
346 : InstallError::GENERIC_ERROR); | 370 : InstallError::GENERIC_ERROR); |
347 } | 371 } |
348 | 372 |
349 } // namespace update_client | 373 } // namespace update_client |
OLD | NEW |