Chromium Code Reviews| Index: chrome/browser/ui/webui/settings/settings_media_devices_selection_handler.cc |
| diff --git a/chrome/browser/ui/webui/settings/settings_media_devices_selection_handler.cc b/chrome/browser/ui/webui/settings/settings_media_devices_selection_handler.cc |
| index 77f77fb20fcffcb1ac45d1868e8a942e0fc74bef..70c54c2a0d7d92d8b80f7bc6429bbc885bf54262 100644 |
| --- a/chrome/browser/ui/webui/settings/settings_media_devices_selection_handler.cc |
| +++ b/chrome/browser/ui/webui/settings/settings_media_devices_selection_handler.cc |
| @@ -14,6 +14,8 @@ |
| #include "chrome/browser/profiles/profile.h" |
| #include "chrome/common/pref_names.h" |
| #include "components/prefs/pref_service.h" |
| +#include "extensions/strings/grit/extensions_strings.h" |
| +#include "ui/base/l10n/l10n_util.h" |
| namespace { |
| @@ -120,7 +122,7 @@ void MediaDevicesSelectionHandler::UpdateDevicesMenu( |
| base::ListValue device_list; |
| for (size_t i = 0; i < devices.size(); ++i) { |
| std::unique_ptr<base::DictionaryValue> entry(new base::DictionaryValue()); |
| - entry->SetString("name", devices[i].name); |
| + entry->SetString("name", GetDeviceDisplayName(devices[i])); |
| entry->SetString("id", devices[i].id); |
| device_list.Append(std::move(entry)); |
| if (devices[i].id == default_device) |
| @@ -141,6 +143,26 @@ void MediaDevicesSelectionHandler::UpdateDevicesMenu( |
| default_value); |
| } |
| +std::string MediaDevicesSelectionHandler::GetDeviceDisplayName( |
| + const content::MediaStreamDevice& device) { |
| + std::string facing_info; |
| + switch (device.video_facing) { |
| + case media::VideoFacingMode::MEDIA_VIDEO_FACING_USER: |
| + facing_info = l10n_util::GetStringUTF8(IDS_CAMERA_FACING_USER); |
| + break; |
| + case media::VideoFacingMode::MEDIA_VIDEO_FACING_ENVIRONMENT: |
| + facing_info = l10n_util::GetStringUTF8(IDS_CAMERA_FACING_ENVIRONMENT); |
| + break; |
| + case media::VideoFacingMode::MEDIA_VIDEO_FACING_NONE: |
| + case media::VideoFacingMode::NUM_MEDIA_VIDEO_FACING_MODES: |
| + break; |
|
mtomasz
2017/03/02 07:49:53
ditto
shenghao
2017/03/02 12:43:41
Done.
|
| + } |
| + |
| + if (facing_info.empty()) |
|
mtomasz
2017/03/02 07:49:53
ditto
mtomasz
2017/03/02 07:49:53
This string will never be empty. Can we have a DCH
shenghao
2017/03/02 12:43:41
It would be empty in the MEDIA_VIDEO_FACING_NONE c
|
| + return device.name; |
| + return device.name + " (" + facing_info + ")"; |
|
mtomasz
2017/03/02 07:49:53
ditto
shenghao
2017/03/02 12:43:41
Done.
|
| +} |
| + |
| void MediaDevicesSelectionHandler::UpdateDevicesMenuForType(DeviceType type) { |
| content::MediaStreamDevices devices; |
| switch (type) { |