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

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

Issue 2491733002: Add data usage tracking for cloud print, update client service and search provide logos (Closed)
Patch Set: Rebased Created 4 years, 1 month 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>
11 #include <cmath> 11 #include <cmath>
12 #include <cstring> 12 #include <cstring>
13 #include <map> 13 #include <map>
14 #include <vector> 14 #include <vector>
15 15
16 #include "base/callback.h" 16 #include "base/callback.h"
17 #include "base/files/file_path.h" 17 #include "base/files/file_path.h"
18 #include "base/files/file_util.h" 18 #include "base/files/file_util.h"
19 #include "base/files/memory_mapped_file.h" 19 #include "base/files/memory_mapped_file.h"
20 #include "base/guid.h" 20 #include "base/guid.h"
21 #include "base/strings/string_number_conversions.h" 21 #include "base/strings/string_number_conversions.h"
22 #include "base/strings/string_piece.h" 22 #include "base/strings/string_piece.h"
23 #include "base/strings/string_util.h" 23 #include "base/strings/string_util.h"
24 #include "base/strings/stringprintf.h" 24 #include "base/strings/stringprintf.h"
25 #include "base/sys_info.h" 25 #include "base/sys_info.h"
26 #include "base/win/windows_version.h" 26 #include "base/win/windows_version.h"
27 #include "build/build_config.h" 27 #include "build/build_config.h"
28 #include "components/crx_file/id_util.h" 28 #include "components/crx_file/id_util.h"
29 #include "components/data_use_measurement/core/data_use_user_data.h"
29 #include "components/update_client/configurator.h" 30 #include "components/update_client/configurator.h"
30 #include "components/update_client/crx_update_item.h" 31 #include "components/update_client/crx_update_item.h"
31 #include "components/update_client/update_client.h" 32 #include "components/update_client/update_client.h"
32 #include "components/update_client/update_client_errors.h" 33 #include "components/update_client/update_client_errors.h"
33 #include "components/update_client/update_query_params.h" 34 #include "components/update_client/update_query_params.h"
34 #include "components/update_client/updater_state.h" 35 #include "components/update_client/updater_state.h"
35 #include "crypto/secure_hash.h" 36 #include "crypto/secure_hash.h"
36 #include "crypto/sha2.h" 37 #include "crypto/sha2.h"
37 #include "net/base/load_flags.h" 38 #include "net/base/load_flags.h"
38 #include "net/url_request/url_fetcher.h" 39 #include "net/url_request/url_fetcher.h"
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after
181 std::unique_ptr<net::URLFetcher> SendProtocolRequest( 182 std::unique_ptr<net::URLFetcher> SendProtocolRequest(
182 const GURL& url, 183 const GURL& url,
183 const std::string& protocol_request, 184 const std::string& protocol_request,
184 net::URLFetcherDelegate* url_fetcher_delegate, 185 net::URLFetcherDelegate* url_fetcher_delegate,
185 net::URLRequestContextGetter* url_request_context_getter) { 186 net::URLRequestContextGetter* url_request_context_getter) {
186 std::unique_ptr<net::URLFetcher> url_fetcher = net::URLFetcher::Create( 187 std::unique_ptr<net::URLFetcher> url_fetcher = net::URLFetcher::Create(
187 0, url, net::URLFetcher::POST, url_fetcher_delegate); 188 0, url, net::URLFetcher::POST, url_fetcher_delegate);
188 if (!url_fetcher.get()) 189 if (!url_fetcher.get())
189 return url_fetcher; 190 return url_fetcher;
190 191
192 data_use_measurement::DataUseUserData::AttachToFetcher(
193 url_fetcher.get(), data_use_measurement::DataUseUserData::UPDATE_CLIENT);
191 url_fetcher->SetUploadData("application/xml", protocol_request); 194 url_fetcher->SetUploadData("application/xml", protocol_request);
192 url_fetcher->SetRequestContext(url_request_context_getter); 195 url_fetcher->SetRequestContext(url_request_context_getter);
193 url_fetcher->SetLoadFlags(net::LOAD_DO_NOT_SEND_COOKIES | 196 url_fetcher->SetLoadFlags(net::LOAD_DO_NOT_SEND_COOKIES |
194 net::LOAD_DO_NOT_SAVE_COOKIES | 197 net::LOAD_DO_NOT_SAVE_COOKIES |
195 net::LOAD_DISABLE_CACHE); 198 net::LOAD_DISABLE_CACHE);
196 url_fetcher->SetAutomaticallyRetryOn5xx(false); 199 url_fetcher->SetAutomaticallyRetryOn5xx(false);
197 url_fetcher->Start(); 200 url_fetcher->Start();
198 201
199 return url_fetcher; 202 return url_fetcher;
200 } 203 }
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after
333 [](const GURL& url) { return !url.SchemeIsCryptographic(); }), 336 [](const GURL& url) { return !url.SchemeIsCryptographic(); }),
334 urls->end()); 337 urls->end());
335 } 338 }
336 339
337 CrxInstaller::Result InstallFunctionWrapper(base::Callback<bool()> callback) { 340 CrxInstaller::Result InstallFunctionWrapper(base::Callback<bool()> callback) {
338 return CrxInstaller::Result(callback.Run() ? InstallError::NONE 341 return CrxInstaller::Result(callback.Run() ? InstallError::NONE
339 : InstallError::GENERIC_ERROR); 342 : InstallError::GENERIC_ERROR);
340 } 343 }
341 344
342 } // namespace update_client 345 } // namespace update_client
OLDNEW
« no previous file with comments | « components/update_client/url_fetcher_downloader.cc ('k') | tools/metrics/histograms/histograms.xml » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698