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

Side by Side Diff: content/browser/media/capture/web_contents_audio_input_stream.cc

Issue 757033005: Make tab audible and muted states and cause available for an extension API (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: adding owners (sky for chrome/browser/ui/tabs/tab_strip_model.cc, jam for changes in content/public… Created 6 years 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) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 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_input_stream.h" 5 #include "content/browser/media/capture/web_contents_audio_input_stream.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/bind_helpers.h" 10 #include "base/bind_helpers.h"
11 #include "base/logging.h" 11 #include "base/logging.h"
12 #include "base/memory/scoped_ptr.h" 12 #include "base/memory/scoped_ptr.h"
13 #include "base/threading/thread_checker.h" 13 #include "base/threading/thread_checker.h"
14 #include "content/browser/media/capture/audio_mirroring_manager.h" 14 #include "content/browser/media/capture/audio_mirroring_manager.h"
15 #include "content/browser/media/capture/web_contents_capture_util.h" 15 #include "content/browser/media/capture/web_contents_capture_util.h"
16 #include "content/browser/media/capture/web_contents_tracker.h" 16 #include "content/browser/media/capture/web_contents_tracker.h"
17 #include "content/public/browser/browser_thread.h" 17 #include "content/public/browser/browser_thread.h"
18 #include "content/public/browser/render_frame_host.h" 18 #include "content/public/browser/render_frame_host.h"
19 #include "content/public/browser/web_contents.h" 19 #include "content/public/browser/web_contents.h"
20 #include "media/audio/virtual_audio_input_stream.h" 20 #include "media/audio/virtual_audio_input_stream.h"
21 #include "media/audio/virtual_audio_output_stream.h" 21 #include "media/audio/virtual_audio_output_stream.h"
22 #include "media/base/bind_to_current_loop.h" 22 #include "media/base/bind_to_current_loop.h"
23 23
24 namespace content { 24 namespace content {
25 25
26 static const char kForceUnmutedCause[] = "auto-forced for capture";
27
26 class WebContentsAudioInputStream::Impl 28 class WebContentsAudioInputStream::Impl
27 : public base::RefCountedThreadSafe<WebContentsAudioInputStream::Impl>, 29 : public base::RefCountedThreadSafe<WebContentsAudioInputStream::Impl>,
28 public AudioMirroringManager::MirroringDestination { 30 public AudioMirroringManager::MirroringDestination {
29 public: 31 public:
30 // Takes ownership of |mixer_stream|. The rest outlive this instance. 32 // Takes ownership of |mixer_stream|. The rest outlive this instance.
31 Impl(int render_process_id, int main_render_frame_id, 33 Impl(int render_process_id, int main_render_frame_id,
32 AudioMirroringManager* mirroring_manager, 34 AudioMirroringManager* mirroring_manager,
33 const scoped_refptr<WebContentsTracker>& tracker, 35 const scoped_refptr<WebContentsTracker>& tracker,
34 media::VirtualAudioInputStream* mixer_stream); 36 media::VirtualAudioInputStream* mixer_stream);
35 37
(...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after
244 base::Bind(&AudioMirroringManager::StopMirroring, 246 base::Bind(&AudioMirroringManager::StopMirroring,
245 base::Unretained(mirroring_manager_), 247 base::Unretained(mirroring_manager_),
246 make_scoped_refptr(this))); 248 make_scoped_refptr(this)));
247 } 249 }
248 250
249 void WebContentsAudioInputStream::Impl::UnmuteWebContentsAudio() { 251 void WebContentsAudioInputStream::Impl::UnmuteWebContentsAudio() {
250 DCHECK_CURRENTLY_ON(BrowserThread::UI); 252 DCHECK_CURRENTLY_ON(BrowserThread::UI);
251 253
252 WebContents* const contents = tracker_->web_contents(); 254 WebContents* const contents = tracker_->web_contents();
253 if (contents) 255 if (contents)
254 contents->SetAudioMuted(false); 256 contents->SetAudioMuted(false, kForceUnmutedCause);
255 } 257 }
256 258
257 void WebContentsAudioInputStream::Impl::QueryForMatches( 259 void WebContentsAudioInputStream::Impl::QueryForMatches(
258 const std::set<SourceFrameRef>& candidates, 260 const std::set<SourceFrameRef>& candidates,
259 const MatchesCallback& results_callback) { 261 const MatchesCallback& results_callback) {
260 BrowserThread::PostTask( 262 BrowserThread::PostTask(
261 BrowserThread::UI, 263 BrowserThread::UI,
262 FROM_HERE, 264 FROM_HERE,
263 base::Bind(&Impl::QueryForMatchesOnUIThread, 265 base::Bind(&Impl::QueryForMatchesOnUIThread,
264 this, 266 this,
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after
388 390
389 bool WebContentsAudioInputStream::GetAutomaticGainControl() { 391 bool WebContentsAudioInputStream::GetAutomaticGainControl() {
390 return impl_->mixer_stream()->GetAutomaticGainControl(); 392 return impl_->mixer_stream()->GetAutomaticGainControl();
391 } 393 }
392 394
393 bool WebContentsAudioInputStream::IsMuted() { 395 bool WebContentsAudioInputStream::IsMuted() {
394 return false; 396 return false;
395 } 397 }
396 398
397 } // namespace content 399 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698