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

Side by Side Diff: chrome/browser/ui/webui/options/media_devices_selection_handler.cc

Issue 183743021: Implement MediaCaptureDevices. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 9 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 (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 "base/bind.h" 7 #include "base/bind.h"
8 #include "base/prefs/pref_service.h" 8 #include "base/prefs/pref_service.h"
9 #include "chrome/browser/profiles/profile.h" 9 #include "chrome/browser/profiles/profile.h"
10 #include "chrome/common/pref_names.h" 10 #include "chrome/common/pref_names.h"
11 11
12 namespace { 12 namespace {
13 13
14 const char kAudio[] = "mic"; 14 const char kAudio[] = "mic";
15 const char kVideo[] = "camera"; 15 const char kVideo[] = "camera";
16 16
17 } // namespace 17 } // namespace
18 18
19 namespace options { 19 namespace options {
20 20
21 MediaDevicesSelectionHandler::MediaDevicesSelectionHandler() {} 21 MediaDevicesSelectionHandler::MediaDevicesSelectionHandler() {}
22 22
23 MediaDevicesSelectionHandler::~MediaDevicesSelectionHandler() { 23 MediaDevicesSelectionHandler::~MediaDevicesSelectionHandler() {
24 MediaCaptureDevicesDispatcher::GetInstance()->RemoveObserver(this); 24 content::MediaCaptureDevices::GetInstance()->RemoveObserver(this);
25 } 25 }
26 26
27 void MediaDevicesSelectionHandler::GetLocalizedValues( 27 void MediaDevicesSelectionHandler::GetLocalizedValues(
28 base::DictionaryValue* values) { 28 base::DictionaryValue* values) {
29 DCHECK(values); 29 DCHECK(values);
30 30
31 static OptionsStringResource resources[] = { 31 static OptionsStringResource resources[] = {
32 { "mediaSelectMicLabel", IDS_MEDIA_SELECTED_MIC_LABEL }, 32 { "mediaSelectMicLabel", IDS_MEDIA_SELECTED_MIC_LABEL },
33 { "mediaSelectCameraLabel", IDS_MEDIA_SELECTED_CAMERA_LABEL }, 33 { "mediaSelectCameraLabel", IDS_MEDIA_SELECTED_CAMERA_LABEL },
34 }; 34 };
35 35
36 RegisterStrings(values, resources, arraysize(resources)); 36 RegisterStrings(values, resources, arraysize(resources));
37 } 37 }
38 38
39 void MediaDevicesSelectionHandler::InitializePage() { 39 void MediaDevicesSelectionHandler::InitializePage() {
40 // Register to the device observer list to get up-to-date device lists. 40 // Register to the device observer list to get up-to-date device lists.
41 MediaCaptureDevicesDispatcher::GetInstance()->AddObserver(this); 41 content::MediaCaptureDevices::GetInstance()->AddObserver(this);
42 42
43 // Update the device selection menus. 43 // Update the device selection menus.
44 UpdateDevicesMenuForType(AUDIO); 44 UpdateDevicesMenuForType(AUDIO);
45 UpdateDevicesMenuForType(VIDEO); 45 UpdateDevicesMenuForType(VIDEO);
46 } 46 }
47 47
48 void MediaDevicesSelectionHandler::RegisterMessages() { 48 void MediaDevicesSelectionHandler::RegisterMessages() {
49 web_ui()->RegisterMessageCallback("setDefaultCaptureDevice", 49 web_ui()->RegisterMessageCallback("setDefaultCaptureDevice",
50 base::Bind(&MediaDevicesSelectionHandler::SetDefaultCaptureDevice, 50 base::Bind(&MediaDevicesSelectionHandler::SetDefaultCaptureDevice,
51 base::Unretained(this))); 51 base::Unretained(this)));
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
123 web_ui()->CallJavascriptFunction("ContentSettings.updateDevicesMenu", 123 web_ui()->CallJavascriptFunction("ContentSettings.updateDevicesMenu",
124 type_value, 124 type_value,
125 device_list, 125 device_list,
126 default_value); 126 default_value);
127 } 127 }
128 128
129 void MediaDevicesSelectionHandler::UpdateDevicesMenuForType(DeviceType type) { 129 void MediaDevicesSelectionHandler::UpdateDevicesMenuForType(DeviceType type) {
130 content::MediaStreamDevices devices; 130 content::MediaStreamDevices devices;
131 switch (type) { 131 switch (type) {
132 case AUDIO: 132 case AUDIO:
133 devices = MediaCaptureDevicesDispatcher::GetInstance()-> 133 devices = content::MediaCaptureDevices::GetInstance()->
134 GetAudioCaptureDevices(); 134 GetAudioCaptureDevices();
135 break; 135 break;
136 case VIDEO: 136 case VIDEO:
137 devices = MediaCaptureDevicesDispatcher::GetInstance()-> 137 devices = content::MediaCaptureDevices::GetInstance()->
138 GetVideoCaptureDevices(); 138 GetVideoCaptureDevices();
139 break; 139 break;
140 } 140 }
141 141
142 UpdateDevicesMenu(type, devices); 142 UpdateDevicesMenu(type, devices);
143 } 143 }
144 144
145 } // namespace options 145 } // namespace options
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698