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

Side by Side Diff: components/pairing/bluetooth_controller_pairing_controller.cc

Issue 1428353002: Network Setup from Shark to Remora. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address achuithb@'s comment. Created 5 years, 1 month 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
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 "components/pairing/bluetooth_controller_pairing_controller.h" 5 #include "components/pairing/bluetooth_controller_pairing_controller.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "base/strings/string_util.h" 9 #include "base/strings/string_util.h"
10 #include "base/strings/stringprintf.h" 10 #include "base/strings/stringprintf.h"
(...skipping 294 matching lines...) Expand 10 before | Expand all | Expand 10 after
305 device->ConfirmPairing(); 305 device->ConfirmPairing();
306 // Once pairing is confirmed, the connection will either be successful, or 306 // Once pairing is confirmed, the connection will either be successful, or
307 // fail. Either case is acceptable as long as the devices are paired. 307 // fail. Either case is acceptable as long as the devices are paired.
308 } else { 308 } else {
309 device->RejectPairing(); 309 device->RejectPairing();
310 controller_device_id_.clear(); 310 controller_device_id_.clear();
311 RepeatDiscovery(); 311 RepeatDiscovery();
312 } 312 }
313 } 313 }
314 314
315 void BluetoothControllerPairingController::SetHostNetwork(
316 const std::string& onc_spec) {
317 pairing_api::AddNetwork add_network;
318 add_network.set_api_version(kPairingAPIVersion);
319 add_network.mutable_parameters()->set_onc_spec(onc_spec);
320
321 int size = 0;
322 scoped_refptr<net::IOBuffer> io_buffer(
323 ProtoDecoder::SendHostNetwork(add_network, &size));
324
325 SendBuffer(io_buffer, size);
326 }
327
315 void BluetoothControllerPairingController::SetHostConfiguration( 328 void BluetoothControllerPairingController::SetHostConfiguration(
316 bool accepted_eula, 329 bool accepted_eula,
317 const std::string& lang, 330 const std::string& lang,
318 const std::string& timezone, 331 const std::string& timezone,
319 bool send_reports, 332 bool send_reports,
320 const std::string& keyboard_layout) { 333 const std::string& keyboard_layout) {
321 VLOG(1) << "SetHostConfiguration lang=" << lang 334 VLOG(1) << "SetHostConfiguration lang=" << lang
322 << ", timezone=" << timezone 335 << ", timezone=" << timezone
323 << ", keyboard_layout=" << keyboard_layout; 336 << ", keyboard_layout=" << keyboard_layout;
324 337
325 pairing_api::ConfigureHost host_config; 338 pairing_api::ConfigureHost host_config;
326 host_config.set_api_version(kPairingAPIVersion); 339 host_config.set_api_version(kPairingAPIVersion);
327 host_config.mutable_parameters()->set_accepted_eula(accepted_eula); 340 host_config.mutable_parameters()->set_accepted_eula(accepted_eula);
328 host_config.mutable_parameters()->set_lang(lang); 341 if (!lang.empty())
329 host_config.mutable_parameters()->set_timezone(timezone); 342 host_config.mutable_parameters()->set_lang(lang);
343 if (!timezone.empty())
344 host_config.mutable_parameters()->set_timezone(timezone);
330 host_config.mutable_parameters()->set_send_reports(send_reports); 345 host_config.mutable_parameters()->set_send_reports(send_reports);
331 host_config.mutable_parameters()->set_keyboard_layout(keyboard_layout); 346 if (!keyboard_layout.empty())
347 host_config.mutable_parameters()->set_keyboard_layout(keyboard_layout);
332 348
333 int size = 0; 349 int size = 0;
334 scoped_refptr<net::IOBuffer> io_buffer( 350 scoped_refptr<net::IOBuffer> io_buffer(
335 ProtoDecoder::SendConfigureHost(host_config, &size)); 351 ProtoDecoder::SendConfigureHost(host_config, &size));
336 352
337 SendBuffer(io_buffer, size); 353 SendBuffer(io_buffer, size);
338 } 354 }
339 355
340 void BluetoothControllerPairingController::OnAuthenticationDone( 356 void BluetoothControllerPairingController::OnAuthenticationDone(
341 const std::string& domain, 357 const std::string& domain,
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after
476 ChangeStage(STAGE_WAITING_FOR_CODE_CONFIRMATION); 492 ChangeStage(STAGE_WAITING_FOR_CODE_CONFIRMATION);
477 } 493 }
478 494
479 void BluetoothControllerPairingController::AuthorizePairing( 495 void BluetoothControllerPairingController::AuthorizePairing(
480 device::BluetoothDevice* device) { 496 device::BluetoothDevice* device) {
481 // Disallow unknown device. 497 // Disallow unknown device.
482 device->RejectPairing(); 498 device->RejectPairing();
483 } 499 }
484 500
485 } // namespace pairing_chromeos 501 } // namespace pairing_chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698