Add owners for offlinepages
[chromium-blink-merge.git] / components / pairing / shark_connection_listener.cc
bloba6bc655f69512d18c444d60f6a3629b0f84bce1a
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
3 // found in the LICENSE file.
5 #include "components/pairing/shark_connection_listener.h"
7 #include "base/logging.h"
8 #include "base/threading/thread_restrictions.h"
9 #include "components/pairing/bluetooth_host_pairing_controller.h"
11 namespace pairing_chromeos {
13 SharkConnectionListener::SharkConnectionListener(OnConnectedCallback callback)
14 : callback_(callback) {
15 controller_.reset(new BluetoothHostPairingController());
16 controller_->AddObserver(this);
17 controller_->StartPairing();
20 SharkConnectionListener::~SharkConnectionListener() {
21 if (controller_)
22 controller_->RemoveObserver(this);
25 void SharkConnectionListener::PairingStageChanged(Stage new_stage) {
26 if (new_stage == HostPairingController::STAGE_WAITING_FOR_CODE_CONFIRMATION) {
27 controller_->RemoveObserver(this);
28 callback_.Run(controller_.Pass());
29 callback_.Reset();
33 } // namespace pairing_chromeos