summaryrefslogtreecommitdiffstats
path: root/chrome/browser/media/media_internals.cc
diff options
context:
space:
mode:
authorxians@chromium.org <xians@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-11-16 17:03:12 +0000
committerxians@chromium.org <xians@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-11-16 17:03:12 +0000
commit0b6e4e0fe970154171fa633102704dbfa0ee4684 (patch)
tree219611af8eb7f1a10fbc835b5b050015406413bf /chrome/browser/media/media_internals.cc
parentb40a1272637611b8a091b11c7ec84611b5e01d66 (diff)
downloadchromium_src-0b6e4e0fe970154171fa633102704dbfa0ee4684.zip
chromium_src-0b6e4e0fe970154171fa633102704dbfa0ee4684.tar.gz
chromium_src-0b6e4e0fe970154171fa633102704dbfa0ee4684.tar.bz2
This patch implements a device selection UI to chrome content setting, and the UI will be similar to that device UI in gmail-chat settings.
In order to achieve it, this patch: # added a MediaDevicesSelectionHandler in UI options to handle the device selection. # added a MediaCaptureDevicesDispatcher to chrome media, which will receive device changed notification from MediaStreamManager when a capture device is plugged in or unplugged, then it will cached the device lists and send the new lists to its observers. # MediaDevicesSelectionHandler will register itself as the observer to MediaCaptureDevicesDispatcher when it is initialized, so that it will always get up-to-date device lists. And it will remove itself on destruction. BUG=159398 TEST= go to content setting media section, select devices via the menus. Review URL: https://codereview.chromium.org/11364048 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@168227 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/media/media_internals.cc')
-rw-r--r--chrome/browser/media/media_internals.cc21
1 files changed, 20 insertions, 1 deletions
diff --git a/chrome/browser/media/media_internals.cc b/chrome/browser/media/media_internals.cc
index 8584ae4..c57fb48 100644
--- a/chrome/browser/media/media_internals.cc
+++ b/chrome/browser/media/media_internals.cc
@@ -7,6 +7,7 @@
#include "base/memory/scoped_ptr.h"
#include "base/string16.h"
#include "base/stringprintf.h"
+#include "chrome/browser/media/media_capture_devices_dispatcher.h"
#include "chrome/browser/media/media_internals_observer.h"
#include "chrome/browser/media/media_stream_capture_indicator.h"
#include "content/public/browser/browser_thread.h"
@@ -84,6 +85,18 @@ void MediaInternals::OnCaptureDevicesClosed(
devices);
}
+void MediaInternals::OnAudioCaptureDevicesChanged(
+ const content::MediaStreamDevices& devices) {
+ DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
+ media_devices_dispatcher_->AudioCaptureDevicesChanged(devices);
+}
+
+void MediaInternals::OnVideoCaptureDevicesChanged(
+ const content::MediaStreamDevices& devices) {
+ DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
+ media_devices_dispatcher_->VideoCaptureDevicesChanged(devices);
+}
+
void MediaInternals::OnMediaRequestStateChanged(
int render_process_id,
int render_view_id,
@@ -111,13 +124,19 @@ void MediaInternals::SendEverything() {
SendUpdate("media.onReceiveEverything", &data_);
}
+scoped_refptr<MediaCaptureDevicesDispatcher>
+MediaInternals::GetMediaCaptureDevicesDispatcher() {
+ return media_devices_dispatcher_;
+}
+
scoped_refptr<MediaStreamCaptureIndicator>
MediaInternals::GetMediaStreamCaptureIndicator() {
return media_stream_capture_indicator_.get();
}
MediaInternals::MediaInternals()
- : media_stream_capture_indicator_(new MediaStreamCaptureIndicator()) {
+ : media_stream_capture_indicator_(new MediaStreamCaptureIndicator()),
+ media_devices_dispatcher_(new MediaCaptureDevicesDispatcher()) {
}
void MediaInternals::UpdateAudioStream(