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

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

Issue 2798873002: Network traffic annotation added to update_client. (Closed)
Patch Set: Created 3 years, 8 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 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
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
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("...", R"(
194 semantics {
195 sender: "..."
Sorin Jianu 2017/04/19 21:40:39 Component Updater
Ramin Halavati 2017/04/20 07:36:13 Done.
196 description: "..."
Sorin Jianu 2017/04/19 21:40:39 The component updater in Chrome is responsible for
Ramin Halavati 2017/04/20 07:36:13 Done.
197 trigger: "..."
Sorin Jianu 2017/04/19 21:40:39 Manual or automatic software updates.
Ramin Halavati 2017/04/20 07:36:13 Done.
198 data: "..."
Sorin Jianu 2017/04/19 21:40:40 Various OS and Chrome parameters such as version,
Ramin Halavati 2017/04/20 07:36:13 Done.
199 destination: WEBSITE/GOOGLE_OWNED_SERVICE/OTHER
Sorin Jianu 2017/04/19 21:40:39 GOOGLE_OWNED_SERVICE
Ramin Halavati 2017/04/20 07:36:14 Done.
200 }
201 policy {
202 cookies_allowed: false
203 setting: "..."
Sorin Jianu 2017/04/19 21:40:39 This feature can't be disabled.
Ramin Halavati 2017/04/20 07:36:13 Done.
204 chrome_policy {
205 [POLICY_NAME] {
Sorin Jianu 2017/04/19 21:40:39 There is no policy associated with this feature.
Ramin Halavati 2017/04/20 07:36:14 Done.
206 policy_options {mode: MANDATORY/RECOMMENDED/UNSET}
207 [POLICY_NAME]: ... //(value to disable it)
208 }
209 }
210 policy_exception_justification: "..."
211 })");
191 std::unique_ptr<net::URLFetcher> url_fetcher = net::URLFetcher::Create( 212 std::unique_ptr<net::URLFetcher> url_fetcher = net::URLFetcher::Create(
192 0, url, net::URLFetcher::POST, url_fetcher_delegate); 213 0, url, net::URLFetcher::POST, url_fetcher_delegate, traffic_annotation);
193 if (!url_fetcher.get()) 214 if (!url_fetcher.get())
194 return url_fetcher; 215 return url_fetcher;
195 216
196 data_use_measurement::DataUseUserData::AttachToFetcher( 217 data_use_measurement::DataUseUserData::AttachToFetcher(
197 url_fetcher.get(), data_use_measurement::DataUseUserData::UPDATE_CLIENT); 218 url_fetcher.get(), data_use_measurement::DataUseUserData::UPDATE_CLIENT);
198 url_fetcher->SetUploadData("application/xml", protocol_request); 219 url_fetcher->SetUploadData("application/xml", protocol_request);
199 url_fetcher->SetRequestContext(url_request_context_getter); 220 url_fetcher->SetRequestContext(url_request_context_getter);
200 url_fetcher->SetLoadFlags(net::LOAD_DO_NOT_SEND_COOKIES | 221 url_fetcher->SetLoadFlags(net::LOAD_DO_NOT_SEND_COOKIES |
201 net::LOAD_DO_NOT_SAVE_COOKIES | 222 net::LOAD_DO_NOT_SAVE_COOKIES |
202 net::LOAD_DISABLE_CACHE); 223 net::LOAD_DISABLE_CACHE);
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after
340 [](const GURL& url) { return !url.SchemeIsCryptographic(); }), 361 [](const GURL& url) { return !url.SchemeIsCryptographic(); }),
341 urls->end()); 362 urls->end());
342 } 363 }
343 364
344 CrxInstaller::Result InstallFunctionWrapper(base::Callback<bool()> callback) { 365 CrxInstaller::Result InstallFunctionWrapper(base::Callback<bool()> callback) {
345 return CrxInstaller::Result(callback.Run() ? InstallError::NONE 366 return CrxInstaller::Result(callback.Run() ? InstallError::NONE
346 : InstallError::GENERIC_ERROR); 367 : InstallError::GENERIC_ERROR);
347 } 368 }
348 369
349 } // namespace update_client 370 } // namespace update_client
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698