OLD | NEW |
(Empty) | |
| 1 // Copyright (c) 2017 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #include "chrome/browser/media/router/discovery/discovery_network_list_wifi.h" |
| 6 |
| 7 #include <CoreWLAN/CoreWLAN.h> |
| 8 #include <string.h> |
| 9 |
| 10 #include <utility> |
| 11 |
| 12 #include "base/logging.h" |
| 13 #include "base/mac/scoped_nsobject.h" |
| 14 #include "base/strings/sys_string_conversions.h" |
| 15 |
| 16 bool MaybeGetWifiSSID(const std::string& if_name, std::string* ssid_out) { |
| 17 DCHECK(ssid_out); |
| 18 |
| 19 NSString* ns_ifname = base::SysUTF8ToNSString(if_name.data()); |
| 20 CWInterface* interface = [CWInterface interfaceWithName:ns_ifname]; |
| 21 if (interface == nil) { |
| 22 return false; |
| 23 } |
| 24 std::string ssid(base::SysNSStringToUTF8([interface ssid])); |
| 25 if (ssid.size() == 0) { |
| 26 return false; |
| 27 } |
| 28 ssid_out->assign(std::move(ssid)); |
| 29 return true; |
| 30 } |
OLD | NEW |