Chromium Code Reviews| Index: components/metrics/net/network_metrics_provider.cc |
| diff --git a/components/metrics/net/network_metrics_provider.cc b/components/metrics/net/network_metrics_provider.cc |
| index e845cde5bd511a69bccd4ec4a3f6c5e956bebe17..ab0e804938e92eb3ff2888aa56d6e36ada194818 100644 |
| --- a/components/metrics/net/network_metrics_provider.cc |
| +++ b/components/metrics/net/network_metrics_provider.cc |
| @@ -227,4 +227,27 @@ void NetworkMetricsProvider::WriteWifiAccessPointProto( |
| } |
| } |
| +bool NetworkMetricsProvider::IsCellularConnection() { |
| + switch (GetConnectionType()) { |
| + case SystemProfileProto_Network_ConnectionType_CONNECTION_2G: |
| + case SystemProfileProto_Network_ConnectionType_CONNECTION_3G: |
| + case SystemProfileProto_Network_ConnectionType_CONNECTION_4G: |
| + return true; |
| + default: |
| + return false; |
| + } |
| +} |
| + |
| +void NetworkMetricsProvider::GetIsCellularConnection(bool* is_cellular_out) { |
| + *is_cellular_out = IsCellularConnection(); |
| +} |
| + |
| +base::Callback<void(bool*)> NetworkMetricsProvider::GetConnectionCallback() { |
| + base::Callback<void(bool*)> cellular_callback = |
| + base::Bind(&NetworkMetricsProvider::GetIsCellularConnection, |
|
Alexei Svitkine (slow)
2015/02/23 20:18:15
Nit: Return this directly.
gayane -on leave until 09-2017
2015/02/23 20:27:53
Done.
|
| + weak_ptr_factory_.GetWeakPtr()); |
| + |
| + return cellular_callback; |
| +} |
| + |
| } // namespace metrics |