Index: content/browser/web_contents/web_contents_impl.cc |
diff --git a/content/browser/web_contents/web_contents_impl.cc b/content/browser/web_contents/web_contents_impl.cc |
index 14cf8a42cbf21eccfb415e69ffb85cac85fb0cd7..592a72af6dd9b4f73dda82310b263cbdae48ee17 100644 |
--- a/content/browser/web_contents/web_contents_impl.cc |
+++ b/content/browser/web_contents/web_contents_impl.cc |
@@ -40,6 +40,7 @@ |
#include "content/browser/loader/resource_dispatcher_host_impl.h" |
#include "content/browser/manifest/manifest_manager_host.h" |
#include "content/browser/media/audio_stream_monitor.h" |
+#include "content/browser/media/capture/web_contents_audio_muter.h" |
#include "content/browser/media/midi_dispatcher_host.h" |
#include "content/browser/message_port_message_filter.h" |
#include "content/browser/message_port_service.h" |
@@ -987,6 +988,30 @@ int WebContentsImpl::GetCapturerCount() const { |
return capturer_count_; |
} |
+bool WebContentsImpl::IsAudioMuted() const { |
+ return audio_muter_.get() && audio_muter_->is_muting(); |
+} |
+ |
+void WebContentsImpl::SetAudioMuted(bool mute) { |
+ DVLOG(1) << "SetAudioMuted(mute=" << mute << "), was " << IsAudioMuted() |
+ << " for WebContentsImpl@" << this; |
+ |
+ if (mute == IsAudioMuted()) |
+ return; |
+ |
+ if (mute) { |
+ if (!audio_muter_) |
+ audio_muter_.reset(new WebContentsAudioMuter(this)); |
+ audio_muter_->StartMuting(); |
+ } else { |
+ DCHECK(audio_muter_); |
+ audio_muter_->StopMuting(); |
+ } |
+ |
+ // Notification for UI updates in response to the changed muting state. |
+ NotifyNavigationStateChanged(INVALIDATE_TYPE_TAB); |
+} |
+ |
bool WebContentsImpl::IsCrashed() const { |
return (crashed_status_ == base::TERMINATION_STATUS_PROCESS_CRASHED || |
crashed_status_ == base::TERMINATION_STATUS_ABNORMAL_TERMINATION || |