| 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() { | 230 bool NetworkMetricsProvider::IsCellularConnection() const { |
| 231 switch (GetConnectionType()) { | 231 switch (GetConnectionType()) { |
| 232 case SystemProfileProto_Network_ConnectionType_CONNECTION_2G: | 232 case SystemProfileProto_Network_ConnectionType_CONNECTION_2G: |
| 233 case SystemProfileProto_Network_ConnectionType_CONNECTION_3G: | 233 case SystemProfileProto_Network_ConnectionType_CONNECTION_3G: |
| 234 case SystemProfileProto_Network_ConnectionType_CONNECTION_4G: | 234 case SystemProfileProto_Network_ConnectionType_CONNECTION_4G: |
| 235 return true; | 235 return true; |
| 236 default: | 236 default: |
| 237 return false; | 237 return false; |
| 238 } | 238 } |
| 239 } | 239 } |
| 240 | 240 |
| 241 void NetworkMetricsProvider::GetIsCellularConnection(bool* is_cellular_out) { | 241 void NetworkMetricsProvider::GetIsCellularConnection(bool* is_cellular_out) { |
| 242 *is_cellular_out = IsCellularConnection(); | 242 *is_cellular_out = IsCellularConnection(); |
| 243 } | 243 } |
| 244 | 244 |
| 245 base::Callback<void(bool*)> NetworkMetricsProvider::GetConnectionCallback() { | 245 base::Callback<void(bool*)> NetworkMetricsProvider::GetConnectionCallback() { |
| 246 return base::Bind(&NetworkMetricsProvider::GetIsCellularConnection, | 246 return base::Bind(&NetworkMetricsProvider::GetIsCellularConnection, |
| 247 weak_ptr_factory_.GetWeakPtr()); | 247 weak_ptr_factory_.GetWeakPtr()); |
| 248 } | 248 } |
| 249 | 249 |
| 250 } // namespace metrics | 250 } // namespace metrics |
| OLD | NEW |