OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "chrome/browser/ui/webui/options/media_devices_selection_handler.h" | 5 #include "chrome/browser/ui/webui/options/media_devices_selection_handler.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include <memory> | 9 #include <memory> |
10 #include <utility> | 10 #include <utility> |
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
123 device_list.Append(std::move(entry)); | 123 device_list.Append(std::move(entry)); |
124 if (devices[i].id == default_device) | 124 if (devices[i].id == default_device) |
125 default_id = default_device; | 125 default_id = default_device; |
126 } | 126 } |
127 | 127 |
128 // Use the first device as the default device if the preferred default device | 128 // Use the first device as the default device if the preferred default device |
129 // does not exist in the OS. | 129 // does not exist in the OS. |
130 if (!devices.empty() && default_id.empty()) | 130 if (!devices.empty() && default_id.empty()) |
131 default_id = devices[0].id; | 131 default_id = devices[0].id; |
132 | 132 |
133 base::StringValue default_value(default_id); | 133 base::Value default_value(default_id); |
134 base::StringValue type_value(device_type); | 134 base::Value type_value(device_type); |
135 web_ui()->CallJavascriptFunctionUnsafe("ContentSettings.updateDevicesMenu", | 135 web_ui()->CallJavascriptFunctionUnsafe("ContentSettings.updateDevicesMenu", |
136 type_value, device_list, | 136 type_value, device_list, |
137 default_value); | 137 default_value); |
138 } | 138 } |
139 | 139 |
140 std::string MediaDevicesSelectionHandler::GetDeviceDisplayName( | 140 std::string MediaDevicesSelectionHandler::GetDeviceDisplayName( |
141 const content::MediaStreamDevice& device) const { | 141 const content::MediaStreamDevice& device) const { |
142 std::string facing_info; | 142 std::string facing_info; |
143 | 143 |
144 #if BUILDFLAG(ENABLE_EXTENSIONS) | 144 #if BUILDFLAG(ENABLE_EXTENSIONS) |
(...skipping 27 matching lines...) Expand all Loading... |
172 case VIDEO: | 172 case VIDEO: |
173 devices = MediaCaptureDevicesDispatcher::GetInstance()-> | 173 devices = MediaCaptureDevicesDispatcher::GetInstance()-> |
174 GetVideoCaptureDevices(); | 174 GetVideoCaptureDevices(); |
175 break; | 175 break; |
176 } | 176 } |
177 | 177 |
178 UpdateDevicesMenu(type, devices); | 178 UpdateDevicesMenu(type, devices); |
179 } | 179 } |
180 | 180 |
181 } // namespace options | 181 } // namespace options |
OLD | NEW |