Upstream version 10.39.225.0
[platform/framework/web/crosswalk.git] / src / content / browser / media / capture / web_contents_audio_muter.h
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
3 // found in the LICENSE file.
4
5 #ifndef CONTENT_BROWSER_MEDIA_CAPTURE_WEB_CONTENTS_AUDIO_MUTER_H_
6 #define CONTENT_BROWSER_MEDIA_CAPTURE_WEB_CONTENTS_AUDIO_MUTER_H_
7
8 #include "base/memory/ref_counted.h"
9
10 namespace content {
11
12 class WebContents;
13
14 // Mutes all audio output from a WebContents.  Internally, this is accomplished
15 // by providing a MirroringDestination implementation, similar to that found in
16 // WebContentsAudioInputStream for audio capture/mirroring.  However, the
17 // WebContentsAudioMuter::MuteDestination only pumps the audio data and discards
18 // it.
19 class WebContentsAudioMuter {
20  public:
21   explicit WebContentsAudioMuter(WebContents* web_contents);
22   ~WebContentsAudioMuter();
23
24   bool is_muting() const { return is_muting_; }
25
26   void StartMuting();
27   void StopMuting();
28
29  private:
30   // AudioMirroringManager::MirroringDestination implementation which is
31   // ref-counted so it remains alive as tasks referencing it are posted on both
32   // the UI and IO threads.
33   class MuteDestination;
34   const scoped_refptr<MuteDestination> destination_;
35
36   bool is_muting_;
37
38   DISALLOW_COPY_AND_ASSIGN(WebContentsAudioMuter);
39 };
40
41 }  // namespace content
42
43 #endif  // CONTENT_BROWSER_MEDIA_CAPTURE_WEB_CONTENTS_AUDIO_MUTER_H_