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 <stdio.h> | 5 #include <stdio.h> |
| 6 |
6 #include <string> | 7 #include <string> |
| 8 #include <utility> |
7 | 9 |
8 #include "base/at_exit.h" | 10 #include "base/at_exit.h" |
9 #include "base/bind.h" | 11 #include "base/bind.h" |
10 #include "base/cancelable_callback.h" | 12 #include "base/cancelable_callback.h" |
11 #include "base/command_line.h" | 13 #include "base/command_line.h" |
12 #include "base/files/file_util.h" | 14 #include "base/files/file_util.h" |
13 #include "base/logging.h" | 15 #include "base/logging.h" |
14 #include "base/memory/scoped_ptr.h" | 16 #include "base/memory/scoped_ptr.h" |
15 #include "base/message_loop/message_loop.h" | 17 #include "base/message_loop/message_loop.h" |
16 #include "base/run_loop.h" | 18 #include "base/run_loop.h" |
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
170 | 172 |
171 if (!security.empty()) | 173 if (!security.empty()) |
172 properties->SetString("WiFi.Security", security); | 174 properties->SetString("WiFi.Security", security); |
173 | 175 |
174 if (parsed_command_line.HasSwitch("create")) { | 176 if (parsed_command_line.HasSwitch("create")) { |
175 if (!network_guid.empty()) { | 177 if (!network_guid.empty()) { |
176 std::string error; | 178 std::string error; |
177 std::string new_network_guid; | 179 std::string new_network_guid; |
178 properties->SetString("WiFi.SSID", network_guid); | 180 properties->SetString("WiFi.SSID", network_guid); |
179 VLOG(0) << "Creating Network: " << *properties; | 181 VLOG(0) << "Creating Network: " << *properties; |
180 wifi_service_->CreateNetwork( | 182 wifi_service_->CreateNetwork(false, std::move(properties), |
181 false, properties.Pass(), &new_network_guid, &error); | 183 &new_network_guid, &error); |
182 VLOG(0) << error << ":\n" << new_network_guid; | 184 VLOG(0) << error << ":\n" << new_network_guid; |
183 return true; | 185 return true; |
184 } | 186 } |
185 } | 187 } |
186 | 188 |
187 if (parsed_command_line.HasSwitch("connect")) { | 189 if (parsed_command_line.HasSwitch("connect")) { |
188 if (!network_guid.empty()) { | 190 if (!network_guid.empty()) { |
189 std::string error; | 191 std::string error; |
190 if (!properties->empty()) { | 192 if (!properties->empty()) { |
191 VLOG(0) << "Using connect properties: " << *properties; | 193 VLOG(0) << "Using connect properties: " << *properties; |
192 wifi_service_->SetProperties(network_guid, properties.Pass(), &error); | 194 wifi_service_->SetProperties(network_guid, std::move(properties), |
| 195 &error); |
193 } | 196 } |
194 | 197 |
195 wifi_service_->SetEventObservers( | 198 wifi_service_->SetEventObservers( |
196 loop.task_runner(), | 199 loop.task_runner(), |
197 base::Bind(&WiFiTest::OnNetworksChanged, base::Unretained(this)), | 200 base::Bind(&WiFiTest::OnNetworksChanged, base::Unretained(this)), |
198 base::Bind(&WiFiTest::OnNetworkListChanged, base::Unretained(this))); | 201 base::Bind(&WiFiTest::OnNetworkListChanged, base::Unretained(this))); |
199 | 202 |
200 wifi_service_->StartConnect(network_guid, &error); | 203 wifi_service_->StartConnect(network_guid, &error); |
201 VLOG(0) << error; | 204 VLOG(0) << error; |
202 if (error.empty()) | 205 if (error.empty()) |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
252 | 255 |
253 int main(int argc, const char* argv[]) { | 256 int main(int argc, const char* argv[]) { |
254 base::CommandLine::Init(argc, argv); | 257 base::CommandLine::Init(argc, argv); |
255 logging::LoggingSettings settings; | 258 logging::LoggingSettings settings; |
256 settings.logging_dest = logging::LOG_TO_SYSTEM_DEBUG_LOG; | 259 settings.logging_dest = logging::LOG_TO_SYSTEM_DEBUG_LOG; |
257 logging::InitLogging(settings); | 260 logging::InitLogging(settings); |
258 | 261 |
259 wifi::WiFiTest wifi_test; | 262 wifi::WiFiTest wifi_test; |
260 return wifi_test.Main(argc, argv); | 263 return wifi_test.Main(argc, argv); |
261 } | 264 } |
OLD | NEW |