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 "chrome/browser/metrics/wifi_access_point_info_provider_chromeos.h" | 5 #include "chrome/browser/metrics/wifi_access_point_info_provider_chromeos.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/location.h" | 8 #include "base/location.h" |
9 #include "base/strings/string_number_conversions.h" | 9 #include "base/strings/string_number_conversions.h" |
10 #include "chromeos/network/network_configuration_handler.h" | 10 #include "chromeos/network/network_configuration_handler.h" |
11 #include "chromeos/network/network_handler.h" | 11 #include "chromeos/network/network_handler.h" |
12 #include "chromeos/network/network_state.h" | 12 #include "chromeos/network/network_state.h" |
13 #include "chromeos/network/network_state_handler.h" | 13 #include "chromeos/network/network_state_handler.h" |
14 #include "chromeos/network/shill_property_util.h" | 14 #include "chromeos/network/shill_property_util.h" |
15 #include "third_party/cros_system_api/dbus/service_constants.h" | 15 #include "third_party/cros_system_api/dbus/service_constants.h" |
16 | 16 |
17 using chromeos::NetworkHandler; | 17 using chromeos::NetworkHandler; |
18 | 18 |
19 WifiAccessPointInfoProviderChromeos::WifiAccessPointInfoProviderChromeos() { | 19 WifiAccessPointInfoProviderChromeos::WifiAccessPointInfoProviderChromeos() { |
20 NetworkHandler::Get()->network_state_handler()->AddObserver(this, FROM_HERE); | 20 NetworkHandler::Get()->network_state_handler()->AddObserver(this, FROM_HERE); |
21 | 21 |
22 // Update initial connection state. | 22 // Update initial connection state. |
23 DefaultNetworkChanged( | 23 DefaultNetworkChanged( |
24 NetworkHandler::Get()->network_state_handler()->DefaultNetwork()); | 24 NetworkHandler::Get()->network_state_handler()->DefaultNetwork()); |
25 } | 25 } |
26 | 26 |
27 WifiAccessPointInfoProviderChromeos::~WifiAccessPointInfoProviderChromeos() { | 27 WifiAccessPointInfoProviderChromeos::~WifiAccessPointInfoProviderChromeos() { |
| 28 NetworkHandler::Get()->network_state_handler()->RemoveObserver(this, |
| 29 FROM_HERE); |
28 } | 30 } |
29 | 31 |
30 bool WifiAccessPointInfoProviderChromeos::GetInfo(WifiAccessPointInfo* info) { | 32 bool WifiAccessPointInfoProviderChromeos::GetInfo(WifiAccessPointInfo* info) { |
31 // Wifi access point information is not provided if the BSSID is empty. | 33 // Wifi access point information is not provided if the BSSID is empty. |
32 // This assumes the BSSID is never empty when access point information exists. | 34 // This assumes the BSSID is never empty when access point information exists. |
33 if (wifi_access_point_info_.bssid.empty()) | 35 if (wifi_access_point_info_.bssid.empty()) |
34 return false; | 36 return false; |
35 | 37 |
36 *info = wifi_access_point_info_; | 38 *info = wifi_access_point_info_; |
37 return true; | 39 return true; |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
107 &wifi_access_point_info_.model_number); | 109 &wifi_access_point_info_.model_number); |
108 vendor_dict->GetStringWithoutPathExpansion( | 110 vendor_dict->GetStringWithoutPathExpansion( |
109 shill::kVendorWPSModelNameProperty, | 111 shill::kVendorWPSModelNameProperty, |
110 &wifi_access_point_info_.model_name); | 112 &wifi_access_point_info_.model_name); |
111 vendor_dict->GetStringWithoutPathExpansion( | 113 vendor_dict->GetStringWithoutPathExpansion( |
112 shill::kVendorWPSDeviceNameProperty, | 114 shill::kVendorWPSDeviceNameProperty, |
113 &wifi_access_point_info_.device_name); | 115 &wifi_access_point_info_.device_name); |
114 vendor_dict->GetStringWithoutPathExpansion(shill::kVendorOUIListProperty, | 116 vendor_dict->GetStringWithoutPathExpansion(shill::kVendorOUIListProperty, |
115 &wifi_access_point_info_.oui_list); | 117 &wifi_access_point_info_.oui_list); |
116 } | 118 } |
OLD | NEW |