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 { |
| 18 struct MediaLogEvent; |
| 19 } |
| 20 |
17 // This class stores information about currently active media. | 21 // This class stores information about currently active media. |
18 // All of its methods are called on the IO thread. | 22 // All of its methods are called on the IO thread. |
19 class MediaInternals : public MediaObserver, public base::NonThreadSafe { | 23 class MediaInternals : public MediaObserver, public base::NonThreadSafe { |
20 public: | 24 public: |
21 virtual ~MediaInternals(); | 25 virtual ~MediaInternals(); |
22 | 26 |
23 // MediaObserver implementation. | 27 // MediaObserver implementation. |
24 virtual void OnDeleteAudioStream(void* host, int stream_id); | 28 virtual void OnDeleteAudioStream(void* host, int stream_id); |
25 virtual void OnSetAudioStreamPlaying(void* host, int stream_id, bool playing); | 29 virtual void OnSetAudioStreamPlaying(void* host, int stream_id, bool playing); |
26 virtual void OnSetAudioStreamStatus(void* host, int stream_id, | 30 virtual void OnSetAudioStreamStatus(void* host, int stream_id, |
27 const std::string& status); | 31 const std::string& status); |
28 virtual void OnSetAudioStreamVolume(void* host, int stream_id, double volume); | 32 virtual void OnSetAudioStreamVolume(void* host, int stream_id, double volume); |
| 33 virtual void OnMediaEvent(int render_process_id, |
| 34 const media::MediaLogEvent& event); |
29 | 35 |
30 // Methods for observers. | 36 // Methods for observers. |
31 // Observers should add themselves on construction and remove themselves | 37 // Observers should add themselves on construction and remove themselves |
32 // on destruction. | 38 // on destruction. |
33 void AddObserver(MediaInternalsObserver* observer); | 39 void AddObserver(MediaInternalsObserver* observer); |
34 void RemoveObserver(MediaInternalsObserver* observer); | 40 void RemoveObserver(MediaInternalsObserver* observer); |
35 void SendEverything(); | 41 void SendEverything(); |
36 | 42 |
37 private: | 43 private: |
38 friend class IOThread; | 44 friend class IOThread; |
(...skipping 19 matching lines...) Expand all Loading... |
58 void SendUpdate(const std::string& function, Value* value); | 64 void SendUpdate(const std::string& function, Value* value); |
59 | 65 |
60 static MediaInternals* instance_; | 66 static MediaInternals* instance_; |
61 DictionaryValue data_; | 67 DictionaryValue data_; |
62 ObserverList<MediaInternalsObserver> observers_; | 68 ObserverList<MediaInternalsObserver> observers_; |
63 | 69 |
64 DISALLOW_COPY_AND_ASSIGN(MediaInternals); | 70 DISALLOW_COPY_AND_ASSIGN(MediaInternals); |
65 }; | 71 }; |
66 | 72 |
67 #endif // CHROME_BROWSER_MEDIA_MEDIA_INTERNALS_H_ | 73 #endif // CHROME_BROWSER_MEDIA_MEDIA_INTERNALS_H_ |
OLD | NEW |