Chromium Code Reviews| 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..0c3fa73837068bc9216bcc15a1ed4ff811404a10 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_.get()) |
|
DaleCurtis
2014/09/22 17:45:45
No need for .get() these days for a boolean test.
|
| + audio_muter_.reset(new WebContentsAudioMuter(this)); |
| + audio_muter_->StartMuting(); |
| + } else { |
| + DCHECK(audio_muter_.get()); |
|
DaleCurtis
2014/09/22 17:45:45
Ditto.
|
| + 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 || |