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

Unified Diff: chromeos/dbus/biod_auth_session_client.cc

Issue 2581403002: cros: Remaining interfaces for DBUS biometrics client. (Closed)
Patch Set: Rebased. Created 3 years, 9 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: chromeos/dbus/biod_auth_session_client.cc
diff --git a/chromeos/dbus/biod_auth_session_client.cc b/chromeos/dbus/biod_auth_session_client.cc
new file mode 100644
index 0000000000000000000000000000000000000000..98f9070239e3fc9b2d94e3c6e4139174d777963e
--- /dev/null
+++ b/chromeos/dbus/biod_auth_session_client.cc
@@ -0,0 +1,60 @@
+// 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 "chromeos/dbus/biod_auth_session_client.h"
+
+#include <stdint.h>
+
+#include "base/bind.h"
+#include "base/macros.h"
+#include "dbus/bus.h"
+#include "dbus/message.h"
+#include "dbus/object_path.h"
+#include "dbus/object_proxy.h"
+#include "third_party/cros_system_api/dbus/service_constants.h"
+
+namespace chromeos {
+
+// The BiodAuthSessionClient implementation used in production.
+class BiodAuthSessionClientImpl : public BiodAuthSessionClient {
+ public:
+ BiodAuthSessionClientImpl() : weak_ptr_factory_(this) {}
+
+ ~BiodAuthSessionClientImpl() override {}
+
+ void End(const dbus::ObjectPath& auth_session_path) override {
+ dbus::MethodCall method_call(biod::kAuthSessionInterface,
+ biod::kAuthSessionEndMethod);
+
+ dbus::ObjectProxy* auth_session_proxy =
+ bus_->GetObjectProxy(biod::kBiodServiceName, auth_session_path);
+ auth_session_proxy->CallMethod(&method_call,
+ dbus::ObjectProxy::TIMEOUT_USE_DEFAULT,
+ dbus::ObjectProxy::EmptyResponseCallback());
+ }
+
+ protected:
+ void Init(dbus::Bus* bus) override { bus_ = bus; }
+
+ private:
+ dbus::Bus* bus_;
+
+ // Note: This should remain the last member so it'll be destroyed and
+ // invalidate its weak pointers before any other members are destroyed.
+ base::WeakPtrFactory<BiodAuthSessionClientImpl> weak_ptr_factory_;
stevenjb 2017/03/22 20:57:53 Unused?
sammiequon 2017/03/23 18:30:37 Done.
+
+ DISALLOW_COPY_AND_ASSIGN(BiodAuthSessionClientImpl);
+};
+
+BiodAuthSessionClient::BiodAuthSessionClient() {}
+
+BiodAuthSessionClient::~BiodAuthSessionClient() {}
+
+// static
+BiodAuthSessionClient* BiodAuthSessionClient::Create(
+ DBusClientImplementationType /* type */) {
+ return new BiodAuthSessionClientImpl();
+}
+
+} // namespace chromeos

Powered by Google App Engine
This is Rietveld 408576698