OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "chromeos/dbus/introspectable_client.h" | 5 #include "chromeos/dbus/introspectable_client.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 22 matching lines...) Expand all Loading... |
33 class IntrospectableClientImpl : public IntrospectableClient { | 33 class IntrospectableClientImpl : public IntrospectableClient { |
34 public: | 34 public: |
35 IntrospectableClientImpl() : bus_(NULL), weak_ptr_factory_(this) {} | 35 IntrospectableClientImpl() : bus_(NULL), weak_ptr_factory_(this) {} |
36 | 36 |
37 virtual ~IntrospectableClientImpl() { | 37 virtual ~IntrospectableClientImpl() { |
38 } | 38 } |
39 | 39 |
40 // IntrospectableClient override. | 40 // IntrospectableClient override. |
41 virtual void Introspect(const std::string& service_name, | 41 virtual void Introspect(const std::string& service_name, |
42 const dbus::ObjectPath& object_path, | 42 const dbus::ObjectPath& object_path, |
43 const IntrospectCallback& callback) OVERRIDE { | 43 const IntrospectCallback& callback) override { |
44 dbus::MethodCall method_call(kIntrospectableInterface, kIntrospect); | 44 dbus::MethodCall method_call(kIntrospectableInterface, kIntrospect); |
45 | 45 |
46 dbus::ObjectProxy* object_proxy = bus_->GetObjectProxy(service_name, | 46 dbus::ObjectProxy* object_proxy = bus_->GetObjectProxy(service_name, |
47 object_path); | 47 object_path); |
48 | 48 |
49 object_proxy->CallMethod( | 49 object_proxy->CallMethod( |
50 &method_call, | 50 &method_call, |
51 dbus::ObjectProxy::TIMEOUT_USE_DEFAULT, | 51 dbus::ObjectProxy::TIMEOUT_USE_DEFAULT, |
52 base::Bind(&IntrospectableClientImpl::OnIntrospect, | 52 base::Bind(&IntrospectableClientImpl::OnIntrospect, |
53 weak_ptr_factory_.GetWeakPtr(), | 53 weak_ptr_factory_.GetWeakPtr(), |
54 service_name, object_path, callback)); | 54 service_name, object_path, callback)); |
55 } | 55 } |
56 | 56 |
57 protected: | 57 protected: |
58 virtual void Init(dbus::Bus* bus) OVERRIDE { bus_ = bus; } | 58 virtual void Init(dbus::Bus* bus) override { bus_ = bus; } |
59 | 59 |
60 private: | 60 private: |
61 // Called by dbus:: when a response for Introspect() is recieved. | 61 // Called by dbus:: when a response for Introspect() is recieved. |
62 void OnIntrospect(const std::string& service_name, | 62 void OnIntrospect(const std::string& service_name, |
63 const dbus::ObjectPath& object_path, | 63 const dbus::ObjectPath& object_path, |
64 const IntrospectCallback& callback, | 64 const IntrospectCallback& callback, |
65 dbus::Response* response) { | 65 dbus::Response* response) { |
66 // Parse response. | 66 // Parse response. |
67 bool success = false; | 67 bool success = false; |
68 std::string xml_data; | 68 std::string xml_data; |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
129 | 129 |
130 return interfaces; | 130 return interfaces; |
131 } | 131 } |
132 | 132 |
133 // static | 133 // static |
134 IntrospectableClient* IntrospectableClient::Create() { | 134 IntrospectableClient* IntrospectableClient::Create() { |
135 return new IntrospectableClientImpl(); | 135 return new IntrospectableClientImpl(); |
136 } | 136 } |
137 | 137 |
138 } // namespace chromeos | 138 } // namespace chromeos |
OLD | NEW |