| 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_host_pairing_controller.h" | 5 #include "components/pairing/bluetooth_host_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/stringprintf.h" | 9 #include "base/strings/stringprintf.h" |
| 10 #include "components/pairing/bluetooth_pairing_constants.h" | 10 #include "components/pairing/bluetooth_pairing_constants.h" |
| (...skipping 248 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 259 | 259 |
| 260 void BluetoothHostPairingController::OnPairDevicesMessage( | 260 void BluetoothHostPairingController::OnPairDevicesMessage( |
| 261 const pairing_api::PairDevices& message) { | 261 const pairing_api::PairDevices& message) { |
| 262 DCHECK(thread_checker_.CalledOnValidThread()); | 262 DCHECK(thread_checker_.CalledOnValidThread()); |
| 263 if (current_stage_ != STAGE_WAITING_FOR_CREDENTIALS) { | 263 if (current_stage_ != STAGE_WAITING_FOR_CREDENTIALS) { |
| 264 AbortWithError(PAIRING_ERROR_PAIRING_OR_ENROLLMENT, kErrorInvalidProtocol); | 264 AbortWithError(PAIRING_ERROR_PAIRING_OR_ENROLLMENT, kErrorInvalidProtocol); |
| 265 return; | 265 return; |
| 266 } | 266 } |
| 267 | 267 |
| 268 ChangeStage(STAGE_ENROLLING); | 268 ChangeStage(STAGE_ENROLLING); |
| 269 // TODO(zork,achuith): Enroll device, send error on error. | |
| 270 // (http://crbug.com/374990) | |
| 271 // For now, test domain is sent in the access token. | |
| 272 FOR_EACH_OBSERVER(Observer, observers_, | 269 FOR_EACH_OBSERVER(Observer, observers_, |
| 273 EnrollHost(message.parameters().admin_access_token())); | 270 EnrollHost(message.parameters().admin_access_token())); |
| 274 } | 271 } |
| 275 | 272 |
| 276 void BluetoothHostPairingController::SetEnrollmentComplete(bool success) { | 273 void BluetoothHostPairingController::SetEnrollmentComplete(bool success) { |
| 277 DCHECK_EQ(current_stage_, STAGE_ENROLLING); | 274 DCHECK_EQ(current_stage_, STAGE_ENROLLING); |
| 278 DCHECK(thread_checker_.CalledOnValidThread()); | 275 DCHECK(thread_checker_.CalledOnValidThread()); |
| 279 if (success) { | 276 if (success) { |
| 280 ChangeStage(STAGE_PAIRING_DONE); | 277 ChangeStage(STAGE_PAIRING_DONE); |
| 281 SendHostStatus(); | 278 SendHostStatus(); |
| (...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 385 ChangeStage(STAGE_WAITING_FOR_CODE_CONFIRMATION); | 382 ChangeStage(STAGE_WAITING_FOR_CODE_CONFIRMATION); |
| 386 } | 383 } |
| 387 | 384 |
| 388 void BluetoothHostPairingController::AuthorizePairing( | 385 void BluetoothHostPairingController::AuthorizePairing( |
| 389 device::BluetoothDevice* device) { | 386 device::BluetoothDevice* device) { |
| 390 // Disallow unknown device. | 387 // Disallow unknown device. |
| 391 device->RejectPairing(); | 388 device->RejectPairing(); |
| 392 } | 389 } |
| 393 | 390 |
| 394 } // namespace pairing_chromeos | 391 } // namespace pairing_chromeos |
| OLD | NEW |