OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/media/capture/web_contents_audio_muter.h" | 5 #include "content/browser/media/capture/web_contents_audio_muter.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/bind_helpers.h" | 8 #include "base/bind_helpers.h" |
9 #include "base/macros.h" | 9 #include "base/macros.h" |
10 #include "content/browser/media/capture/audio_mirroring_manager.h" | 10 #include "content/browser/media/capture/audio_mirroring_manager.h" |
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
126 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 126 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
127 StopMuting(); | 127 StopMuting(); |
128 } | 128 } |
129 | 129 |
130 void WebContentsAudioMuter::StartMuting() { | 130 void WebContentsAudioMuter::StartMuting() { |
131 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 131 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
132 if (is_muting_) | 132 if (is_muting_) |
133 return; | 133 return; |
134 is_muting_ = true; | 134 is_muting_ = true; |
135 BrowserThread::PostTask( | 135 BrowserThread::PostTask( |
136 BrowserThread::IO, | 136 BrowserThread::IO, FROM_HERE, |
137 FROM_HERE, | |
138 base::Bind(&AudioMirroringManager::StartMirroring, | 137 base::Bind(&AudioMirroringManager::StartMirroring, |
139 base::Unretained(AudioMirroringManager::GetInstance()), | 138 base::Unretained(AudioMirroringManager::GetInstance()), |
140 destination_)); | 139 base::RetainedRef(destination_))); |
141 } | 140 } |
142 | 141 |
143 void WebContentsAudioMuter::StopMuting() { | 142 void WebContentsAudioMuter::StopMuting() { |
144 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 143 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
145 if (!is_muting_) | 144 if (!is_muting_) |
146 return; | 145 return; |
147 is_muting_ = false; | 146 is_muting_ = false; |
148 BrowserThread::PostTask( | 147 BrowserThread::PostTask( |
149 BrowserThread::IO, | 148 BrowserThread::IO, FROM_HERE, |
150 FROM_HERE, | |
151 base::Bind(&AudioMirroringManager::StopMirroring, | 149 base::Bind(&AudioMirroringManager::StopMirroring, |
152 base::Unretained(AudioMirroringManager::GetInstance()), | 150 base::Unretained(AudioMirroringManager::GetInstance()), |
153 destination_)); | 151 base::RetainedRef(destination_))); |
154 } | 152 } |
155 | 153 |
156 } // namespace content | 154 } // namespace content |
OLD | NEW |