#include "base/gtest_prod_util.h"
#include "base/memory/scoped_ptr.h"
#include "base/memory/weak_ptr.h"
+#include "base/threading/thread_checker.h"
#include "content/common/content_export.h"
#include "content/common/media/media_stream_options.h"
-#include "content/public/renderer/render_view_observer.h"
+#include "content/public/renderer/render_frame_observer.h"
#include "content/renderer/media/media_stream_dispatcher_eventhandler.h"
namespace base {
namespace content {
-class RenderViewImpl;
-
// MediaStreamDispatcher is a delegate for the Media Stream API messages.
// MediaStreams are used by WebKit to open media devices such as Video Capture
// and Audio input devices.
// It's the complement of MediaStreamDispatcherHost (owned by
// BrowserRenderProcessHost).
class CONTENT_EXPORT MediaStreamDispatcher
- : public RenderViewObserver,
+ : public RenderFrameObserver,
public base::SupportsWeakPtr<MediaStreamDispatcher> {
public:
- explicit MediaStreamDispatcher(RenderViewImpl* render_view);
+ explicit MediaStreamDispatcher(RenderFrame* render_frame);
virtual ~MediaStreamDispatcher();
// Request a new media stream to be created.
virtual void StopStreamDevice(const StreamDeviceInfo& device_info);
// Request to enumerate devices.
- // If |hide_labels_if_no_access| is true, labels will be empty in the
- // response if permission has not been granted for the device type. This
- // should normally be true.
virtual void EnumerateDevices(
int request_id,
const base::WeakPtr<MediaStreamDispatcherEventHandler>& event_handler,
MediaStreamType type,
- const GURL& security_origin,
- bool hide_labels_if_no_access);
+ const GURL& security_origin);
// Request to stop enumerating devices.
void StopEnumerateDevices(
// Returns an audio session_id given a label and an index.
virtual int audio_session_id(const std::string& label, int index);
+ // Returns true if an audio input stream is currently active that was opened
+ // with audio ducking enabled. This is information is used when playing out
+ // audio so that rendered audio can be excluded from the ducking operation.
+ bool IsAudioDuckingActive() const;
+
protected:
int GetNextIpcIdForTest() { return next_ipc_id_; }
FRIEND_TEST_ALL_PREFIXES(MediaStreamDispatcherTest, BasicVideoDevice);
FRIEND_TEST_ALL_PREFIXES(MediaStreamDispatcherTest, TestFailure);
FRIEND_TEST_ALL_PREFIXES(MediaStreamDispatcherTest, CancelGenerateStream);
+ FRIEND_TEST_ALL_PREFIXES(MediaStreamDispatcherTest, CheckDuckingState);
struct Request;
// opened it.
struct Stream;
- // RenderViewObserver OVERRIDE.
+ // RenderFrameObserver OVERRIDE.
+ virtual void OnDestruct() OVERRIDE;
virtual bool Send(IPC::Message* message) OVERRIDE;
+ virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE;
// Messages from the browser.
- virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE;
void OnStreamGenerated(
int request_id,
const std::string& label,
void OnDeviceOpenFailed(int request_id);
// Used for DCHECKs so methods calls won't execute in the wrong thread.
- scoped_refptr<base::MessageLoopProxy> main_loop_;
+ base::ThreadChecker thread_checker_;
int next_ipc_id_;
typedef std::map<std::string, Stream> LabelStreamMap;