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

Unified Diff: content/renderer/media/media_stream_dispatcher.h

Issue 1918173002: Add support for device-change notifications to MediaStreamDispatcher and MediaStreamDispatcherHost (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase and palmer's comments Created 4 years, 8 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/common/media/media_stream_messages.h ('k') | content/renderer/media/media_stream_dispatcher.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/renderer/media/media_stream_dispatcher.h
diff --git a/content/renderer/media/media_stream_dispatcher.h b/content/renderer/media/media_stream_dispatcher.h
index a41850dc4749adc7778b9a1924eb647f452f3fd9..e75a029e2ab311aa0d57f35ca55d0107a616a786 100644
--- a/content/renderer/media/media_stream_dispatcher.h
+++ b/content/renderer/media/media_stream_dispatcher.h
@@ -9,6 +9,7 @@
#include <map>
#include <memory>
#include <string>
+#include <vector>
#include "base/gtest_prod_util.h"
#include "base/macros.h"
@@ -82,6 +83,17 @@ class CONTENT_EXPORT MediaStreamDispatcher
// Close a started device. |label| is provided in OnDeviceOpened.
void CloseDevice(const std::string& label);
+ // Register and unregister event handlers for device-change notifications.
+ // It is an error to try to subscribe a handler that is already subscribed or
+ // to cancel the subscription of a handler that is not subscribed. Also,
+ // each subscribed handler must make sure to invoke
+ // CancelDeviceChangeNotifications() before the handler is destroyed.
+ void SubscribeToDeviceChangeNotifications(
+ const base::WeakPtr<MediaStreamDispatcherEventHandler>& event_handler,
+ const url::Origin& security_origin);
+ void CancelDeviceChangeNotifications(
+ const base::WeakPtr<MediaStreamDispatcherEventHandler>& event_handler);
+
// Check if the label is a valid stream.
virtual bool IsStream(const std::string& label);
// Get the video session_id given a label. The label identifies a stream.
@@ -128,6 +140,7 @@ class CONTENT_EXPORT MediaStreamDispatcher
const std::string& label,
const StreamDeviceInfo& device_info);
void OnDeviceOpenFailed(int request_id);
+ void OnDevicesChanged();
// Used for DCHECKs so methods calls won't execute in the wrong thread.
base::ThreadChecker thread_checker_;
@@ -141,6 +154,9 @@ class CONTENT_EXPORT MediaStreamDispatcher
typedef std::list<Request> RequestList;
RequestList requests_;
+ std::vector<base::WeakPtr<MediaStreamDispatcherEventHandler>>
+ device_change_subscribers_;
+
DISALLOW_COPY_AND_ASSIGN(MediaStreamDispatcher);
};
« no previous file with comments | « content/common/media/media_stream_messages.h ('k') | content/renderer/media/media_stream_dispatcher.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698