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 #import "ios/chrome/app/application_delegate/metrics_mediator.h" | 5 #import "ios/chrome/app/application_delegate/metrics_mediator.h" |
6 | 6 |
7 #include "base/mac/bind_objc_block.h" | 7 #include "base/mac/bind_objc_block.h" |
8 #include "base/metrics/histogram_macros.h" | 8 #include "base/metrics/histogram_macros.h" |
9 #include "base/metrics/user_metrics_action.h" | 9 #include "base/metrics/user_metrics_action.h" |
10 #include "base/strings/sys_string_conversions.h" | 10 #include "base/strings/sys_string_conversions.h" |
(...skipping 330 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
341 } | 341 } |
342 | 342 |
343 #pragma mark - CRConnectionTypeObserverBridge implementation | 343 #pragma mark - CRConnectionTypeObserverBridge implementation |
344 | 344 |
345 - (void)connectionTypeChanged:(net::NetworkChangeNotifier::ConnectionType)type { | 345 - (void)connectionTypeChanged:(net::NetworkChangeNotifier::ConnectionType)type { |
346 BOOL wwanEnabled = net::NetworkChangeNotifier::IsConnectionCellular(type); | 346 BOOL wwanEnabled = net::NetworkChangeNotifier::IsConnectionCellular(type); |
347 // Currently the MainController only cares about WWAN state for the metrics | 347 // Currently the MainController only cares about WWAN state for the metrics |
348 // reporting preference. If it's disabled, or the wifi-only preference is | 348 // reporting preference. If it's disabled, or the wifi-only preference is |
349 // not set, we don't care. In fact, we should not even be getting this call. | 349 // not set, we don't care. In fact, we should not even be getting this call. |
350 DCHECK([self isMetricsReportingEnabledWifiOnly]); | 350 DCHECK([self isMetricsReportingEnabledWifiOnly]); |
| 351 DCHECK(connectionTypeObserverBridge_); |
351 // |wwanEnabled| is true if a cellular connection such as EDGE or GPRS is | 352 // |wwanEnabled| is true if a cellular connection such as EDGE or GPRS is |
352 // used. Otherwise, either there is no connection available, or another link | 353 // used. Otherwise, either there is no connection available, or another link |
353 // (such as WiFi) is used. | 354 // (such as WiFi) is used. |
354 if (wwanEnabled) { | 355 if (wwanEnabled) { |
355 // If WWAN mode is on, wifi-only prefs should be disabled. | 356 // If WWAN mode is on, wifi-only prefs should be disabled. |
356 // For the crash reporter, we still want to record the crashes. | 357 // For the crash reporter, we still want to record the crashes. |
357 [self setBreakpadUploadingEnabled:NO]; | 358 [self setBreakpadUploadingEnabled:NO]; |
358 [self setReporting:NO]; | 359 [self setReporting:NO]; |
359 } else if ([self areMetricsEnabled]) { | 360 } else if ([self areMetricsEnabled]) { |
360 // Double-check that the metrics reporting preference is enabled. | 361 // Double-check that the metrics reporting preference is enabled. |
(...skipping 26 matching lines...) Expand all Loading... |
387 } | 388 } |
388 | 389 |
389 - (BOOL)isMetricsReportingEnabledWifiOnly { | 390 - (BOOL)isMetricsReportingEnabledWifiOnly { |
390 return GetApplicationContext()->GetLocalState()->GetBoolean( | 391 return GetApplicationContext()->GetLocalState()->GetBoolean( |
391 metrics::prefs::kMetricsReportingEnabled) && | 392 metrics::prefs::kMetricsReportingEnabled) && |
392 GetApplicationContext()->GetLocalState()->GetBoolean( | 393 GetApplicationContext()->GetLocalState()->GetBoolean( |
393 prefs::kMetricsReportingWifiOnly); | 394 prefs::kMetricsReportingWifiOnly); |
394 } | 395 } |
395 | 396 |
396 @end | 397 @end |
OLD | NEW |