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