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_auth_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 BiodAuthSessionClient implementation used in production. | |
20 class BiodAuthSessionClientImpl : public BiodAuthSessionClient { | |
21 public: | |
22 BiodAuthSessionClientImpl() : weak_ptr_factory_(this) {} | |
23 | |
24 ~BiodAuthSessionClientImpl() override {} | |
25 | |
26 void End(const dbus::ObjectPath& auth_session_path) override { | |
27 dbus::MethodCall method_call(biod::kAuthSessionInterface, | |
28 biod::kAuthSessionEndMethod); | |
29 | |
30 dbus::ObjectProxy* auth_session_proxy = | |
31 bus_->GetObjectProxy(biod::kBiodServiceName, auth_session_path); | |
32 auth_session_proxy->CallMethod(&method_call, | |
33 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<BiodAuthSessionClientImpl> 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(BiodAuthSessionClientImpl); | |
48 }; | |
49 | |
50 BiodAuthSessionClient::BiodAuthSessionClient() {} | |
51 | |
52 BiodAuthSessionClient::~BiodAuthSessionClient() {} | |
53 | |
54 // static | |
55 BiodAuthSessionClient* BiodAuthSessionClient::Create( | |
56 DBusClientImplementationType /* type */) { | |
57 return new BiodAuthSessionClientImpl(); | |
58 } | |
59 | |
60 } // namespace chromeos | |
OLD | NEW |