OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 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 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/memory/ref_counted.h" | 10 #include "base/memory/ref_counted.h" |
11 #include "base/memory/singleton.h" | 11 #include "base/memory/singleton.h" |
12 #include "base/observer_list.h" | 12 #include "base/observer_list.h" |
13 #include "base/values.h" | 13 #include "base/values.h" |
14 #include "content/public/browser/media_observer.h" | 14 #include "content/public/browser/media_observer.h" |
15 #include "content/public/common/media_stream_request.h" | 15 #include "content/public/common/media_stream_request.h" |
16 | 16 |
| 17 class AudioStreamIndicator; |
17 class MediaCaptureDevicesDispatcher; | 18 class MediaCaptureDevicesDispatcher; |
18 class MediaInternalsObserver; | 19 class MediaInternalsObserver; |
19 class MediaStreamCaptureIndicator; | 20 class MediaStreamCaptureIndicator; |
20 class Profile; | 21 class Profile; |
21 | 22 |
22 namespace media { | 23 namespace media { |
23 | 24 |
24 struct MediaLogEvent; | 25 struct MediaLogEvent; |
25 | 26 |
26 // Helper to get the default devices which can be used by the media request, | 27 // Helper to get the default devices which can be used by the media request, |
(...skipping 12 matching lines...) Expand all Loading... |
39 class MediaInternals : public content::MediaObserver { | 40 class MediaInternals : public content::MediaObserver { |
40 public: | 41 public: |
41 virtual ~MediaInternals(); | 42 virtual ~MediaInternals(); |
42 | 43 |
43 static MediaInternals* GetInstance(); | 44 static MediaInternals* GetInstance(); |
44 | 45 |
45 // Overridden from content::MediaObserver: | 46 // Overridden from content::MediaObserver: |
46 virtual void OnDeleteAudioStream(void* host, int stream_id) OVERRIDE; | 47 virtual void OnDeleteAudioStream(void* host, int stream_id) OVERRIDE; |
47 virtual void OnSetAudioStreamPlaying(void* host, | 48 virtual void OnSetAudioStreamPlaying(void* host, |
48 int stream_id, | 49 int stream_id, |
| 50 int render_process_id, |
| 51 int render_view_id, |
49 bool playing) OVERRIDE; | 52 bool playing) OVERRIDE; |
50 virtual void OnSetAudioStreamStatus(void* host, | 53 virtual void OnSetAudioStreamStatus(void* host, |
51 int stream_id, | 54 int stream_id, |
52 const std::string& status) OVERRIDE; | 55 const std::string& status) OVERRIDE; |
53 virtual void OnSetAudioStreamVolume(void* host, | 56 virtual void OnSetAudioStreamVolume(void* host, |
54 int stream_id, | 57 int stream_id, |
55 double volume) OVERRIDE; | 58 double volume) OVERRIDE; |
56 virtual void OnMediaEvent(int render_process_id, | 59 virtual void OnMediaEvent(int render_process_id, |
57 const media::MediaLogEvent& event) OVERRIDE; | 60 const media::MediaLogEvent& event) OVERRIDE; |
58 virtual void OnCaptureDevicesOpened( | 61 virtual void OnCaptureDevicesOpened( |
(...skipping 17 matching lines...) Expand all Loading... |
76 // Methods for observers. | 79 // Methods for observers. |
77 // Observers should add themselves on construction and remove themselves | 80 // Observers should add themselves on construction and remove themselves |
78 // on destruction. | 81 // on destruction. |
79 void AddObserver(MediaInternalsObserver* observer); | 82 void AddObserver(MediaInternalsObserver* observer); |
80 void RemoveObserver(MediaInternalsObserver* observer); | 83 void RemoveObserver(MediaInternalsObserver* observer); |
81 void SendEverything(); | 84 void SendEverything(); |
82 | 85 |
83 scoped_refptr<MediaStreamCaptureIndicator> GetMediaStreamCaptureIndicator(); | 86 scoped_refptr<MediaStreamCaptureIndicator> GetMediaStreamCaptureIndicator(); |
84 scoped_refptr<MediaCaptureDevicesDispatcher> | 87 scoped_refptr<MediaCaptureDevicesDispatcher> |
85 GetMediaCaptureDevicesDispatcher(); | 88 GetMediaCaptureDevicesDispatcher(); |
| 89 AudioStreamIndicator* GetAudioStreamIndicator(); |
86 | 90 |
87 private: | 91 private: |
88 friend class MediaInternalsTest; | 92 friend class MediaInternalsTest; |
89 friend struct DefaultSingletonTraits<MediaInternals>; | 93 friend struct DefaultSingletonTraits<MediaInternals>; |
90 | 94 |
91 MediaInternals(); | 95 MediaInternals(); |
92 | 96 |
93 // Sets |property| of an audio stream to |value| and notifies observers. | 97 // Sets |property| of an audio stream to |value| and notifies observers. |
94 // (host, stream_id) is a unique id for the audio stream. | 98 // (host, stream_id) is a unique id for the audio stream. |
95 // |host| will never be dereferenced. | 99 // |host| will never be dereferenced. |
96 void UpdateAudioStream(void* host, int stream_id, | 100 void UpdateAudioStream(void* host, int stream_id, |
97 const std::string& property, Value* value); | 101 const std::string& property, Value* value); |
98 | 102 |
99 // Removes |item| from |data_|. | 103 // Removes |item| from |data_|. |
100 void DeleteItem(const std::string& item); | 104 void DeleteItem(const std::string& item); |
101 | 105 |
102 // Sets data_.id.property = value and notifies attached UIs using update_fn. | 106 // Sets data_.id.property = value and notifies attached UIs using update_fn. |
103 // id may be any depth, e.g. "video.decoders.1.2.3" | 107 // id may be any depth, e.g. "video.decoders.1.2.3" |
104 void UpdateItem(const std::string& update_fn, const std::string& id, | 108 void UpdateItem(const std::string& update_fn, const std::string& id, |
105 const std::string& property, Value* value); | 109 const std::string& property, Value* value); |
106 | 110 |
107 // Calls javascript |function|(|value|) on each attached UI. | 111 // Calls javascript |function|(|value|) on each attached UI. |
108 void SendUpdate(const std::string& function, Value* value); | 112 void SendUpdate(const std::string& function, Value* value); |
109 | 113 |
110 DictionaryValue data_; | 114 DictionaryValue data_; |
111 ObserverList<MediaInternalsObserver> observers_; | 115 ObserverList<MediaInternalsObserver> observers_; |
112 scoped_refptr<MediaStreamCaptureIndicator> media_stream_capture_indicator_; | 116 scoped_refptr<MediaStreamCaptureIndicator> media_stream_capture_indicator_; |
113 scoped_refptr<MediaCaptureDevicesDispatcher> media_devices_dispatcher_; | 117 scoped_refptr<MediaCaptureDevicesDispatcher> media_devices_dispatcher_; |
| 118 scoped_refptr<AudioStreamIndicator> audio_stream_indicator_; |
114 | 119 |
115 DISALLOW_COPY_AND_ASSIGN(MediaInternals); | 120 DISALLOW_COPY_AND_ASSIGN(MediaInternals); |
116 }; | 121 }; |
117 | 122 |
118 #endif // CHROME_BROWSER_MEDIA_MEDIA_INTERNALS_H_ | 123 #endif // CHROME_BROWSER_MEDIA_MEDIA_INTERNALS_H_ |
OLD | NEW |