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

Unified Diff: content/browser/media/capture/web_contents_audio_muter.h

Issue 586303004: WebContentsAudioMuter: Mute all audio output from a WebContentsImpl. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Addressed Dale's comments. Created 6 years, 3 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
Index: content/browser/media/capture/web_contents_audio_muter.h
diff --git a/content/browser/media/capture/web_contents_audio_muter.h b/content/browser/media/capture/web_contents_audio_muter.h
new file mode 100644
index 0000000000000000000000000000000000000000..d9c5f2fcbb2a939a2a693f573868bf1fc8aacbfb
--- /dev/null
+++ b/content/browser/media/capture/web_contents_audio_muter.h
@@ -0,0 +1,43 @@
+// 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_BROWSER_MEDIA_CAPTURE_WEB_CONTENTS_AUDIO_MUTER_H_
+#define CONTENT_BROWSER_MEDIA_CAPTURE_WEB_CONTENTS_AUDIO_MUTER_H_
+
+#include "base/memory/ref_counted.h"
+
+namespace content {
+
+class WebContents;
+
+// Mutes all audio output from a WebContents. Internally, this is accomplished
+// by providing a MirroringDestination implementation, similar to that found in
+// WebContentsAudioInputStream for audio capture/mirroring. However, the
+// WebContentsAudioMuter::MuteDestination only pumps the audio data and discards
+// it.
+class WebContentsAudioMuter {
+ public:
+ explicit WebContentsAudioMuter(WebContents* web_contents);
+ ~WebContentsAudioMuter();
+
+ bool is_muting() const { return is_muting_; }
+
+ void StartMuting();
+ void StopMuting();
+
+ private:
+ // AudioMirroringManager::MirroringDestination implementation which is
+ // ref-counted so it remains alive as tasks referencing it are posted on both
+ // the UI and IO threads.
+ class MuteDestination;
+ const scoped_refptr<MuteDestination> destination_;
+
+ bool is_muting_;
+
+ DISALLOW_COPY_AND_ASSIGN(WebContentsAudioMuter);
+};
+
+} // namespace content
+
+#endif // CONTENT_BROWSER_MEDIA_CAPTURE_WEB_CONTENTS_AUDIO_MUTER_H_

Powered by Google App Engine
This is Rietveld 408576698