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 #pragma once | 7 #pragma once |
8 | 8 |
9 #include "base/memory/ref_counted.h" | 9 #include "base/memory/ref_counted.h" |
10 #include "base/memory/singleton.h" | 10 #include "base/memory/singleton.h" |
11 #include "base/observer_list.h" | 11 #include "base/observer_list.h" |
12 #include "base/values.h" | 12 #include "base/values.h" |
13 #include "content/public/browser/media_observer.h" | 13 #include "content/public/browser/media_observer.h" |
14 | 14 |
15 class MediaInternalsObserver; | 15 class MediaInternalsObserver; |
| 16 class MediaStreamCaptureIndicator; |
16 | 17 |
17 namespace media { | 18 namespace media { |
18 struct MediaLogEvent; | 19 struct MediaLogEvent; |
19 } | 20 } |
20 | 21 |
21 // This class stores information about currently active media. | 22 // This class stores information about currently active media. |
22 // It's constructed on the UI thread but all of its methods are called on the IO | 23 // It's constructed on the UI thread but all of its methods are called on the IO |
23 // thread. | 24 // thread. |
24 class MediaInternals : public content::MediaObserver { | 25 class MediaInternals : public content::MediaObserver { |
25 public: | 26 public: |
26 virtual ~MediaInternals(); | 27 virtual ~MediaInternals(); |
27 | 28 |
28 static MediaInternals* GetInstance(); | 29 static MediaInternals* GetInstance(); |
29 | 30 |
30 // Overridden from content::MediaObserver: | 31 // Overridden from content::MediaObserver: |
31 virtual void OnDeleteAudioStream(void* host, int stream_id) OVERRIDE; | 32 virtual void OnDeleteAudioStream(void* host, int stream_id) OVERRIDE; |
32 virtual void OnSetAudioStreamPlaying(void* host, | 33 virtual void OnSetAudioStreamPlaying(void* host, |
33 int stream_id, | 34 int stream_id, |
34 bool playing) OVERRIDE; | 35 bool playing) OVERRIDE; |
35 virtual void OnSetAudioStreamStatus(void* host, | 36 virtual void OnSetAudioStreamStatus(void* host, |
36 int stream_id, | 37 int stream_id, |
37 const std::string& status) OVERRIDE; | 38 const std::string& status) OVERRIDE; |
38 virtual void OnSetAudioStreamVolume(void* host, | 39 virtual void OnSetAudioStreamVolume(void* host, |
39 int stream_id, | 40 int stream_id, |
40 double volume) OVERRIDE; | 41 double volume) OVERRIDE; |
41 virtual void OnMediaEvent(int render_process_id, | 42 virtual void OnMediaEvent(int render_process_id, |
42 const media::MediaLogEvent& event) OVERRIDE; | 43 const media::MediaLogEvent& event) OVERRIDE; |
| 44 virtual void OnCaptureDevicesOpened( |
| 45 int render_process_id, |
| 46 int render_view_id, |
| 47 const content::MediaStreamDevices& devices) OVERRIDE; |
| 48 virtual void OnCaptureDevicesClosed( |
| 49 int render_process_id, |
| 50 int render_view_id, |
| 51 const content::MediaStreamDevices& devices) OVERRIDE; |
43 | 52 |
44 // Methods for observers. | 53 // Methods for observers. |
45 // Observers should add themselves on construction and remove themselves | 54 // Observers should add themselves on construction and remove themselves |
46 // on destruction. | 55 // on destruction. |
47 void AddObserver(MediaInternalsObserver* observer); | 56 void AddObserver(MediaInternalsObserver* observer); |
48 void RemoveObserver(MediaInternalsObserver* observer); | 57 void RemoveObserver(MediaInternalsObserver* observer); |
49 void SendEverything(); | 58 void SendEverything(); |
50 | 59 |
51 private: | 60 private: |
52 friend class MediaInternalsTest; | 61 friend class MediaInternalsTest; |
(...skipping 14 matching lines...) Expand all Loading... |
67 // id may be any depth, e.g. "video.decoders.1.2.3" | 76 // id may be any depth, e.g. "video.decoders.1.2.3" |
68 void UpdateItem(const std::string& update_fn, const std::string& id, | 77 void UpdateItem(const std::string& update_fn, const std::string& id, |
69 const std::string& property, Value* value); | 78 const std::string& property, Value* value); |
70 | 79 |
71 // Calls javascript |function|(|value|) on each attached UI. | 80 // Calls javascript |function|(|value|) on each attached UI. |
72 void SendUpdate(const std::string& function, Value* value); | 81 void SendUpdate(const std::string& function, Value* value); |
73 | 82 |
74 static MediaInternals* instance_; | 83 static MediaInternals* instance_; |
75 DictionaryValue data_; | 84 DictionaryValue data_; |
76 ObserverList<MediaInternalsObserver> observers_; | 85 ObserverList<MediaInternalsObserver> observers_; |
| 86 scoped_refptr<MediaStreamCaptureIndicator> media_stream_capture_indicator_; |
77 | 87 |
78 DISALLOW_COPY_AND_ASSIGN(MediaInternals); | 88 DISALLOW_COPY_AND_ASSIGN(MediaInternals); |
79 }; | 89 }; |
80 | 90 |
81 #endif // CHROME_BROWSER_MEDIA_MEDIA_INTERNALS_H_ | 91 #endif // CHROME_BROWSER_MEDIA_MEDIA_INTERNALS_H_ |
OLD | NEW |