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

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

Issue 2798873002: Network traffic annotation added to update_client. (Closed)
Patch Set: Annotation updated. 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 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 19 matching lines...) Expand all
30 #include "components/update_client/configurator.h" 30 #include "components/update_client/configurator.h"
31 #include "components/update_client/crx_update_item.h" 31 #include "components/update_client/crx_update_item.h"
32 #include "components/update_client/update_client.h" 32 #include "components/update_client/update_client.h"
33 #include "components/update_client/update_client_errors.h" 33 #include "components/update_client/update_client_errors.h"
34 #include "components/update_client/update_query_params.h" 34 #include "components/update_client/update_query_params.h"
35 #include "components/update_client/update_response.h" 35 #include "components/update_client/update_response.h"
36 #include "components/update_client/updater_state.h" 36 #include "components/update_client/updater_state.h"
37 #include "crypto/secure_hash.h" 37 #include "crypto/secure_hash.h"
38 #include "crypto/sha2.h" 38 #include "crypto/sha2.h"
39 #include "net/base/load_flags.h" 39 #include "net/base/load_flags.h"
40 #include "net/traffic_annotation/network_traffic_annotation.h"
40 #include "net/url_request/url_fetcher.h" 41 #include "net/url_request/url_fetcher.h"
41 #include "net/url_request/url_request_context_getter.h" 42 #include "net/url_request/url_request_context_getter.h"
42 #include "net/url_request/url_request_status.h" 43 #include "net/url_request/url_request_status.h"
43 #include "url/gurl.h" 44 #include "url/gurl.h"
44 45
45 #if defined(OS_WIN) 46 #if defined(OS_WIN)
46 #include "base/win/windows_version.h" 47 #include "base/win/windows_version.h"
47 #endif 48 #endif
48 49
49 namespace update_client { 50 namespace update_client {
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after
185 base::StringAppendF(&request, "%s</request>", request_body.c_str()); 186 base::StringAppendF(&request, "%s</request>", request_body.c_str());
186 187
187 return request; 188 return request;
188 } 189 }
189 190
190 std::unique_ptr<net::URLFetcher> SendProtocolRequest( 191 std::unique_ptr<net::URLFetcher> SendProtocolRequest(
191 const GURL& url, 192 const GURL& url,
192 const std::string& protocol_request, 193 const std::string& protocol_request,
193 net::URLFetcherDelegate* url_fetcher_delegate, 194 net::URLFetcherDelegate* url_fetcher_delegate,
194 net::URLRequestContextGetter* url_request_context_getter) { 195 net::URLRequestContextGetter* url_request_context_getter) {
196 net::NetworkTrafficAnnotationTag traffic_annotation =
197 net::DefineNetworkTrafficAnnotation("component_updater_utils", R"(
198 semantics {
199 sender: "Component Updater"
200 description:
201 "The component updater in Chrome is responsible for updating code "
202 "and data modules such as Flash, CrlSet, Origin Trials, etc. These "
203 "modules are updated on cycles independent of the Chrome release "
204 "tracks. It runs in the browser process and communicates with a "
205 "set of servers using the Omaha protocol to find the latest "
206 "versions of components, download them, and register them with the "
207 "rest of Chrome."
208 trigger: "Manual or automatic software updates."
209 data:
210 "Various OS and Chrome parameters such as version, bitness, "
211 "release tracks, etc."
212 destination: GOOGLE_OWNED_SERVICE
213 }
214 policy {
215 cookies_allowed: false
216 setting: "This feature cannot be disabled."
217 policy_exception_justification: "Not implemented."
msramek 2017/05/18 09:45:46 Ditto here.
Ramin Halavati 2017/05/18 10:44:01 Done.
218 })");
195 std::unique_ptr<net::URLFetcher> url_fetcher = net::URLFetcher::Create( 219 std::unique_ptr<net::URLFetcher> url_fetcher = net::URLFetcher::Create(
196 0, url, net::URLFetcher::POST, url_fetcher_delegate); 220 0, url, net::URLFetcher::POST, url_fetcher_delegate, traffic_annotation);
197 if (!url_fetcher.get()) 221 if (!url_fetcher.get())
198 return url_fetcher; 222 return url_fetcher;
199 223
200 data_use_measurement::DataUseUserData::AttachToFetcher( 224 data_use_measurement::DataUseUserData::AttachToFetcher(
201 url_fetcher.get(), data_use_measurement::DataUseUserData::UPDATE_CLIENT); 225 url_fetcher.get(), data_use_measurement::DataUseUserData::UPDATE_CLIENT);
202 url_fetcher->SetUploadData("application/xml", protocol_request); 226 url_fetcher->SetUploadData("application/xml", protocol_request);
203 url_fetcher->SetRequestContext(url_request_context_getter); 227 url_fetcher->SetRequestContext(url_request_context_getter);
204 url_fetcher->SetLoadFlags(net::LOAD_DO_NOT_SEND_COOKIES | 228 url_fetcher->SetLoadFlags(net::LOAD_DO_NOT_SEND_COOKIES |
205 net::LOAD_DO_NOT_SAVE_COOKIES | 229 net::LOAD_DO_NOT_SAVE_COOKIES |
206 net::LOAD_DISABLE_CACHE); 230 net::LOAD_DISABLE_CACHE);
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after
344 [](const GURL& url) { return !url.SchemeIsCryptographic(); }), 368 [](const GURL& url) { return !url.SchemeIsCryptographic(); }),
345 urls->end()); 369 urls->end());
346 } 370 }
347 371
348 CrxInstaller::Result InstallFunctionWrapper(base::Callback<bool()> callback) { 372 CrxInstaller::Result InstallFunctionWrapper(base::Callback<bool()> callback) {
349 return CrxInstaller::Result(callback.Run() ? InstallError::NONE 373 return CrxInstaller::Result(callback.Run() ? InstallError::NONE
350 : InstallError::GENERIC_ERROR); 374 : InstallError::GENERIC_ERROR);
351 } 375 }
352 376
353 } // namespace update_client 377 } // namespace update_client
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698