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

Side by Side Diff: chrome/browser/metrics/variations/variations_service.cc

Issue 1330443002: Report data usage UMA for Chrome services (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@NewArchServices
Patch Set: Updating the function name and some of gyp files. Created 5 years, 3 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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "chrome/browser/metrics/variations/variations_service.h" 5 #include "chrome/browser/metrics/variations/variations_service.h"
6 6
7 #include "base/build_time.h" 7 #include "base/build_time.h"
8 #include "base/command_line.h" 8 #include "base/command_line.h"
9 #include "base/metrics/histogram.h" 9 #include "base/metrics/histogram.h"
10 #include "base/metrics/sparse_histogram.h" 10 #include "base/metrics/sparse_histogram.h"
11 #include "base/prefs/pref_registry_simple.h" 11 #include "base/prefs/pref_registry_simple.h"
12 #include "base/prefs/pref_service.h" 12 #include "base/prefs/pref_service.h"
13 #include "base/sys_info.h" 13 #include "base/sys_info.h"
14 #include "base/task_runner_util.h" 14 #include "base/task_runner_util.h"
15 #include "base/timer/elapsed_timer.h" 15 #include "base/timer/elapsed_timer.h"
16 #include "base/values.h" 16 #include "base/values.h"
17 #include "base/version.h" 17 #include "base/version.h"
18 #include "components/data_use_measurement/core/data_use_user_data.h"
18 #include "components/metrics/metrics_state_manager.h" 19 #include "components/metrics/metrics_state_manager.h"
19 #include "components/network_time/network_time_tracker.h" 20 #include "components/network_time/network_time_tracker.h"
20 #include "components/pref_registry/pref_registry_syncable.h" 21 #include "components/pref_registry/pref_registry_syncable.h"
21 #include "components/variations/pref_names.h" 22 #include "components/variations/pref_names.h"
22 #include "components/variations/proto/variations_seed.pb.h" 23 #include "components/variations/proto/variations_seed.pb.h"
23 #include "components/variations/variations_seed_processor.h" 24 #include "components/variations/variations_seed_processor.h"
24 #include "components/variations/variations_seed_simulator.h" 25 #include "components/variations/variations_seed_simulator.h"
25 #include "components/variations/variations_switches.h" 26 #include "components/variations/variations_switches.h"
26 #include "components/variations/variations_url_constants.h" 27 #include "components/variations/variations_url_constants.h"
27 #include "components/version_info/version_info.h" 28 #include "components/version_info/version_info.h"
(...skipping 413 matching lines...) Expand 10 before | Expand all | Expand 10 after
441 local_state, state_manager)); 442 local_state, state_manager));
442 return result.Pass(); 443 return result.Pass();
443 } 444 }
444 445
445 void VariationsService::DoActualFetch() { 446 void VariationsService::DoActualFetch() {
446 DCHECK(thread_checker_.CalledOnValidThread()); 447 DCHECK(thread_checker_.CalledOnValidThread());
447 DCHECK(!pending_seed_request_); 448 DCHECK(!pending_seed_request_);
448 449
449 pending_seed_request_ = net::URLFetcher::Create(0, variations_server_url_, 450 pending_seed_request_ = net::URLFetcher::Create(0, variations_server_url_,
450 net::URLFetcher::GET, this); 451 net::URLFetcher::GET, this);
452 data_use_measurement::DataUseUserData::AttachToFetcher(
453 pending_seed_request_.get(),
454 data_use_measurement::DataUseUserData::VARIATIONS);
451 pending_seed_request_->SetLoadFlags(net::LOAD_DO_NOT_SEND_COOKIES | 455 pending_seed_request_->SetLoadFlags(net::LOAD_DO_NOT_SEND_COOKIES |
452 net::LOAD_DO_NOT_SAVE_COOKIES); 456 net::LOAD_DO_NOT_SAVE_COOKIES);
453 pending_seed_request_->SetRequestContext(client_->GetURLRequestContext()); 457 pending_seed_request_->SetRequestContext(client_->GetURLRequestContext());
454 pending_seed_request_->SetMaxRetriesOn5xx(kMaxRetrySeedFetch); 458 pending_seed_request_->SetMaxRetriesOn5xx(kMaxRetrySeedFetch);
455 if (!seed_store_.variations_serial_number().empty() && 459 if (!seed_store_.variations_serial_number().empty() &&
456 !disable_deltas_for_next_request_) { 460 !disable_deltas_for_next_request_) {
457 // If the current seed includes a country code, deltas are not supported (as 461 // If the current seed includes a country code, deltas are not supported (as
458 // the serial number doesn't take into account the country code). The server 462 // the serial number doesn't take into account the country code). The server
459 // will update us with a seed that doesn't include a country code which will 463 // will update us with a seed that doesn't include a country code which will
460 // enable deltas to work. 464 // enable deltas to work.
(...skipping 287 matching lines...) Expand 10 before | Expand all | Expand 10 after
748 // Otherwise, update the pref with the current Chrome version and country. 752 // Otherwise, update the pref with the current Chrome version and country.
749 base::ListValue new_list_value; 753 base::ListValue new_list_value;
750 new_list_value.AppendString(version.GetString()); 754 new_list_value.AppendString(version.GetString());
751 new_list_value.AppendString(latest_country); 755 new_list_value.AppendString(latest_country);
752 local_state_->Set(prefs::kVariationsPermanentConsistencyCountry, 756 local_state_->Set(prefs::kVariationsPermanentConsistencyCountry,
753 new_list_value); 757 new_list_value);
754 return latest_country; 758 return latest_country;
755 } 759 }
756 760
757 } // namespace chrome_variations 761 } // namespace chrome_variations
OLDNEW
« no previous file with comments | « chrome/browser/DEPS ('k') | chrome/browser/profiles/DEPS » ('j') | components/autofill.gypi » ('J')

Powered by Google App Engine
This is Rietveld 408576698