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

Side by Side Diff: content/browser/web_contents/web_contents_impl.cc

Issue 586303004: WebContentsAudioMuter: Mute all audio output from a WebContentsImpl. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Moar alphabetizing. ;-) 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "content/browser/web_contents/web_contents_impl.h" 5 #include "content/browser/web_contents/web_contents_impl.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/debug/trace_event.h" 10 #include "base/debug/trace_event.h"
(...skipping 22 matching lines...) Expand all
33 #include "content/browser/frame_host/interstitial_page_impl.h" 33 #include "content/browser/frame_host/interstitial_page_impl.h"
34 #include "content/browser/frame_host/navigation_entry_impl.h" 34 #include "content/browser/frame_host/navigation_entry_impl.h"
35 #include "content/browser/frame_host/navigator_impl.h" 35 #include "content/browser/frame_host/navigator_impl.h"
36 #include "content/browser/frame_host/render_frame_host_impl.h" 36 #include "content/browser/frame_host/render_frame_host_impl.h"
37 #include "content/browser/frame_host/render_widget_host_view_child_frame.h" 37 #include "content/browser/frame_host/render_widget_host_view_child_frame.h"
38 #include "content/browser/geolocation/geolocation_dispatcher_host.h" 38 #include "content/browser/geolocation/geolocation_dispatcher_host.h"
39 #include "content/browser/host_zoom_map_impl.h" 39 #include "content/browser/host_zoom_map_impl.h"
40 #include "content/browser/loader/resource_dispatcher_host_impl.h" 40 #include "content/browser/loader/resource_dispatcher_host_impl.h"
41 #include "content/browser/manifest/manifest_manager_host.h" 41 #include "content/browser/manifest/manifest_manager_host.h"
42 #include "content/browser/media/audio_stream_monitor.h" 42 #include "content/browser/media/audio_stream_monitor.h"
43 #include "content/browser/media/capture/web_contents_audio_muter.h"
43 #include "content/browser/media/midi_dispatcher_host.h" 44 #include "content/browser/media/midi_dispatcher_host.h"
44 #include "content/browser/message_port_message_filter.h" 45 #include "content/browser/message_port_message_filter.h"
45 #include "content/browser/message_port_service.h" 46 #include "content/browser/message_port_service.h"
46 #include "content/browser/power_save_blocker_impl.h" 47 #include "content/browser/power_save_blocker_impl.h"
47 #include "content/browser/renderer_host/render_process_host_impl.h" 48 #include "content/browser/renderer_host/render_process_host_impl.h"
48 #include "content/browser/renderer_host/render_view_host_delegate_view.h" 49 #include "content/browser/renderer_host/render_view_host_delegate_view.h"
49 #include "content/browser/renderer_host/render_view_host_impl.h" 50 #include "content/browser/renderer_host/render_view_host_impl.h"
50 #include "content/browser/renderer_host/render_widget_host_impl.h" 51 #include "content/browser/renderer_host/render_widget_host_impl.h"
51 #include "content/browser/renderer_host/render_widget_host_view_base.h" 52 #include "content/browser/renderer_host/render_widget_host_view_base.h"
52 #include "content/browser/screen_orientation/screen_orientation_dispatcher_host_ impl.h" 53 #include "content/browser/screen_orientation/screen_orientation_dispatcher_host_ impl.h"
(...skipping 927 matching lines...) Expand 10 before | Expand all | Expand 10 after
980 if (IsHidden()) { 981 if (IsHidden()) {
981 DVLOG(1) << "Executing delayed WasHidden()."; 982 DVLOG(1) << "Executing delayed WasHidden().";
982 WasHidden(); 983 WasHidden();
983 } 984 }
984 } 985 }
985 986
986 int WebContentsImpl::GetCapturerCount() const { 987 int WebContentsImpl::GetCapturerCount() const {
987 return capturer_count_; 988 return capturer_count_;
988 } 989 }
989 990
991 bool WebContentsImpl::IsAudioMuted() const {
992 return audio_muter_.get() && audio_muter_->is_muting();
993 }
994
995 void WebContentsImpl::SetAudioMuted(bool mute) {
996 DVLOG(1) << "SetAudioMuted(mute=" << mute << "), was " << IsAudioMuted()
997 << " for WebContentsImpl@" << this;
998
999 if (mute == IsAudioMuted())
1000 return;
1001
1002 if (mute) {
1003 if (!audio_muter_.get())
DaleCurtis 2014/09/22 17:45:45 No need for .get() these days for a boolean test.
1004 audio_muter_.reset(new WebContentsAudioMuter(this));
1005 audio_muter_->StartMuting();
1006 } else {
1007 DCHECK(audio_muter_.get());
DaleCurtis 2014/09/22 17:45:45 Ditto.
1008 audio_muter_->StopMuting();
1009 }
1010
1011 // Notification for UI updates in response to the changed muting state.
1012 NotifyNavigationStateChanged(INVALIDATE_TYPE_TAB);
1013 }
1014
990 bool WebContentsImpl::IsCrashed() const { 1015 bool WebContentsImpl::IsCrashed() const {
991 return (crashed_status_ == base::TERMINATION_STATUS_PROCESS_CRASHED || 1016 return (crashed_status_ == base::TERMINATION_STATUS_PROCESS_CRASHED ||
992 crashed_status_ == base::TERMINATION_STATUS_ABNORMAL_TERMINATION || 1017 crashed_status_ == base::TERMINATION_STATUS_ABNORMAL_TERMINATION ||
993 crashed_status_ == base::TERMINATION_STATUS_PROCESS_WAS_KILLED); 1018 crashed_status_ == base::TERMINATION_STATUS_PROCESS_WAS_KILLED);
994 } 1019 }
995 1020
996 void WebContentsImpl::SetIsCrashed(base::TerminationStatus status, 1021 void WebContentsImpl::SetIsCrashed(base::TerminationStatus status,
997 int error_code) { 1022 int error_code) {
998 if (status == crashed_status_) 1023 if (status == crashed_status_)
999 return; 1024 return;
(...skipping 3366 matching lines...) Expand 10 before | Expand all | Expand 10 after
4366 node->render_manager()->ResumeResponseDeferredAtStart(); 4391 node->render_manager()->ResumeResponseDeferredAtStart();
4367 } 4392 }
4368 4393
4369 void WebContentsImpl::SetForceDisableOverscrollContent(bool force_disable) { 4394 void WebContentsImpl::SetForceDisableOverscrollContent(bool force_disable) {
4370 force_disable_overscroll_content_ = force_disable; 4395 force_disable_overscroll_content_ = force_disable;
4371 if (view_) 4396 if (view_)
4372 view_->SetOverscrollControllerEnabled(CanOverscrollContent()); 4397 view_->SetOverscrollControllerEnabled(CanOverscrollContent());
4373 } 4398 }
4374 4399
4375 } // namespace content 4400 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698