Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 "ios/chrome/browser/ios_chrome_main_parts.h" | 5 #include "ios/chrome/browser/ios_chrome_main_parts.h" |
| 6 | 6 |
| 7 #include "base/base_switches.h" | 7 #include "base/base_switches.h" |
| 8 #include "base/feature_list.h" | 8 #include "base/feature_list.h" |
| 9 #include "base/files/file_path.h" | 9 #include "base/files/file_path.h" |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| 11 #include "base/memory/ptr_util.h" | 11 #include "base/memory/ptr_util.h" |
| 12 #include "base/metrics/user_metrics.h" | |
| 12 #include "base/path_service.h" | 13 #include "base/path_service.h" |
| 13 #include "base/time/default_tick_clock.h" | 14 #include "base/time/default_tick_clock.h" |
| 14 #include "components/content_settings/core/browser/cookie_settings.h" | 15 #include "components/content_settings/core/browser/cookie_settings.h" |
| 15 #include "components/content_settings/core/common/content_settings_pattern.h" | 16 #include "components/content_settings/core/common/content_settings_pattern.h" |
| 16 #include "components/flags_ui/pref_service_flags_storage.h" | 17 #include "components/flags_ui/pref_service_flags_storage.h" |
| 17 #include "components/language_usage_metrics/language_usage_metrics.h" | 18 #include "components/language_usage_metrics/language_usage_metrics.h" |
| 18 #include "components/metrics/metrics_service.h" | 19 #include "components/metrics/metrics_service.h" |
| 19 #include "components/metrics/profiler/ios/ios_tracking_synchronizer_delegate.h" | 20 #include "components/metrics/profiler/ios/ios_tracking_synchronizer_delegate.h" |
| 20 #include "components/metrics/profiler/tracking_synchronizer.h" | 21 #include "components/metrics/profiler/tracking_synchronizer.h" |
| 21 #include "components/metrics_services_manager/metrics_services_manager.h" | 22 #include "components/metrics_services_manager/metrics_services_manager.h" |
| (...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 182 TranslateServiceIOS::Shutdown(); | 183 TranslateServiceIOS::Shutdown(); |
| 183 application_context_->StartTearDown(); | 184 application_context_->StartTearDown(); |
| 184 } | 185 } |
| 185 | 186 |
| 186 void IOSChromeMainParts::PostDestroyThreads() { | 187 void IOSChromeMainParts::PostDestroyThreads() { |
| 187 application_context_->PostDestroyThreads(); | 188 application_context_->PostDestroyThreads(); |
| 188 } | 189 } |
| 189 | 190 |
| 190 // This will be called after the command-line has been mutated by about:flags | 191 // This will be called after the command-line has been mutated by about:flags |
| 191 void IOSChromeMainParts::SetUpMetricsAndFieldTrials() { | 192 void IOSChromeMainParts::SetUpMetricsAndFieldTrials() { |
| 193 base::SetRecordActionTaskRunner( | |
|
Alexei Svitkine (slow)
2016/04/22 14:30:13
Nit: Add a comment about where this is done on oth
| |
| 194 web::WebThread::GetTaskRunnerForThread(web::WebThread::UI)); | |
| 195 | |
| 192 // Must initialize metrics after labs have been converted into switches, | 196 // Must initialize metrics after labs have been converted into switches, |
| 193 // but before field trials are set up (so that client ID is available for | 197 // but before field trials are set up (so that client ID is available for |
| 194 // one-time randomized field trials). | 198 // one-time randomized field trials). |
| 195 metrics::MetricsService* metrics = application_context_->GetMetricsService(); | 199 metrics::MetricsService* metrics = application_context_->GetMetricsService(); |
| 196 | 200 |
| 197 // Initialize FieldTrialList to support FieldTrials that use one-time | 201 // Initialize FieldTrialList to support FieldTrials that use one-time |
| 198 // randomization. | 202 // randomization. |
| 199 field_trial_list_.reset( | 203 field_trial_list_.reset( |
| 200 new base::FieldTrialList(metrics->CreateEntropyProvider().release())); | 204 new base::FieldTrialList(metrics->CreateEntropyProvider().release())); |
| 201 | 205 |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 243 | 247 |
| 244 void IOSChromeMainParts::StartMetricsRecording() { | 248 void IOSChromeMainParts::StartMetricsRecording() { |
| 245 bool wifiOnly = local_state_->GetBoolean(prefs::kMetricsReportingWifiOnly); | 249 bool wifiOnly = local_state_->GetBoolean(prefs::kMetricsReportingWifiOnly); |
| 246 bool isConnectionCellular = net::NetworkChangeNotifier::IsConnectionCellular( | 250 bool isConnectionCellular = net::NetworkChangeNotifier::IsConnectionCellular( |
| 247 net::NetworkChangeNotifier::GetConnectionType()); | 251 net::NetworkChangeNotifier::GetConnectionType()); |
| 248 bool mayUpload = !wifiOnly || !isConnectionCellular; | 252 bool mayUpload = !wifiOnly || !isConnectionCellular; |
| 249 | 253 |
| 250 application_context_->GetMetricsServicesManager()->UpdateUploadPermissions( | 254 application_context_->GetMetricsServicesManager()->UpdateUploadPermissions( |
| 251 mayUpload); | 255 mayUpload); |
| 252 } | 256 } |
| OLD | NEW |