OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 #ifndef CHROME_BROWSER_MEDIA_MEDIA_INTERNALS_H_ | 5 #ifndef CHROME_BROWSER_MEDIA_MEDIA_INTERNALS_H_ |
6 #define CHROME_BROWSER_MEDIA_MEDIA_INTERNALS_H_ | 6 #define CHROME_BROWSER_MEDIA_MEDIA_INTERNALS_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include "base/memory/ref_counted.h" | 9 #include "base/memory/ref_counted.h" |
10 #include "base/observer_list.h" | 10 #include "base/observer_list.h" |
11 #include "base/threading/non_thread_safe.h" | 11 #include "base/threading/non_thread_safe.h" |
12 #include "base/values.h" | 12 #include "base/values.h" |
13 #include "content/browser/renderer_host/media/media_observer.h" | 13 #include "content/browser/renderer_host/media/media_observer.h" |
14 | 14 |
15 class MediaInternalsObserver; | 15 class MediaInternalsObserver; |
16 | 16 |
17 namespace media { | 17 namespace media { |
18 struct MediaLogEvent; | 18 struct MediaLogEvent; |
19 } | 19 } |
20 | 20 |
21 // This class stores information about currently active media. | 21 // This class stores information about currently active media. |
22 // All of its methods are called on the IO thread. | 22 // All of its methods are called on the IO thread. |
23 class MediaInternals : public MediaObserver, public base::NonThreadSafe { | 23 class MediaInternals : public MediaObserver, public base::NonThreadSafe { |
24 public: | 24 public: |
25 virtual ~MediaInternals(); | 25 virtual ~MediaInternals(); |
26 | 26 |
27 // MediaObserver implementation. | 27 // MediaObserver implementation. |
28 virtual void OnDeleteAudioStream(void* host, int stream_id); | 28 virtual void OnDeleteAudioStream(void* host, int stream_id) OVERRIDE; |
29 virtual void OnSetAudioStreamPlaying(void* host, int stream_id, bool playing); | 29 virtual void OnSetAudioStreamPlaying(void* host, |
30 virtual void OnSetAudioStreamStatus(void* host, int stream_id, | 30 int stream_id, |
31 const std::string& status); | 31 bool playing) OVERRIDE; |
32 virtual void OnSetAudioStreamVolume(void* host, int stream_id, double volume); | 32 virtual void OnSetAudioStreamStatus(void* host, |
| 33 int stream_id, |
| 34 const std::string& status) OVERRIDE; |
| 35 virtual void OnSetAudioStreamVolume(void* host, |
| 36 int stream_id, |
| 37 double volume) OVERRIDE; |
33 virtual void OnMediaEvent(int render_process_id, | 38 virtual void OnMediaEvent(int render_process_id, |
34 const media::MediaLogEvent& event); | 39 const media::MediaLogEvent& event) OVERRIDE; |
35 | 40 |
36 // Methods for observers. | 41 // Methods for observers. |
37 // Observers should add themselves on construction and remove themselves | 42 // Observers should add themselves on construction and remove themselves |
38 // on destruction. | 43 // on destruction. |
39 void AddObserver(MediaInternalsObserver* observer); | 44 void AddObserver(MediaInternalsObserver* observer); |
40 void RemoveObserver(MediaInternalsObserver* observer); | 45 void RemoveObserver(MediaInternalsObserver* observer); |
41 void SendEverything(); | 46 void SendEverything(); |
42 | 47 |
43 private: | 48 private: |
44 friend class IOThread; | 49 friend class IOThread; |
(...skipping 19 matching lines...) Expand all Loading... |
64 void SendUpdate(const std::string& function, Value* value); | 69 void SendUpdate(const std::string& function, Value* value); |
65 | 70 |
66 static MediaInternals* instance_; | 71 static MediaInternals* instance_; |
67 DictionaryValue data_; | 72 DictionaryValue data_; |
68 ObserverList<MediaInternalsObserver> observers_; | 73 ObserverList<MediaInternalsObserver> observers_; |
69 | 74 |
70 DISALLOW_COPY_AND_ASSIGN(MediaInternals); | 75 DISALLOW_COPY_AND_ASSIGN(MediaInternals); |
71 }; | 76 }; |
72 | 77 |
73 #endif // CHROME_BROWSER_MEDIA_MEDIA_INTERNALS_H_ | 78 #endif // CHROME_BROWSER_MEDIA_MEDIA_INTERNALS_H_ |
OLD | NEW |