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" |
11 #include "base/strings/string_number_conversions.h" | 11 #include "base/strings/string_number_conversions.h" |
12 #include "base/strings/string_split.h" | 12 #include "base/strings/string_split.h" |
13 #include "base/strings/string_util.h" | 13 #include "base/strings/string_util.h" |
14 #include "base/task_runner_util.h" | 14 #include "base/task_runner_util.h" |
15 | 15 |
16 #if defined(OS_CHROMEOS) | 16 #if defined(OS_CHROMEOS) |
17 #include "components/metrics/net/wifi_access_point_info_provider_chromeos.h" | 17 #include "components/metrics/net/wifi_access_point_info_provider_chromeos.h" |
18 #endif // OS_CHROMEOS | 18 #endif // OS_CHROMEOS |
19 | 19 |
20 using metrics::SystemProfileProto; | 20 namespace metrics { |
21 | 21 |
22 NetworkMetricsProvider::NetworkMetricsProvider( | 22 NetworkMetricsProvider::NetworkMetricsProvider( |
23 base::TaskRunner* io_task_runner) | 23 base::TaskRunner* io_task_runner) |
24 : io_task_runner_(io_task_runner), | 24 : io_task_runner_(io_task_runner), |
25 connection_type_is_ambiguous_(false), | 25 connection_type_is_ambiguous_(false), |
26 wifi_phy_layer_protocol_is_ambiguous_(false), | 26 wifi_phy_layer_protocol_is_ambiguous_(false), |
27 wifi_phy_layer_protocol_(net::WIFI_PHY_LAYER_PROTOCOL_UNKNOWN), | 27 wifi_phy_layer_protocol_(net::WIFI_PHY_LAYER_PROTOCOL_UNKNOWN), |
28 weak_ptr_factory_(this) { | 28 weak_ptr_factory_(this) { |
29 net::NetworkChangeNotifier::AddConnectionTypeObserver(this); | 29 net::NetworkChangeNotifier::AddConnectionTypeObserver(this); |
30 connection_type_ = net::NetworkChangeNotifier::GetConnectionType(); | 30 connection_type_ = net::NetworkChangeNotifier::GetConnectionType(); |
(...skipping 24 matching lines...) Expand all Loading... |
55 connection_type_ = net::NetworkChangeNotifier::GetConnectionType(); | 55 connection_type_ = net::NetworkChangeNotifier::GetConnectionType(); |
56 wifi_phy_layer_protocol_is_ambiguous_ = false; | 56 wifi_phy_layer_protocol_is_ambiguous_ = false; |
57 | 57 |
58 if (!wifi_access_point_info_provider_.get()) { | 58 if (!wifi_access_point_info_provider_.get()) { |
59 #if defined(OS_CHROMEOS) | 59 #if defined(OS_CHROMEOS) |
60 wifi_access_point_info_provider_.reset( | 60 wifi_access_point_info_provider_.reset( |
61 new WifiAccessPointInfoProviderChromeos()); | 61 new WifiAccessPointInfoProviderChromeos()); |
62 #else | 62 #else |
63 wifi_access_point_info_provider_.reset( | 63 wifi_access_point_info_provider_.reset( |
64 new WifiAccessPointInfoProvider()); | 64 new WifiAccessPointInfoProvider()); |
65 #endif // OS_CHROMEOS | 65 #endif // OS_CHROMEOS |
66 } | 66 } |
67 | 67 |
68 // Connected wifi access point information. | 68 // Connected wifi access point information. |
69 WifiAccessPointInfoProvider::WifiAccessPointInfo info; | 69 WifiAccessPointInfoProvider::WifiAccessPointInfo info; |
70 if (wifi_access_point_info_provider_->GetInfo(&info)) | 70 if (wifi_access_point_info_provider_->GetInfo(&info)) |
71 WriteWifiAccessPointProto(info, network); | 71 WriteWifiAccessPointProto(info, network); |
72 } | 72 } |
73 | 73 |
74 void NetworkMetricsProvider::OnConnectionTypeChanged( | 74 void NetworkMetricsProvider::OnConnectionTypeChanged( |
75 net::NetworkChangeNotifier::ConnectionType type) { | 75 net::NetworkChangeNotifier::ConnectionType type) { |
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
219 for (std::vector<std::string>::const_iterator it = oui_list.begin(); | 219 for (std::vector<std::string>::const_iterator it = oui_list.begin(); |
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 |
| 230 } // namespace metrics |
OLD | NEW |