OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 <algorithm> | 5 #include <algorithm> |
6 #include <vector> | 6 #include <vector> |
7 | 7 |
8 #include "base/bind.h" | 8 #include "base/bind.h" |
9 #include "base/lazy_instance.h" | 9 #include "base/lazy_instance.h" |
10 #include "base/strings/string_number_conversions.h" | 10 #include "base/strings/string_number_conversions.h" |
(...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
178 const chromeos::NetworkState* network = chromeos::NetworkHandler::Get() | 178 const chromeos::NetworkState* network = chromeos::NetworkHandler::Get() |
179 ->network_state_handler() | 179 ->network_state_handler() |
180 ->GetNetworkStateFromGuid(guid); | 180 ->GetNetworkStateFromGuid(guid); |
181 if (!network) | 181 if (!network) |
182 return nullptr; | 182 return nullptr; |
183 | 183 |
184 // Populate the NetworkInfo object. | 184 // Populate the NetworkInfo object. |
185 api::networking_config::NetworkInfo network_info; | 185 api::networking_config::NetworkInfo network_info; |
186 network_info.type = api::networking_config::NETWORK_TYPE_WIFI; | 186 network_info.type = api::networking_config::NETWORK_TYPE_WIFI; |
187 const std::vector<uint8_t>& raw_ssid = network->raw_ssid(); | 187 const std::vector<uint8_t>& raw_ssid = network->raw_ssid(); |
188 std::string hex_ssid = | 188 std::string hex_ssid = base::HexEncode(raw_ssid.data(), raw_ssid.size()); |
189 base::HexEncode(vector_as_array(&raw_ssid), raw_ssid.size()); | |
190 network_info.hex_ssid = make_scoped_ptr(new std::string(hex_ssid)); | 189 network_info.hex_ssid = make_scoped_ptr(new std::string(hex_ssid)); |
191 network_info.ssid = make_scoped_ptr(new std::string(network->name())); | 190 network_info.ssid = make_scoped_ptr(new std::string(network->name())); |
192 network_info.guid = make_scoped_ptr(new std::string(network->guid())); | 191 network_info.guid = make_scoped_ptr(new std::string(network->guid())); |
193 if (bssid) | 192 if (bssid) |
194 network_info.bssid.reset(new std::string(*bssid)); | 193 network_info.bssid.reset(new std::string(*bssid)); |
195 scoped_ptr<base::ListValue> results = | 194 scoped_ptr<base::ListValue> results = |
196 api::networking_config::OnCaptivePortalDetected::Create(network_info); | 195 api::networking_config::OnCaptivePortalDetected::Create(network_info); |
197 scoped_ptr<Event> event( | 196 scoped_ptr<Event> event( |
198 new Event(events::NETWORKING_CONFIG_ON_CAPTIVE_PORTAL_DETECTED, | 197 new Event(events::NETWORKING_CONFIG_ON_CAPTIVE_PORTAL_DETECTED, |
199 api::networking_config::OnCaptivePortalDetected::kEventName, | 198 api::networking_config::OnCaptivePortalDetected::kEventName, |
(...skipping 22 matching lines...) Expand all Loading... |
222 network_handler->managed_network_configuration_handler()->GetProperties( | 221 network_handler->managed_network_configuration_handler()->GetProperties( |
223 "" /* empty userhash */, service_path, | 222 "" /* empty userhash */, service_path, |
224 base::Bind(&NetworkingConfigService::OnGotProperties, | 223 base::Bind(&NetworkingConfigService::OnGotProperties, |
225 weak_factory_.GetWeakPtr(), extension_id, guid, | 224 weak_factory_.GetWeakPtr(), extension_id, guid, |
226 authentication_callback), | 225 authentication_callback), |
227 base::Bind(&NetworkingConfigService::OnGetPropertiesFailed, | 226 base::Bind(&NetworkingConfigService::OnGetPropertiesFailed, |
228 weak_factory_.GetWeakPtr(), extension_id, guid)); | 227 weak_factory_.GetWeakPtr(), extension_id, guid)); |
229 } | 228 } |
230 | 229 |
231 } // namespace extensions | 230 } // namespace extensions |
OLD | NEW |