| 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 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 147 dbus::MethodCall method_call(cras::kCrasControlInterface, | 147 dbus::MethodCall method_call(cras::kCrasControlInterface, |
| 148 cras::kRemoveActiveInputNode); | 148 cras::kRemoveActiveInputNode); |
| 149 dbus::MessageWriter writer(&method_call); | 149 dbus::MessageWriter writer(&method_call); |
| 150 writer.AppendUint64(node_id); | 150 writer.AppendUint64(node_id); |
| 151 cras_proxy_->CallMethod( | 151 cras_proxy_->CallMethod( |
| 152 &method_call, | 152 &method_call, |
| 153 dbus::ObjectProxy::TIMEOUT_USE_DEFAULT, | 153 dbus::ObjectProxy::TIMEOUT_USE_DEFAULT, |
| 154 dbus::ObjectProxy::EmptyResponseCallback()); | 154 dbus::ObjectProxy::EmptyResponseCallback()); |
| 155 } | 155 } |
| 156 | 156 |
| 157 virtual void AddActiveOutputNode(uint64 node_id) OVERRIDE { |
| 158 dbus::MethodCall method_call(cras::kCrasControlInterface, |
| 159 cras::kAddActiveOutputNode); |
| 160 dbus::MessageWriter writer(&method_call); |
| 161 writer.AppendUint64(node_id); |
| 162 cras_proxy_->CallMethod(&method_call, |
| 163 dbus::ObjectProxy::TIMEOUT_USE_DEFAULT, |
| 164 dbus::ObjectProxy::EmptyResponseCallback()); |
| 165 } |
| 166 |
| 167 virtual void RemoveActiveOutputNode(uint64 node_id) OVERRIDE { |
| 168 dbus::MethodCall method_call(cras::kCrasControlInterface, |
| 169 cras::kRemoveActiveOutputNode); |
| 170 dbus::MessageWriter writer(&method_call); |
| 171 writer.AppendUint64(node_id); |
| 172 cras_proxy_->CallMethod(&method_call, |
| 173 dbus::ObjectProxy::TIMEOUT_USE_DEFAULT, |
| 174 dbus::ObjectProxy::EmptyResponseCallback()); |
| 175 } |
| 176 |
| 157 protected: | 177 protected: |
| 158 virtual void Init(dbus::Bus* bus) OVERRIDE { | 178 virtual void Init(dbus::Bus* bus) OVERRIDE { |
| 159 cras_proxy_ = bus->GetObjectProxy(cras::kCrasServiceName, | 179 cras_proxy_ = bus->GetObjectProxy(cras::kCrasServiceName, |
| 160 dbus::ObjectPath(cras::kCrasServicePath)); | 180 dbus::ObjectPath(cras::kCrasServicePath)); |
| 161 | 181 |
| 162 // Monitor NameOwnerChanged signal. | 182 // Monitor NameOwnerChanged signal. |
| 163 cras_proxy_->SetNameOwnerChangedCallback( | 183 cras_proxy_->SetNameOwnerChangedCallback( |
| 164 base::Bind(&CrasAudioClientImpl::NameOwnerChangedReceived, | 184 base::Bind(&CrasAudioClientImpl::NameOwnerChangedReceived, |
| 165 weak_ptr_factory_.GetWeakPtr())); | 185 weak_ptr_factory_.GetWeakPtr())); |
| 166 | 186 |
| (...skipping 254 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 421 | 441 |
| 422 CrasAudioClient::~CrasAudioClient() { | 442 CrasAudioClient::~CrasAudioClient() { |
| 423 } | 443 } |
| 424 | 444 |
| 425 // static | 445 // static |
| 426 CrasAudioClient* CrasAudioClient::Create() { | 446 CrasAudioClient* CrasAudioClient::Create() { |
| 427 return new CrasAudioClientImpl(); | 447 return new CrasAudioClientImpl(); |
| 428 } | 448 } |
| 429 | 449 |
| 430 } // namespace chromeos | 450 } // namespace chromeos |
| OLD | NEW |