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

Side by Side Diff: chrome/browser/media/audio_stream_indicator.h

Issue 11573066: Add a method to tab_utils.h to find out whether a tab is playing audio. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: review/rewrite Created 7 years, 10 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 | Annotate | Revision Log
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #ifndef CHROME_BROWSER_MEDIA_AUDIO_STREAM_INDICATOR_H_
6 #define CHROME_BROWSER_MEDIA_AUDIO_STREAM_INDICATOR_H_
7
8 #include <set>
9
10 #include "base/memory/ref_counted.h"
11
12 namespace content {
13 class WebContents;
14 }
15
16 class AudioStreamIndicator
17 : public base::RefCountedThreadSafe<AudioStreamIndicator> {
18 public:
19 AudioStreamIndicator();
20
21 // This method should be called on the IO thread.
22 void UpdateWebContentsStatus(int render_process_id,
23 int render_view_id,
24 bool playing);
25
26 // This method should be called on the IO thread.
27 bool IsPlayingAudio(content::WebContents* contents);
28
29 private:
30 struct RenderViewId {
31 RenderViewId(int render_process_id,
32 int render_view_id);
33
34 // Required to use this struct in the std::multiset below.
35 bool operator<(const RenderViewId& other) const;
36
37 int render_process_id;
38 int render_view_id;
39 };
40
41 friend class base::RefCountedThreadSafe<AudioStreamIndicator>;
42 virtual ~AudioStreamIndicator();
43
44 void UpdateWebContentsStatusOnUIThread(int render_process_id,
45 int render_view_id,
46 bool playing);
47
48 // The set of RenderViews that currently have a stream playing (a multiset
49 // because each RenderView might have more than one stream).
50 std::multiset<RenderViewId> audio_streams_;
51 };
52
53 #endif // CHROME_BROWSER_MEDIA_AUDIO_STREAM_INDICATOR_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698