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/cras_audio_client.h" | 5 #include "chromeos/dbus/cras_audio_client.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/format_macros.h" | 8 #include "base/format_macros.h" |
9 #include "base/strings/stringprintf.h" | 9 #include "base/strings/stringprintf.h" |
10 #include "chromeos/dbus/cras_audio_client_stub_impl.h" | 10 #include "chromeos/dbus/cras_audio_client_stub_impl.h" |
(...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
167 virtual void RemoveActiveOutputNode(uint64 node_id) OVERRIDE { | 167 virtual void RemoveActiveOutputNode(uint64 node_id) OVERRIDE { |
168 dbus::MethodCall method_call(cras::kCrasControlInterface, | 168 dbus::MethodCall method_call(cras::kCrasControlInterface, |
169 cras::kRemoveActiveOutputNode); | 169 cras::kRemoveActiveOutputNode); |
170 dbus::MessageWriter writer(&method_call); | 170 dbus::MessageWriter writer(&method_call); |
171 writer.AppendUint64(node_id); | 171 writer.AppendUint64(node_id); |
172 cras_proxy_->CallMethod(&method_call, | 172 cras_proxy_->CallMethod(&method_call, |
173 dbus::ObjectProxy::TIMEOUT_USE_DEFAULT, | 173 dbus::ObjectProxy::TIMEOUT_USE_DEFAULT, |
174 dbus::ObjectProxy::EmptyResponseCallback()); | 174 dbus::ObjectProxy::EmptyResponseCallback()); |
175 } | 175 } |
176 | 176 |
| 177 virtual void SwapLeftRight(uint64 node_id, bool swap) OVERRIDE { |
| 178 dbus::MethodCall method_call(cras::kCrasControlInterface, |
| 179 cras::kSwapLeftRight); |
| 180 dbus::MessageWriter writer(&method_call); |
| 181 writer.AppendUint64(node_id); |
| 182 writer.AppendBool(swap); |
| 183 cras_proxy_->CallMethod(&method_call, |
| 184 dbus::ObjectProxy::TIMEOUT_USE_DEFAULT, |
| 185 dbus::ObjectProxy::EmptyResponseCallback()); |
| 186 } |
| 187 |
177 protected: | 188 protected: |
178 virtual void Init(dbus::Bus* bus) OVERRIDE { | 189 virtual void Init(dbus::Bus* bus) OVERRIDE { |
179 cras_proxy_ = bus->GetObjectProxy(cras::kCrasServiceName, | 190 cras_proxy_ = bus->GetObjectProxy(cras::kCrasServiceName, |
180 dbus::ObjectPath(cras::kCrasServicePath)); | 191 dbus::ObjectPath(cras::kCrasServicePath)); |
181 | 192 |
182 // Monitor NameOwnerChanged signal. | 193 // Monitor NameOwnerChanged signal. |
183 cras_proxy_->SetNameOwnerChangedCallback( | 194 cras_proxy_->SetNameOwnerChangedCallback( |
184 base::Bind(&CrasAudioClientImpl::NameOwnerChangedReceived, | 195 base::Bind(&CrasAudioClientImpl::NameOwnerChangedReceived, |
185 weak_ptr_factory_.GetWeakPtr())); | 196 weak_ptr_factory_.GetWeakPtr())); |
186 | 197 |
(...skipping 254 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
441 | 452 |
442 CrasAudioClient::~CrasAudioClient() { | 453 CrasAudioClient::~CrasAudioClient() { |
443 } | 454 } |
444 | 455 |
445 // static | 456 // static |
446 CrasAudioClient* CrasAudioClient::Create() { | 457 CrasAudioClient* CrasAudioClient::Create() { |
447 return new CrasAudioClientImpl(); | 458 return new CrasAudioClientImpl(); |
448 } | 459 } |
449 | 460 |
450 } // namespace chromeos | 461 } // namespace chromeos |
OLD | NEW |