Chromium Code Reviews| 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 "chromeos/dbus/biod_enroll_session_client.h" | |
| 6 | |
| 7 #include <stdint.h> | |
| 8 | |
| 9 #include "base/bind.h" | |
| 10 #include "base/macros.h" | |
| 11 #include "dbus/bus.h" | |
| 12 #include "dbus/message.h" | |
| 13 #include "dbus/object_path.h" | |
| 14 #include "dbus/object_proxy.h" | |
| 15 #include "third_party/cros_system_api/dbus/service_constants.h" | |
| 16 | |
| 17 namespace chromeos { | |
| 18 | |
| 19 // The BiodEnrollSessionClient implementation used in production. | |
| 20 class BiodEnrollSessionClientImpl : public BiodEnrollSessionClient { | |
| 21 public: | |
| 22 BiodEnrollSessionClientImpl() : weak_ptr_factory_(this) {} | |
| 23 | |
| 24 ~BiodEnrollSessionClientImpl() override {} | |
| 25 | |
| 26 void Cancel(const dbus::ObjectPath& enroll_session_path) override { | |
| 27 dbus::MethodCall method_call(biod::kEnrollSessionInterface, | |
| 28 biod::kEnrollSessionCancelMethod); | |
| 29 | |
| 30 dbus::ObjectProxy* enroll_session_proxy = | |
| 31 bus_->GetObjectProxy(biod::kBiodServiceName, enroll_session_path); | |
| 32 enroll_session_proxy->CallMethod( | |
| 33 &method_call, dbus::ObjectProxy::TIMEOUT_USE_DEFAULT, | |
| 34 dbus::ObjectProxy::EmptyResponseCallback()); | |
| 35 } | |
| 36 | |
| 37 protected: | |
| 38 void Init(dbus::Bus* bus) override { bus_ = bus; } | |
| 39 | |
| 40 private: | |
| 41 dbus::Bus* bus_; | |
| 42 | |
| 43 // Note: This should remain the last member so it'll be destroyed and | |
| 44 // invalidate its weak pointers before any other members are destroyed. | |
| 45 base::WeakPtrFactory<BiodEnrollSessionClientImpl> weak_ptr_factory_; | |
| 
 
stevenjb
2017/03/22 20:57:53
Unused?
 
sammiequon
2017/03/23 18:30:37
Done.
 
 | |
| 46 | |
| 47 DISALLOW_COPY_AND_ASSIGN(BiodEnrollSessionClientImpl); | |
| 48 }; | |
| 49 | |
| 50 BiodEnrollSessionClient::BiodEnrollSessionClient() {} | |
| 51 | |
| 52 BiodEnrollSessionClient::~BiodEnrollSessionClient() {} | |
| 53 | |
| 54 // static | |
| 55 BiodEnrollSessionClient* BiodEnrollSessionClient::Create( | |
| 56 DBusClientImplementationType /* type */) { | |
| 57 return new BiodEnrollSessionClientImpl(); | |
| 58 } | |
| 59 | |
| 60 } // namespace chromeos | |
| OLD | NEW |