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

Unified Diff: chrome/browser/chromeos/audio/audio_devices_pref_handler_impl.cc

Issue 803303002: Fix special character handling in audio preferences. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/chromeos/audio/audio_devices_pref_handler_impl.cc
diff --git a/chrome/browser/chromeos/audio/audio_devices_pref_handler_impl.cc b/chrome/browser/chromeos/audio/audio_devices_pref_handler_impl.cc
index 122be10aae7f5314ff10de0cca78dde821f93dc9..a185dfa7ae42300f1a0cf1447f0f3e8ea1a59ad5 100644
--- a/chrome/browser/chromeos/audio/audio_devices_pref_handler_impl.cc
+++ b/chrome/browser/chromeos/audio/audio_devices_pref_handler_impl.cc
@@ -33,9 +33,14 @@ const int kPrefMuteOn = 1;
// parts of the string could be identical, only the last part will differentiate
// them.
std::string GetDeviceIdString(const chromeos::AudioDevice& device) {
- return device.device_name + " : " +
- base::Uint64ToString(device.id & static_cast<uint64>(0xffffffff)) +
- " : " + (device.is_input ? "1" : "0");
+ std::string device_id_string =
+ device.device_name + " : " +
+ base::Uint64ToString(device.id & static_cast<uint64>(0xffffffff)) +
+ " : " + (device.is_input ? "1" : "0");
+ // Replace any periods from the device id string with a space, since setting
+ // names cannot contain periods.
+ std::replace(device_id_string.begin(), device_id_string.end(), '.', ' ');
+ return device_id_string;
}
} // namespace
@@ -114,6 +119,8 @@ double AudioDevicesPrefHandlerImpl::GetVolumeGainPrefValue(
// cras has added support for normalizing input gain range.
double value = device.is_input ?
0.0 : GetDeviceDefaultOutputVolume(device);
+ // TODO(rkc): The above code is completely ignored since we 'always' have a
+ // default pref value. Fix this. http://crbug.com/442489
device_volume_settings_->GetDouble(device_id_str, &value);
return value;
@@ -139,7 +146,7 @@ AudioDevicesPrefHandlerImpl::AudioDevicesPrefHandlerImpl(
}
AudioDevicesPrefHandlerImpl::~AudioDevicesPrefHandlerImpl() {
-};
+}
void AudioDevicesPrefHandlerImpl::InitializePrefObservers() {
pref_change_registrar_.Init(local_state_);

Powered by Google App Engine
This is Rietveld 408576698