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

Side by Side Diff: chrome/browser/ui/webui/settings/settings_media_devices_selection_handler.cc

Issue 2886083002: MD Settings: Use FireWebUIListener() helper wherever possible. (Closed)
Patch Set: Fixed typo Created 3 years, 7 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
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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/settings/settings_media_devices_selection_hand ler.h" 5 #include "chrome/browser/ui/webui/settings/settings_media_devices_selection_hand ler.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 121 matching lines...) Expand 10 before | Expand all | Expand 10 after
132 default_id = default_device; 132 default_id = default_device;
133 } 133 }
134 134
135 // Use the first device as the default device if the preferred default device 135 // Use the first device as the default device if the preferred default device
136 // does not exist in the OS. 136 // does not exist in the OS.
137 if (!devices.empty() && default_id.empty()) 137 if (!devices.empty() && default_id.empty())
138 default_id = devices[0].id; 138 default_id = devices[0].id;
139 139
140 base::Value default_value(default_id); 140 base::Value default_value(default_id);
141 base::Value type_value(device_type); 141 base::Value type_value(device_type);
142 CallJavascriptFunction("cr.webUIListenerCallback", 142 FireWebUIListener("updateDevicesMenu", type_value, device_list,
143 base::Value("updateDevicesMenu"), type_value, 143 default_value);
144 device_list, default_value);
145 } 144 }
146 145
147 std::string MediaDevicesSelectionHandler::GetDeviceDisplayName( 146 std::string MediaDevicesSelectionHandler::GetDeviceDisplayName(
148 const content::MediaStreamDevice& device) const { 147 const content::MediaStreamDevice& device) const {
149 std::string facing_info; 148 std::string facing_info;
150 149
151 #if BUILDFLAG(ENABLE_EXTENSIONS) 150 #if BUILDFLAG(ENABLE_EXTENSIONS)
152 switch (device.video_facing) { 151 switch (device.video_facing) {
153 case media::VideoFacingMode::MEDIA_VIDEO_FACING_USER: 152 case media::VideoFacingMode::MEDIA_VIDEO_FACING_USER:
154 facing_info = l10n_util::GetStringUTF8(IDS_CAMERA_FACING_USER); 153 facing_info = l10n_util::GetStringUTF8(IDS_CAMERA_FACING_USER);
(...skipping 24 matching lines...) Expand all
179 case VIDEO: 178 case VIDEO:
180 devices = MediaCaptureDevicesDispatcher::GetInstance()-> 179 devices = MediaCaptureDevicesDispatcher::GetInstance()->
181 GetVideoCaptureDevices(); 180 GetVideoCaptureDevices();
182 break; 181 break;
183 } 182 }
184 183
185 UpdateDevicesMenu(type, devices); 184 UpdateDevicesMenu(type, devices);
186 } 185 }
187 186
188 } // namespace settings 187 } // namespace settings
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698