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

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 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
« no previous file with comments | « no previous file | chrome/browser/media/audio_stream_indicator.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 <map>
9 #include <set>
10
11 #include "base/memory/ref_counted.h"
12
13 namespace content {
14 class WebContents;
15 }
16
17 class AudioStreamIndicator
18 : public base::RefCountedThreadSafe<AudioStreamIndicator> {
19 public:
20 AudioStreamIndicator();
21
22 // This method should be called on the IO thread.
23 void UpdateWebContentsStatus(int render_process_id,
24 int render_view_id,
25 int stream_id,
26 bool playing);
27
28 // This method should be called on the IO thread.
29 bool IsPlayingAudio(content::WebContents* contents);
30
31 private:
32 struct RenderViewId {
33 RenderViewId(int render_process_id,
34 int render_view_id);
35
36 // Required to use this struct in the std::multiset below.
37 bool operator<(const RenderViewId& other) const;
38
39 int render_process_id;
40 int render_view_id;
41 };
42
43 friend class base::RefCountedThreadSafe<AudioStreamIndicator>;
44 virtual ~AudioStreamIndicator();
45
46 void UpdateWebContentsStatusOnUIThread(int render_process_id,
47 int render_view_id,
48 int stream_id,
49 bool playing);
50
51 // A map from RenderViews to sets of streams playing in them (each RenderView
52 // might have more than one stream).
53 std::map<RenderViewId, std::set<int> > audio_streams_;
54 };
55
56 #endif // CHROME_BROWSER_MEDIA_AUDIO_STREAM_INDICATOR_H_
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/media/audio_stream_indicator.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698