Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(80)

Side by Side Diff: chromeos/dbus/fake_cras_audio_client.cc

Issue 1746843002: Persist the user's active audio device choice across chromeos session and reboots. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix nits. Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « chromeos/dbus/fake_cras_audio_client.h ('k') | extensions/browser/api/audio/audio_apitest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/fake_cras_audio_client.h" 5 #include "chromeos/dbus/fake_cras_audio_client.h"
6 6
7 namespace chromeos { 7 namespace chromeos {
8 8
9 FakeCrasAudioClient::FakeCrasAudioClient() 9 FakeCrasAudioClient::FakeCrasAudioClient()
10 : active_input_node_id_(0), 10 : active_input_node_id_(0),
(...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after
167 167
168 void FakeCrasAudioClient::SwapLeftRight(uint64_t node_id, bool swap) {} 168 void FakeCrasAudioClient::SwapLeftRight(uint64_t node_id, bool swap) {}
169 169
170 void FakeCrasAudioClient::AddActiveOutputNode(uint64_t node_id) { 170 void FakeCrasAudioClient::AddActiveOutputNode(uint64_t node_id) {
171 for (size_t i = 0; i < node_list_.size(); ++i) { 171 for (size_t i = 0; i < node_list_.size(); ++i) {
172 if (node_list_[i].id == node_id) 172 if (node_list_[i].id == node_id)
173 node_list_[i].active = true; 173 node_list_[i].active = true;
174 } 174 }
175 } 175 }
176 176
177 void FakeCrasAudioClient::WaitForServiceToBeAvailable(
178 const WaitForServiceToBeAvailableCallback& callback) {
179 callback.Run(true);
180 }
181
177 void FakeCrasAudioClient::RemoveActiveOutputNode(uint64_t node_id) { 182 void FakeCrasAudioClient::RemoveActiveOutputNode(uint64_t node_id) {
178 for (size_t i = 0; i < node_list_.size(); ++i) { 183 for (size_t i = 0; i < node_list_.size(); ++i) {
179 if (node_list_[i].id == node_id) 184 if (node_list_[i].id == node_id)
180 node_list_[i].active = false; 185 node_list_[i].active = false;
181 } 186 }
182 } 187 }
183 188
184 void FakeCrasAudioClient::InsertAudioNodeToList(const AudioNode& audio_node) { 189 void FakeCrasAudioClient::InsertAudioNodeToList(const AudioNode& audio_node) {
185 auto iter = FindNode(audio_node.id); 190 auto iter = FindNode(audio_node.id);
186 if (iter != node_list_.end()) 191 if (iter != node_list_.end())
(...skipping 22 matching lines...) Expand all
209 FOR_EACH_OBSERVER(Observer, observers_, NodesChanged()); 214 FOR_EACH_OBSERVER(Observer, observers_, NodesChanged());
210 } 215 }
211 216
212 AudioNodeList::iterator FakeCrasAudioClient::FindNode(uint64_t node_id) { 217 AudioNodeList::iterator FakeCrasAudioClient::FindNode(uint64_t node_id) {
213 return std::find_if( 218 return std::find_if(
214 node_list_.begin(), node_list_.end(), 219 node_list_.begin(), node_list_.end(),
215 [node_id](const AudioNode& node) { return node_id == node.id; }); 220 [node_id](const AudioNode& node) { return node_id == node.id; });
216 } 221 }
217 222
218 } // namespace chromeos 223 } // namespace chromeos
OLDNEW
« no previous file with comments | « chromeos/dbus/fake_cras_audio_client.h ('k') | extensions/browser/api/audio/audio_apitest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698