OLD | NEW |
---|---|
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 "components/wifi/wifi_service.h" | 5 #include "components/wifi/wifi_service.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/message_loop/message_loop.h" | 8 #include "base/message_loop/message_loop.h" |
9 #include "components/onc/onc_constants.h" | 9 #include "components/onc/onc_constants.h" |
10 | 10 |
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
100 virtual void SetProperties(const std::string& network_guid, | 100 virtual void SetProperties(const std::string& network_guid, |
101 scoped_ptr<base::DictionaryValue> properties, | 101 scoped_ptr<base::DictionaryValue> properties, |
102 std::string* error) OVERRIDE { | 102 std::string* error) OVERRIDE { |
103 NetworkList::iterator network_properties = FindNetwork(network_guid); | 103 NetworkList::iterator network_properties = FindNetwork(network_guid); |
104 if (network_properties == networks_.end() || | 104 if (network_properties == networks_.end() || |
105 !network_properties->UpdateFromValue(*properties)) { | 105 !network_properties->UpdateFromValue(*properties)) { |
106 *error = "Error.DBusFailed"; | 106 *error = "Error.DBusFailed"; |
107 } | 107 } |
108 } | 108 } |
109 | 109 |
110 virtual void GetVisibleNetworks(ListValue* network_list) OVERRIDE { | 110 virtual void GetVisibleNetworks(const std::string& network_type, |
111 ListValue* network_list) OVERRIDE { | |
111 for (WiFiService::NetworkList::const_iterator it = networks_.begin(); | 112 for (WiFiService::NetworkList::const_iterator it = networks_.begin(); |
112 it != networks_.end(); | 113 it != networks_.end(); |
113 ++it) { | 114 ++it) { |
114 scoped_ptr<DictionaryValue> network(it->ToValue(true)); | 115 if (network_type.empty() || |
115 network_list->Append(network.release()); | 116 network_type == onc::network_type::kAllTypes || |
117 network_type == it->type) { | |
tbarzic
2013/11/26 18:39:36
nit: I find it more natural to have the value that
mef
2013/11/26 18:59:15
Done.
| |
118 scoped_ptr<DictionaryValue> network(it->ToValue(true)); | |
119 network_list->Append(network.release()); | |
120 } | |
116 } | 121 } |
117 } | 122 } |
118 | 123 |
119 virtual void RequestNetworkScan() OVERRIDE { | 124 virtual void RequestNetworkScan() OVERRIDE { |
120 NotifyNetworkListChanged(networks_); | 125 NotifyNetworkListChanged(networks_); |
121 } | 126 } |
122 | 127 |
123 virtual void StartConnect(const std::string& network_guid, | 128 virtual void StartConnect(const std::string& network_guid, |
124 std::string* error) OVERRIDE { | 129 std::string* error) OVERRIDE { |
125 NetworkList::iterator network_properties = FindNetwork(network_guid); | 130 NetworkList::iterator network_properties = FindNetwork(network_guid); |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
203 | 208 |
204 NetworkList networks_; | 209 NetworkList networks_; |
205 scoped_refptr<base::MessageLoopProxy> message_loop_proxy_; | 210 scoped_refptr<base::MessageLoopProxy> message_loop_proxy_; |
206 NetworkGuidListCallback networks_changed_observer_; | 211 NetworkGuidListCallback networks_changed_observer_; |
207 NetworkGuidListCallback network_list_changed_observer_; | 212 NetworkGuidListCallback network_list_changed_observer_; |
208 }; | 213 }; |
209 | 214 |
210 WiFiService* WiFiService::CreateForTest() { return new FakeWiFiService(); } | 215 WiFiService* WiFiService::CreateForTest() { return new FakeWiFiService(); } |
211 | 216 |
212 } // namespace wifi | 217 } // namespace wifi |
OLD | NEW |