Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(912)

Side by Side Diff: chrome/browser/media/router/discovery/discovery_network_list_wifi_mac.mm

Issue 2868213004: Add Windows and Mac network list implementation (Closed)
Patch Set: Rebase Created 3 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(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 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698