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

Unified Diff: device/bluetooth/discovery_session.cc

Issue 2564113003: bluetooth: Add basic scanning to chrome://bluetooth-internals. (Closed)
Patch Set: Update comments Created 3 years, 11 months 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 side-by-side diff with in-line comments
Download patch
Index: device/bluetooth/discovery_session.cc
diff --git a/device/bluetooth/discovery_session.cc b/device/bluetooth/discovery_session.cc
new file mode 100644
index 0000000000000000000000000000000000000000..0ecc1cf056e0fb2851be25fb1acd854d2eae1457
--- /dev/null
+++ b/device/bluetooth/discovery_session.cc
@@ -0,0 +1,35 @@
+// Copyright 2017 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "base/bind_helpers.h"
+#include "device/bluetooth/discovery_session.h"
+
+namespace bluetooth {
+DiscoverySession::DiscoverySession(
+ std::unique_ptr<device::BluetoothDiscoverySession> session)
+ : discovery_session_(std::move(session)), weak_ptr_factory_(this) {}
+
+DiscoverySession::~DiscoverySession() {}
+
+void DiscoverySession::IsActive(const IsActiveCallback& callback) {
+ callback.Run(discovery_session_->IsActive());
+}
+
+void DiscoverySession::Stop(const StopCallback& callback) {
+ discovery_session_->Stop(
+ base::Bind(&DiscoverySession::OnStop, weak_ptr_factory_.GetWeakPtr(),
+ callback),
+ base::Bind(&DiscoverySession::OnStopError, weak_ptr_factory_.GetWeakPtr(),
+ callback));
+}
+
+void DiscoverySession::OnStop(const StopCallback& callback) {
+ callback.Run(true /* success */);
+}
+
+void DiscoverySession::OnStopError(const StopCallback& callback) {
+ callback.Run(false /* success */);
+}
+
+} // namespace bluetooth

Powered by Google App Engine
This is Rietveld 408576698