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

Unified Diff: content/public/browser/media_capture_devices.h

Issue 183743021: Implement MediaCaptureDevices. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 10 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « content/content_browser.gypi ('k') | content/public/browser/media_devices_monitor.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/public/browser/media_capture_devices.h
diff --git a/content/public/browser/media_capture_devices.h b/content/public/browser/media_capture_devices.h
new file mode 100644
index 0000000000000000000000000000000000000000..5a62ca53033a7cc192475ffa6fb6962f57e67709
--- /dev/null
+++ b/content/public/browser/media_capture_devices.h
@@ -0,0 +1,59 @@
+// Copyright 2014 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CONTENT_PUBLIC_BROWSER_MEDIA_CAPTURE_DEVICES_H_
+#define CONTENT_PUBLIC_BROWSER_MEDIA_CAPTURE_DEVICES_H_
+
+#include "content/public/common/media_stream_request.h"
+
+namespace content {
+
+// This is a singleton class, used to get Audio/Video devices, it also provides
+// observer interface to notify the change of devices.
+CONTENT_EXPORT class MediaCaptureDevices {
+ public:
+ class Observer {
jam 2014/03/05 08:45:04 i probably wasn't clear in the email thread, sorry
michaelbai 2014/03/05 21:55:46 Done.
+ public:
+ // Handle an information update consisting of a up-to-date audio capture
+ // device lists. This happens when a microphone is plugged in or unplugged.
+ virtual void OnUpdateAudioDevices(
+ const content::MediaStreamDevices& devices) {}
+
+ // Handle an information update consisting of a up-to-date video capture
+ // device lists. This happens when a camera is plugged in or unplugged.
+ virtual void OnUpdateVideoDevices(
+ const content::MediaStreamDevices& devices) {}
+
+ virtual ~Observer() {}
+ };
+
+ // Get signleton instance of MediaCaptureDevices.
+ static MediaCaptureDevices* GetInstance();
+
+ // Add/Remove Observer must be called on UI thread.
+ virtual void AddObserver(Observer* observer) = 0;
+ virtual void RemoveObserver(Observer* observer) = 0;
+
+ // Return all Audio/Video devices.
+ virtual const MediaStreamDevices& GetAudioCaptureDevices() = 0;
+ virtual const MediaStreamDevices& GetVideoCaptureDevices() = 0;
+
+ // Only for testing, should be called in IO thread.
+ virtual void SetAudioCaptureDevices(const MediaStreamDevices& devices) = 0;
jam 2014/03/05 08:45:04 these test methods are called by chrome to fake th
michaelbai 2014/03/05 21:55:46 Done.
+ virtual void SetVideoCaptureDevices(const MediaStreamDevices& devices) = 0;
+ // Unittests that do not require actual device enumeration should call this
+ // API on the singleton. It is safe to call this multiple times on the
+ // signleton.
+ virtual void DisableDeviceEnumerationForTesting() = 0;
+
+ private:
+ // This interface should only be implemented inside content.
+ friend class MediaCaptureDevicesImpl;
+ MediaCaptureDevices() {}
+ virtual ~MediaCaptureDevices() {}
+};
+
+} // namespace content
+
+#endif // CONTENT_PUBLIC_BROWSER_MEDIA_CAPTURE_DEVICES_H_
« no previous file with comments | « content/content_browser.gypi ('k') | content/public/browser/media_devices_monitor.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698