Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "components/metrics/net/network_metrics_provider.h" | 5 #include "components/metrics/net/network_metrics_provider.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
| (...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 220 it != oui_list.end(); | 220 it != oui_list.end(); |
| 221 ++it) { | 221 ++it) { |
| 222 uint32 oui; | 222 uint32 oui; |
| 223 if (base::HexStringToUInt(*it, &oui)) | 223 if (base::HexStringToUInt(*it, &oui)) |
| 224 vendor->add_element_identifier(oui); | 224 vendor->add_element_identifier(oui); |
| 225 else | 225 else |
| 226 NOTREACHED(); | 226 NOTREACHED(); |
| 227 } | 227 } |
| 228 } | 228 } |
| 229 | 229 |
| 230 bool NetworkMetricsProvider::IsCellularConnection() { | |
| 231 switch (GetConnectionType()) { | |
| 232 case SystemProfileProto_Network_ConnectionType_CONNECTION_2G: | |
| 233 case SystemProfileProto_Network_ConnectionType_CONNECTION_3G: | |
| 234 case SystemProfileProto_Network_ConnectionType_CONNECTION_4G: | |
| 235 return true; | |
| 236 default: | |
| 237 return false; | |
| 238 } | |
| 239 } | |
| 240 | |
| 241 void NetworkMetricsProvider::GetIsCellularConnection(bool* is_cellular_out) { | |
| 242 *is_cellular_out = IsCellularConnection(); | |
| 243 } | |
| 244 | |
| 245 base::Callback<void(bool*)> NetworkMetricsProvider::GetConnectionCallback() { | |
| 246 base::Callback<void(bool*)> cellular_callback = | |
| 247 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.
| |
| 248 weak_ptr_factory_.GetWeakPtr()); | |
| 249 | |
| 250 return cellular_callback; | |
| 251 } | |
| 252 | |
| 230 } // namespace metrics | 253 } // namespace metrics |
| OLD | NEW |