| 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 "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/macros.h" | 10 #include "base/macros.h" |
| (...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 117 default_id = default_device; | 117 default_id = default_device; |
| 118 } | 118 } |
| 119 | 119 |
| 120 // Use the first device as the default device if the preferred default device | 120 // Use the first device as the default device if the preferred default device |
| 121 // does not exist in the OS. | 121 // does not exist in the OS. |
| 122 if (!devices.empty() && default_id.empty()) | 122 if (!devices.empty() && default_id.empty()) |
| 123 default_id = devices[0].id; | 123 default_id = devices[0].id; |
| 124 | 124 |
| 125 base::StringValue default_value(default_id); | 125 base::StringValue default_value(default_id); |
| 126 base::StringValue type_value(device_type); | 126 base::StringValue type_value(device_type); |
| 127 web_ui()->CallJavascriptFunction("ContentSettings.updateDevicesMenu", | 127 web_ui()->CallJavascriptFunctionUnsafe("ContentSettings.updateDevicesMenu", |
| 128 type_value, | 128 type_value, device_list, |
| 129 device_list, | 129 default_value); |
| 130 default_value); | |
| 131 } | 130 } |
| 132 | 131 |
| 133 void MediaDevicesSelectionHandler::UpdateDevicesMenuForType(DeviceType type) { | 132 void MediaDevicesSelectionHandler::UpdateDevicesMenuForType(DeviceType type) { |
| 134 content::MediaStreamDevices devices; | 133 content::MediaStreamDevices devices; |
| 135 switch (type) { | 134 switch (type) { |
| 136 case AUDIO: | 135 case AUDIO: |
| 137 devices = MediaCaptureDevicesDispatcher::GetInstance()-> | 136 devices = MediaCaptureDevicesDispatcher::GetInstance()-> |
| 138 GetAudioCaptureDevices(); | 137 GetAudioCaptureDevices(); |
| 139 break; | 138 break; |
| 140 case VIDEO: | 139 case VIDEO: |
| 141 devices = MediaCaptureDevicesDispatcher::GetInstance()-> | 140 devices = MediaCaptureDevicesDispatcher::GetInstance()-> |
| 142 GetVideoCaptureDevices(); | 141 GetVideoCaptureDevices(); |
| 143 break; | 142 break; |
| 144 } | 143 } |
| 145 | 144 |
| 146 UpdateDevicesMenu(type, devices); | 145 UpdateDevicesMenu(type, devices); |
| 147 } | 146 } |
| 148 | 147 |
| 149 } // namespace options | 148 } // namespace options |
| OLD | NEW |