| 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" |
| (...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 194 // This will be called after the command-line has been mutated by about:flags | 194 // This will be called after the command-line has been mutated by about:flags |
| 195 void IOSChromeMainParts::SetUpMetricsAndFieldTrials() { | 195 void IOSChromeMainParts::SetUpMetricsAndFieldTrials() { |
| 196 base::SetRecordActionTaskRunner( | 196 base::SetRecordActionTaskRunner( |
| 197 web::WebThread::GetTaskRunnerForThread(web::WebThread::UI)); | 197 web::WebThread::GetTaskRunnerForThread(web::WebThread::UI)); |
| 198 | 198 |
| 199 // Initialize FieldTrialList to support FieldTrials that use one-time | 199 // Initialize FieldTrialList to support FieldTrials that use one-time |
| 200 // randomization. | 200 // randomization. |
| 201 DCHECK(!field_trial_list_); | 201 DCHECK(!field_trial_list_); |
| 202 field_trial_list_.reset( | 202 field_trial_list_.reset( |
| 203 new base::FieldTrialList(application_context_->GetMetricsServicesManager() | 203 new base::FieldTrialList(application_context_->GetMetricsServicesManager() |
| 204 ->CreateEntropyProvider() | 204 ->CreateEntropyProvider())); |
| 205 .release())); | |
| 206 | 205 |
| 207 const base::CommandLine* command_line = | 206 const base::CommandLine* command_line = |
| 208 base::CommandLine::ForCurrentProcess(); | 207 base::CommandLine::ForCurrentProcess(); |
| 209 // Ensure any field trials specified on the command line are initialized. | 208 // Ensure any field trials specified on the command line are initialized. |
| 210 // Also stop the metrics service so that we don't pollute UMA. | 209 // Also stop the metrics service so that we don't pollute UMA. |
| 211 if (command_line->HasSwitch(switches::kForceFieldTrials)) { | 210 if (command_line->HasSwitch(switches::kForceFieldTrials)) { |
| 212 // Create field trials without activating them, so that this behaves in a | 211 // Create field trials without activating them, so that this behaves in a |
| 213 // consistent manner with field trials created from the server. | 212 // consistent manner with field trials created from the server. |
| 214 bool result = base::FieldTrialList::CreateTrialsFromString( | 213 bool result = base::FieldTrialList::CreateTrialsFromString( |
| 215 command_line->GetSwitchValueASCII(switches::kForceFieldTrials), | 214 command_line->GetSwitchValueASCII(switches::kForceFieldTrials), |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 262 | 261 |
| 263 void IOSChromeMainParts::StartMetricsRecording() { | 262 void IOSChromeMainParts::StartMetricsRecording() { |
| 264 bool wifiOnly = local_state_->GetBoolean(prefs::kMetricsReportingWifiOnly); | 263 bool wifiOnly = local_state_->GetBoolean(prefs::kMetricsReportingWifiOnly); |
| 265 bool isConnectionCellular = net::NetworkChangeNotifier::IsConnectionCellular( | 264 bool isConnectionCellular = net::NetworkChangeNotifier::IsConnectionCellular( |
| 266 net::NetworkChangeNotifier::GetConnectionType()); | 265 net::NetworkChangeNotifier::GetConnectionType()); |
| 267 bool mayUpload = !wifiOnly || !isConnectionCellular; | 266 bool mayUpload = !wifiOnly || !isConnectionCellular; |
| 268 | 267 |
| 269 application_context_->GetMetricsServicesManager()->UpdateUploadPermissions( | 268 application_context_->GetMetricsServicesManager()->UpdateUploadPermissions( |
| 270 mayUpload); | 269 mayUpload); |
| 271 } | 270 } |
| OLD | NEW |