| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 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/bluetooth_profile_manager_client.h" | 5 #include "chromeos/dbus/bluetooth_profile_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 "dbus/bus.h" | 9 #include "dbus/bus.h" |
| 10 #include "dbus/message.h" | 10 #include "dbus/message.h" |
| (...skipping 20 matching lines...) Expand all Loading... |
| 31 BluetoothProfileManagerClientImpl() : weak_ptr_factory_(this) {} | 31 BluetoothProfileManagerClientImpl() : weak_ptr_factory_(this) {} |
| 32 | 32 |
| 33 virtual ~BluetoothProfileManagerClientImpl() { | 33 virtual ~BluetoothProfileManagerClientImpl() { |
| 34 } | 34 } |
| 35 | 35 |
| 36 // BluetoothProfileManagerClient override. | 36 // BluetoothProfileManagerClient override. |
| 37 virtual void RegisterProfile(const dbus::ObjectPath& profile_path, | 37 virtual void RegisterProfile(const dbus::ObjectPath& profile_path, |
| 38 const std::string& uuid, | 38 const std::string& uuid, |
| 39 const Options& options, | 39 const Options& options, |
| 40 const base::Closure& callback, | 40 const base::Closure& callback, |
| 41 const ErrorCallback& error_callback) OVERRIDE { | 41 const ErrorCallback& error_callback) override { |
| 42 dbus::MethodCall method_call( | 42 dbus::MethodCall method_call( |
| 43 bluetooth_profile_manager::kBluetoothProfileManagerInterface, | 43 bluetooth_profile_manager::kBluetoothProfileManagerInterface, |
| 44 bluetooth_profile_manager::kRegisterProfile); | 44 bluetooth_profile_manager::kRegisterProfile); |
| 45 | 45 |
| 46 dbus::MessageWriter writer(&method_call); | 46 dbus::MessageWriter writer(&method_call); |
| 47 writer.AppendObjectPath(profile_path); | 47 writer.AppendObjectPath(profile_path); |
| 48 writer.AppendString(uuid); | 48 writer.AppendString(uuid); |
| 49 | 49 |
| 50 dbus::MessageWriter array_writer(NULL); | 50 dbus::MessageWriter array_writer(NULL); |
| 51 writer.OpenArray("{sv}", &array_writer); | 51 writer.OpenArray("{sv}", &array_writer); |
| (...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 164 dbus::ObjectProxy::TIMEOUT_USE_DEFAULT, | 164 dbus::ObjectProxy::TIMEOUT_USE_DEFAULT, |
| 165 base::Bind(&BluetoothProfileManagerClientImpl::OnSuccess, | 165 base::Bind(&BluetoothProfileManagerClientImpl::OnSuccess, |
| 166 weak_ptr_factory_.GetWeakPtr(), callback), | 166 weak_ptr_factory_.GetWeakPtr(), callback), |
| 167 base::Bind(&BluetoothProfileManagerClientImpl::OnError, | 167 base::Bind(&BluetoothProfileManagerClientImpl::OnError, |
| 168 weak_ptr_factory_.GetWeakPtr(), error_callback)); | 168 weak_ptr_factory_.GetWeakPtr(), error_callback)); |
| 169 } | 169 } |
| 170 | 170 |
| 171 // BluetoothProfileManagerClient override. | 171 // BluetoothProfileManagerClient override. |
| 172 virtual void UnregisterProfile(const dbus::ObjectPath& profile_path, | 172 virtual void UnregisterProfile(const dbus::ObjectPath& profile_path, |
| 173 const base::Closure& callback, | 173 const base::Closure& callback, |
| 174 const ErrorCallback& error_callback) OVERRIDE { | 174 const ErrorCallback& error_callback) override { |
| 175 dbus::MethodCall method_call( | 175 dbus::MethodCall method_call( |
| 176 bluetooth_profile_manager::kBluetoothProfileManagerInterface, | 176 bluetooth_profile_manager::kBluetoothProfileManagerInterface, |
| 177 bluetooth_profile_manager::kUnregisterProfile); | 177 bluetooth_profile_manager::kUnregisterProfile); |
| 178 | 178 |
| 179 dbus::MessageWriter writer(&method_call); | 179 dbus::MessageWriter writer(&method_call); |
| 180 writer.AppendObjectPath(profile_path); | 180 writer.AppendObjectPath(profile_path); |
| 181 | 181 |
| 182 object_proxy_->CallMethodWithErrorCallback( | 182 object_proxy_->CallMethodWithErrorCallback( |
| 183 &method_call, | 183 &method_call, |
| 184 dbus::ObjectProxy::TIMEOUT_USE_DEFAULT, | 184 dbus::ObjectProxy::TIMEOUT_USE_DEFAULT, |
| 185 base::Bind(&BluetoothProfileManagerClientImpl::OnSuccess, | 185 base::Bind(&BluetoothProfileManagerClientImpl::OnSuccess, |
| 186 weak_ptr_factory_.GetWeakPtr(), callback), | 186 weak_ptr_factory_.GetWeakPtr(), callback), |
| 187 base::Bind(&BluetoothProfileManagerClientImpl::OnError, | 187 base::Bind(&BluetoothProfileManagerClientImpl::OnError, |
| 188 weak_ptr_factory_.GetWeakPtr(), error_callback)); | 188 weak_ptr_factory_.GetWeakPtr(), error_callback)); |
| 189 } | 189 } |
| 190 | 190 |
| 191 protected: | 191 protected: |
| 192 virtual void Init(dbus::Bus* bus) OVERRIDE { | 192 virtual void Init(dbus::Bus* bus) override { |
| 193 DCHECK(bus); | 193 DCHECK(bus); |
| 194 object_proxy_ = bus->GetObjectProxy( | 194 object_proxy_ = bus->GetObjectProxy( |
| 195 bluetooth_profile_manager::kBluetoothProfileManagerServiceName, | 195 bluetooth_profile_manager::kBluetoothProfileManagerServiceName, |
| 196 dbus::ObjectPath( | 196 dbus::ObjectPath( |
| 197 bluetooth_profile_manager::kBluetoothProfileManagerServicePath)); | 197 bluetooth_profile_manager::kBluetoothProfileManagerServicePath)); |
| 198 } | 198 } |
| 199 | 199 |
| 200 private: | 200 private: |
| 201 // Called when a response for successful method call is received. | 201 // Called when a response for successful method call is received. |
| 202 void OnSuccess(const base::Closure& callback, | 202 void OnSuccess(const base::Closure& callback, |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 237 } | 237 } |
| 238 | 238 |
| 239 BluetoothProfileManagerClient::~BluetoothProfileManagerClient() { | 239 BluetoothProfileManagerClient::~BluetoothProfileManagerClient() { |
| 240 } | 240 } |
| 241 | 241 |
| 242 BluetoothProfileManagerClient* BluetoothProfileManagerClient::Create() { | 242 BluetoothProfileManagerClient* BluetoothProfileManagerClient::Create() { |
| 243 return new BluetoothProfileManagerClientImpl(); | 243 return new BluetoothProfileManagerClientImpl(); |
| 244 } | 244 } |
| 245 | 245 |
| 246 } // namespace chromeos | 246 } // namespace chromeos |
| OLD | NEW |