OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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/experimental_bluetooth_agent_manager_client.h" | 5 #include "chromeos/dbus/experimental_bluetooth_agent_manager_client.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/logging.h" | 8 #include "base/logging.h" |
| 9 #include "chromeos/dbus/fake_bluetooth_agent_manager_client.h" |
9 #include "dbus/bus.h" | 10 #include "dbus/bus.h" |
10 #include "dbus/message.h" | 11 #include "dbus/message.h" |
11 #include "dbus/object_path.h" | 12 #include "dbus/object_path.h" |
12 #include "dbus/object_proxy.h" | 13 #include "dbus/object_proxy.h" |
13 #include "third_party/cros_system_api/dbus/service_constants.h" | 14 #include "third_party/cros_system_api/dbus/service_constants.h" |
14 | 15 |
15 namespace chromeos { | 16 namespace chromeos { |
16 | 17 |
17 const char ExperimentalBluetoothAgentManagerClient::kNoResponseError[] = | 18 const char ExperimentalBluetoothAgentManagerClient::kNoResponseError[] = |
18 "org.chromium.Error.NoResponse"; | 19 "org.chromium.Error.NoResponse"; |
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
130 // Weak pointer factory for generating 'this' pointers that might live longer | 131 // Weak pointer factory for generating 'this' pointers that might live longer |
131 // than we do. | 132 // than we do. |
132 // Note: This should remain the last member so it'll be destroyed and | 133 // Note: This should remain the last member so it'll be destroyed and |
133 // invalidate its weak pointers before any other members are destroyed. | 134 // invalidate its weak pointers before any other members are destroyed. |
134 base::WeakPtrFactory<ExperimentalBluetoothAgentManagerClientImpl> | 135 base::WeakPtrFactory<ExperimentalBluetoothAgentManagerClientImpl> |
135 weak_ptr_factory_; | 136 weak_ptr_factory_; |
136 | 137 |
137 DISALLOW_COPY_AND_ASSIGN(ExperimentalBluetoothAgentManagerClientImpl); | 138 DISALLOW_COPY_AND_ASSIGN(ExperimentalBluetoothAgentManagerClientImpl); |
138 }; | 139 }; |
139 | 140 |
140 // The ExperimentalBluetoothAgentManagerClient implementation used on Linux | |
141 // desktop, which does nothing. | |
142 class ExperimentalBluetoothAgentManagerClientStubImpl | |
143 : public ExperimentalBluetoothAgentManagerClient { | |
144 public: | |
145 ExperimentalBluetoothAgentManagerClientStubImpl() { | |
146 } | |
147 | |
148 // ExperimentalBluetoothAgentManagerClient override. | |
149 virtual void RegisterAgent(const dbus::ObjectPath& agent_path, | |
150 const std::string& capability, | |
151 const base::Closure& callback, | |
152 const ErrorCallback& error_callback) OVERRIDE { | |
153 VLOG(1) << "RegisterAgent: " << agent_path.value(); | |
154 error_callback.Run(kNoResponseError, ""); | |
155 } | |
156 | |
157 // ExperimentalBluetoothAgentManagerClient override. | |
158 virtual void UnregisterAgent(const dbus::ObjectPath& agent_path, | |
159 const base::Closure& callback, | |
160 const ErrorCallback& error_callback) OVERRIDE { | |
161 VLOG(1) << "UnregisterAgent: " << agent_path.value(); | |
162 error_callback.Run(kNoResponseError, ""); | |
163 } | |
164 | |
165 // ExperimentalBluetoothAgentManagerClient override. | |
166 virtual void RequestDefaultAgent(const dbus::ObjectPath& agent_path, | |
167 const base::Closure& callback, | |
168 const ErrorCallback& error_callback) | |
169 OVERRIDE { | |
170 VLOG(1) << "RequestDefaultAgent: " << agent_path.value(); | |
171 error_callback.Run(kNoResponseError, ""); | |
172 } | |
173 }; | |
174 | |
175 ExperimentalBluetoothAgentManagerClient:: | 141 ExperimentalBluetoothAgentManagerClient:: |
176 ExperimentalBluetoothAgentManagerClient() { | 142 ExperimentalBluetoothAgentManagerClient() { |
177 } | 143 } |
178 | 144 |
179 ExperimentalBluetoothAgentManagerClient:: | 145 ExperimentalBluetoothAgentManagerClient:: |
180 ~ExperimentalBluetoothAgentManagerClient() { | 146 ~ExperimentalBluetoothAgentManagerClient() { |
181 } | 147 } |
182 | 148 |
183 ExperimentalBluetoothAgentManagerClient* | 149 ExperimentalBluetoothAgentManagerClient* |
184 ExperimentalBluetoothAgentManagerClient::Create( | 150 ExperimentalBluetoothAgentManagerClient::Create( |
185 DBusClientImplementationType type, | 151 DBusClientImplementationType type, |
186 dbus::Bus* bus) { | 152 dbus::Bus* bus) { |
187 if (type == REAL_DBUS_CLIENT_IMPLEMENTATION) | 153 if (type == REAL_DBUS_CLIENT_IMPLEMENTATION) |
188 return new ExperimentalBluetoothAgentManagerClientImpl(bus); | 154 return new ExperimentalBluetoothAgentManagerClientImpl(bus); |
189 DCHECK_EQ(STUB_DBUS_CLIENT_IMPLEMENTATION, type); | 155 DCHECK_EQ(STUB_DBUS_CLIENT_IMPLEMENTATION, type); |
190 return new ExperimentalBluetoothAgentManagerClientStubImpl(); | 156 return new FakeBluetoothAgentManagerClient(); |
191 } | 157 } |
192 | 158 |
193 } // namespace chromeos | 159 } // namespace chromeos |
OLD | NEW |