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 "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 330 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
341 | 341 |
342 int size = 0; | 342 int size = 0; |
343 scoped_refptr<net::IOBuffer> io_buffer( | 343 scoped_refptr<net::IOBuffer> io_buffer( |
344 ProtoDecoder::SendPairDevices(pair_devices, &size)); | 344 ProtoDecoder::SendPairDevices(pair_devices, &size)); |
345 | 345 |
346 SendBuffer(io_buffer, size); | 346 SendBuffer(io_buffer, size); |
347 ChangeStage(STAGE_HOST_ENROLLMENT_IN_PROGRESS); | 347 ChangeStage(STAGE_HOST_ENROLLMENT_IN_PROGRESS); |
348 } | 348 } |
349 | 349 |
350 void BluetoothControllerPairingController::StartSession() { | 350 void BluetoothControllerPairingController::StartSession() { |
351 DCHECK_EQ(current_stage_, STAGE_PAIRING_DONE); | 351 DCHECK_EQ(current_stage_, STAGE_HOST_ENROLLMENT_SUCCESS); |
352 ChangeStage(STAGE_FINISHED); | 352 ChangeStage(STAGE_FINISHED); |
353 } | 353 } |
354 | 354 |
355 void BluetoothControllerPairingController::OnHostStatusMessage( | 355 void BluetoothControllerPairingController::OnHostStatusMessage( |
356 const pairing_api::HostStatus& message) { | 356 const pairing_api::HostStatus& message) { |
357 pairing_api::HostStatusParameters::UpdateStatus update_status = | 357 pairing_api::HostStatusParameters::UpdateStatus update_status = |
358 message.parameters().update_status(); | 358 message.parameters().update_status(); |
359 pairing_api::HostStatusParameters::EnrollmentStatus enrollment_status = | 359 pairing_api::HostStatusParameters::EnrollmentStatus enrollment_status = |
360 message.parameters().enrollment_status(); | 360 message.parameters().enrollment_status(); |
361 VLOG(1) << "OnHostStatusMessage, update_status=" << update_status; | 361 VLOG(1) << "OnHostStatusMessage, update_status=" << update_status; |
(...skipping 16 matching lines...) Expand all Loading... |
378 pairing_api::CompleteSetup complete_setup; | 378 pairing_api::CompleteSetup complete_setup; |
379 complete_setup.set_api_version(kPairingAPIVersion); | 379 complete_setup.set_api_version(kPairingAPIVersion); |
380 // TODO(zork): Get AddAnother from UI (http://crbug.com/405757) | 380 // TODO(zork): Get AddAnother from UI (http://crbug.com/405757) |
381 complete_setup.mutable_parameters()->set_add_another(false); | 381 complete_setup.mutable_parameters()->set_add_another(false); |
382 | 382 |
383 int size = 0; | 383 int size = 0; |
384 scoped_refptr<net::IOBuffer> io_buffer( | 384 scoped_refptr<net::IOBuffer> io_buffer( |
385 ProtoDecoder::SendCompleteSetup(complete_setup, &size)); | 385 ProtoDecoder::SendCompleteSetup(complete_setup, &size)); |
386 | 386 |
387 SendBuffer(io_buffer, size); | 387 SendBuffer(io_buffer, size); |
388 ChangeStage(STAGE_PAIRING_DONE); | 388 ChangeStage(STAGE_HOST_ENROLLMENT_SUCCESS); |
389 } | 389 } |
390 | 390 |
391 void BluetoothControllerPairingController::OnConfigureHostMessage( | 391 void BluetoothControllerPairingController::OnConfigureHostMessage( |
392 const pairing_api::ConfigureHost& message) { | 392 const pairing_api::ConfigureHost& message) { |
393 NOTREACHED(); | 393 NOTREACHED(); |
394 } | 394 } |
395 | 395 |
396 void BluetoothControllerPairingController::OnPairDevicesMessage( | 396 void BluetoothControllerPairingController::OnPairDevicesMessage( |
397 const pairing_api::PairDevices& message) { | 397 const pairing_api::PairDevices& message) { |
398 NOTREACHED(); | 398 NOTREACHED(); |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
464 ChangeStage(STAGE_WAITING_FOR_CODE_CONFIRMATION); | 464 ChangeStage(STAGE_WAITING_FOR_CODE_CONFIRMATION); |
465 } | 465 } |
466 | 466 |
467 void BluetoothControllerPairingController::AuthorizePairing( | 467 void BluetoothControllerPairingController::AuthorizePairing( |
468 device::BluetoothDevice* device) { | 468 device::BluetoothDevice* device) { |
469 // Disallow unknown device. | 469 // Disallow unknown device. |
470 device->RejectPairing(); | 470 device->RejectPairing(); |
471 } | 471 } |
472 | 472 |
473 } // namespace pairing_chromeos | 473 } // namespace pairing_chromeos |
OLD | NEW |