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 "extensions/browser/api/networking_private/networking_private_linux.h" | 5 #include "extensions/browser/api/networking_private/networking_private_linux.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/bind_helpers.h" | 8 #include "base/bind_helpers.h" |
9 #include "base/callback.h" | 9 #include "base/callback.h" |
10 #include "base/message_loop/message_loop.h" | 10 #include "base/message_loop/message_loop.h" |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
44 const char kAccessPointSecurityWpaPsk[] = "WPA-PSK"; | 44 const char kAccessPointSecurityWpaPsk[] = "WPA-PSK"; |
45 const char kAccessPointSecurity9021X[] = "WEP-8021X"; | 45 const char kAccessPointSecurity9021X[] = "WEP-8021X"; |
46 | 46 |
47 // Parses the GUID which contains 3 pieces of relevant information. The | 47 // Parses the GUID which contains 3 pieces of relevant information. The |
48 // object path to the network device, the object path of the access point, | 48 // object path to the network device, the object path of the access point, |
49 // and the ssid. | 49 // and the ssid. |
50 bool ParseNetworkGuid(const std::string& guid, | 50 bool ParseNetworkGuid(const std::string& guid, |
51 std::string* device_path, | 51 std::string* device_path, |
52 std::string* access_point_path, | 52 std::string* access_point_path, |
53 std::string* ssid) { | 53 std::string* ssid) { |
54 std::vector<std::string> guid_parts; | 54 std::vector<std::string> guid_parts = |
55 | 55 base::SplitString(guid, "|", base::TRIM_WHITESPACE, base::SPLIT_WANT_ALL); |
56 base::SplitString(guid, '|', &guid_parts); | |
57 | |
58 if (guid_parts.size() != 3) { | 56 if (guid_parts.size() != 3) { |
59 return false; | 57 return false; |
60 } | 58 } |
61 | 59 |
62 *device_path = guid_parts[0]; | 60 *device_path = guid_parts[0]; |
63 *access_point_path = guid_parts[1]; | 61 *access_point_path = guid_parts[1]; |
64 *ssid = guid_parts[2]; | 62 *ssid = guid_parts[2]; |
65 | 63 |
66 if (device_path->empty() || access_point_path->empty() || ssid->empty()) { | 64 if (device_path->empty() || access_point_path->empty() || ssid->empty()) { |
67 return false; | 65 return false; |
(...skipping 1130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1198 base::Unretained(this), base::Passed(&guid_list))); | 1196 base::Unretained(this), base::Passed(&guid_list))); |
1199 } | 1197 } |
1200 | 1198 |
1201 void NetworkingPrivateLinux::OnNetworksChangedEventTask( | 1199 void NetworkingPrivateLinux::OnNetworksChangedEventTask( |
1202 scoped_ptr<GuidList> guid_list) { | 1200 scoped_ptr<GuidList> guid_list) { |
1203 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); | 1201 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); |
1204 OnNetworksChangedEventOnUIThread(*guid_list); | 1202 OnNetworksChangedEventOnUIThread(*guid_list); |
1205 } | 1203 } |
1206 | 1204 |
1207 } // namespace extensions | 1205 } // namespace extensions |
OLD | NEW |