| 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/fake_wifi_service.h" | 5 #include "components/wifi/fake_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 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 151 NotifyNetworkChanged(network_guid); | 151 NotifyNetworkChanged(network_guid); |
| 152 } | 152 } |
| 153 | 153 |
| 154 void FakeWiFiService::GetKeyFromSystem(const std::string& network_guid, | 154 void FakeWiFiService::GetKeyFromSystem(const std::string& network_guid, |
| 155 std::string* key_data, | 155 std::string* key_data, |
| 156 std::string* error) { | 156 std::string* error) { |
| 157 *error = "not-found"; | 157 *error = "not-found"; |
| 158 } | 158 } |
| 159 | 159 |
| 160 void FakeWiFiService::SetEventObservers( | 160 void FakeWiFiService::SetEventObservers( |
| 161 scoped_refptr<base::MessageLoopProxy> message_loop_proxy, | 161 scoped_refptr<base::SingleThreadTaskRunner> task_runner, |
| 162 const NetworkGuidListCallback& networks_changed_observer, | 162 const NetworkGuidListCallback& networks_changed_observer, |
| 163 const NetworkGuidListCallback& network_list_changed_observer) { | 163 const NetworkGuidListCallback& network_list_changed_observer) { |
| 164 message_loop_proxy_.swap(message_loop_proxy); | 164 task_runner_.swap(task_runner); |
| 165 networks_changed_observer_ = networks_changed_observer; | 165 networks_changed_observer_ = networks_changed_observer; |
| 166 network_list_changed_observer_ = network_list_changed_observer; | 166 network_list_changed_observer_ = network_list_changed_observer; |
| 167 } | 167 } |
| 168 | 168 |
| 169 void FakeWiFiService::RequestConnectedNetworkUpdate() { | 169 void FakeWiFiService::RequestConnectedNetworkUpdate() { |
| 170 } | 170 } |
| 171 | 171 |
| 172 void FakeWiFiService::GetConnectedNetworkSSID(std::string* ssid, | 172 void FakeWiFiService::GetConnectedNetworkSSID(std::string* ssid, |
| 173 std::string* error) { | 173 std::string* error) { |
| 174 *ssid = ""; | 174 *ssid = ""; |
| (...skipping 24 matching lines...) Expand all Loading... |
| 199 networks_.sort(NetworkProperties::OrderByType); | 199 networks_.sort(NetworkProperties::OrderByType); |
| 200 } | 200 } |
| 201 | 201 |
| 202 void FakeWiFiService::NotifyNetworkListChanged(const NetworkList& networks) { | 202 void FakeWiFiService::NotifyNetworkListChanged(const NetworkList& networks) { |
| 203 WiFiService::NetworkGuidList current_networks; | 203 WiFiService::NetworkGuidList current_networks; |
| 204 for (NetworkList::const_iterator it = networks.begin(); it != networks.end(); | 204 for (NetworkList::const_iterator it = networks.begin(); it != networks.end(); |
| 205 ++it) { | 205 ++it) { |
| 206 current_networks.push_back(it->guid); | 206 current_networks.push_back(it->guid); |
| 207 } | 207 } |
| 208 | 208 |
| 209 message_loop_proxy_->PostTask( | 209 task_runner_->PostTask( |
| 210 FROM_HERE, base::Bind(network_list_changed_observer_, current_networks)); | 210 FROM_HERE, base::Bind(network_list_changed_observer_, current_networks)); |
| 211 } | 211 } |
| 212 | 212 |
| 213 void FakeWiFiService::NotifyNetworkChanged(const std::string& network_guid) { | 213 void FakeWiFiService::NotifyNetworkChanged(const std::string& network_guid) { |
| 214 WiFiService::NetworkGuidList changed_networks(1, network_guid); | 214 WiFiService::NetworkGuidList changed_networks(1, network_guid); |
| 215 message_loop_proxy_->PostTask( | 215 task_runner_->PostTask( |
| 216 FROM_HERE, base::Bind(networks_changed_observer_, changed_networks)); | 216 FROM_HERE, base::Bind(networks_changed_observer_, changed_networks)); |
| 217 } | 217 } |
| 218 | 218 |
| 219 } // namespace wifi | 219 } // namespace wifi |
| OLD | NEW |