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

Side by Side Diff: chromeos/audio/audio_device.cc

Issue 1380103003: Store audio device's active state in preference (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix string format Created 4 years, 11 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/audio/audio_device.h ('k') | chromeos/audio/audio_devices_pref_handler.h » ('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/audio/audio_device.h" 5 #include "chromeos/audio/audio_device.h"
6 6
7 #include <stdint.h> 7 #include <stdint.h>
8 8
9 #include "base/format_macros.h" 9 #include "base/format_macros.h"
10 #include "base/strings/string_number_conversions.h" 10 #include "base/strings/string_number_conversions.h"
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
102 return AUDIO_TYPE_POST_MIX_LOOPBACK; 102 return AUDIO_TYPE_POST_MIX_LOOPBACK;
103 else if (node_type.find("POST_DSP_LOOPBACK") != std::string::npos) 103 else if (node_type.find("POST_DSP_LOOPBACK") != std::string::npos)
104 return AUDIO_TYPE_POST_DSP_LOOPBACK; 104 return AUDIO_TYPE_POST_DSP_LOOPBACK;
105 else 105 else
106 return AUDIO_TYPE_OTHER; 106 return AUDIO_TYPE_OTHER;
107 } 107 }
108 108
109 AudioDevice::AudioDevice() 109 AudioDevice::AudioDevice()
110 : is_input(false), 110 : is_input(false),
111 id(0), 111 id(0),
112 stable_device_id(0),
112 display_name(""), 113 display_name(""),
113 type(AUDIO_TYPE_OTHER), 114 type(AUDIO_TYPE_OTHER),
114 priority(0), 115 priority(0),
115 active(false), 116 active(false),
116 plugged_time(0) { 117 plugged_time(0) {}
117 }
118 118
119 AudioDevice::AudioDevice(const AudioNode& node) { 119 AudioDevice::AudioDevice(const AudioNode& node) {
120 is_input = node.is_input; 120 is_input = node.is_input;
121 id = node.id; 121 id = node.id;
122 stable_device_id = node.stable_device_id;
122 type = GetAudioType(node.type); 123 type = GetAudioType(node.type);
123 if (!node.name.empty() && node.name != "(default)") 124 if (!node.name.empty() && node.name != "(default)")
124 display_name = node.name; 125 display_name = node.name;
125 else 126 else
126 display_name = node.device_name; 127 display_name = node.device_name;
127 device_name = node.device_name; 128 device_name = node.device_name;
128 mic_positions = node.mic_positions; 129 mic_positions = node.mic_positions;
129 priority = GetDevicePriority(type, node.is_input); 130 priority = GetDevicePriority(type, node.is_input);
130 active = node.active; 131 active = node.active;
131 plugged_time = node.plugged_time; 132 plugged_time = node.plugged_time;
132 } 133 }
133 134
134 std::string AudioDevice::ToString() const { 135 std::string AudioDevice::ToString() const {
135 std::string result; 136 std::string result;
136 base::StringAppendF(&result, 137 base::StringAppendF(&result,
137 "is_input = %s ", 138 "is_input = %s ",
138 is_input ? "true" : "false"); 139 is_input ? "true" : "false");
139 base::StringAppendF(&result, 140 base::StringAppendF(&result,
140 "id = 0x%" PRIx64 " ", 141 "id = 0x%" PRIx64 " ",
141 id); 142 id);
142 base::StringAppendF(&result, 143 base::StringAppendF(&result,
144 "stable_device_id = 0x%" PRIx64 " ",
145 stable_device_id);
146 base::StringAppendF(&result,
143 "display_name = %s ", 147 "display_name = %s ",
144 display_name.c_str()); 148 display_name.c_str());
145 base::StringAppendF(&result, 149 base::StringAppendF(&result,
146 "device_name = %s ", 150 "device_name = %s ",
147 device_name.c_str()); 151 device_name.c_str());
148 base::StringAppendF(&result, 152 base::StringAppendF(&result,
149 "type = %s ", 153 "type = %s ",
150 GetTypeString(type).c_str()); 154 GetTypeString(type).c_str());
151 base::StringAppendF(&result, 155 base::StringAppendF(&result,
152 "active = %s ", 156 "active = %s ",
153 active ? "true" : "false"); 157 active ? "true" : "false");
154 base::StringAppendF(&result, 158 base::StringAppendF(&result,
155 "plugged_time= %s ", 159 "plugged_time= %s ",
156 base::Uint64ToString(plugged_time).c_str()); 160 base::Uint64ToString(plugged_time).c_str());
157 base::StringAppendF(&result, "mic_positions = %s ", mic_positions.c_str()); 161 base::StringAppendF(&result, "mic_positions = %s ", mic_positions.c_str());
158 162
159 return result; 163 return result;
160 } 164 }
161 165
162 } // namespace chromeos 166 } // namespace chromeos
OLDNEW
« no previous file with comments | « chromeos/audio/audio_device.h ('k') | chromeos/audio/audio_devices_pref_handler.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698