OLD | NEW |
(Empty) | |
| 1 // Copyright 2017 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. |
| 4 |
| 5 #include "base/bind_helpers.h" |
| 6 #include "device/bluetooth/discovery_session.h" |
| 7 |
| 8 namespace bluetooth { |
| 9 DiscoverySession::DiscoverySession( |
| 10 std::unique_ptr<device::BluetoothDiscoverySession> session) |
| 11 : discovery_session_(std::move(session)), weak_ptr_factory_(this) {} |
| 12 |
| 13 DiscoverySession::~DiscoverySession() {} |
| 14 |
| 15 void DiscoverySession::IsActive(const IsActiveCallback& callback) { |
| 16 callback.Run(discovery_session_->IsActive()); |
| 17 } |
| 18 |
| 19 void DiscoverySession::Stop(const StopCallback& callback) { |
| 20 discovery_session_->Stop( |
| 21 base::Bind(&DiscoverySession::OnStop, weak_ptr_factory_.GetWeakPtr(), |
| 22 callback), |
| 23 base::Bind(&DiscoverySession::OnStopError, weak_ptr_factory_.GetWeakPtr(), |
| 24 callback)); |
| 25 } |
| 26 |
| 27 void DiscoverySession::OnStop(const StopCallback& callback) { |
| 28 callback.Run(true /* success */); |
| 29 } |
| 30 |
| 31 void DiscoverySession::OnStopError(const StopCallback& callback) { |
| 32 callback.Run(false /* success */); |
| 33 } |
| 34 |
| 35 } // namespace bluetooth |
OLD | NEW |