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 "base/memory/ref_counted.h" |
8 #include "base/memory/singleton.h" | 9 #include "base/memory/singleton.h" |
9 #include "base/observer_list.h" | 10 #include "base/observer_list.h" |
10 #include "base/values.h" | 11 #include "base/values.h" |
11 #include "content/public/browser/media_observer.h" | 12 #include "content/public/browser/media_observer.h" |
12 #include "content/public/common/media_stream_request.h" | 13 #include "content/public/common/media_stream_request.h" |
13 | 14 |
14 class MediaInternalsObserver; | 15 class MediaInternalsObserver; |
15 class MediaStreamCaptureIndicator; | 16 class MediaStreamCaptureIndicator; |
16 | 17 |
17 namespace media { | 18 namespace media { |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
54 const content::MediaStreamDevice& device, | 55 const content::MediaStreamDevice& device, |
55 content::MediaRequestState state) OVERRIDE; | 56 content::MediaRequestState state) OVERRIDE; |
56 | 57 |
57 // Methods for observers. | 58 // Methods for observers. |
58 // Observers should add themselves on construction and remove themselves | 59 // Observers should add themselves on construction and remove themselves |
59 // on destruction. | 60 // on destruction. |
60 void AddObserver(MediaInternalsObserver* observer); | 61 void AddObserver(MediaInternalsObserver* observer); |
61 void RemoveObserver(MediaInternalsObserver* observer); | 62 void RemoveObserver(MediaInternalsObserver* observer); |
62 void SendEverything(); | 63 void SendEverything(); |
63 | 64 |
64 MediaStreamCaptureIndicator* media_stream_capture_indicator() { | 65 scoped_refptr<MediaStreamCaptureIndicator> GetMediaStreamCaptureIndicator(); |
65 return media_stream_capture_indicator_.get(); | |
66 } | |
67 | 66 |
68 private: | 67 private: |
69 friend class MediaInternalsTest; | 68 friend class MediaInternalsTest; |
70 friend struct DefaultSingletonTraits<MediaInternals>; | 69 friend struct DefaultSingletonTraits<MediaInternals>; |
71 | 70 |
72 MediaInternals(); | 71 MediaInternals(); |
73 | 72 |
74 // Sets |property| of an audio stream to |value| and notifies observers. | 73 // Sets |property| of an audio stream to |value| and notifies observers. |
75 // (host, stream_id) is a unique id for the audio stream. | 74 // (host, stream_id) is a unique id for the audio stream. |
76 // |host| will never be dereferenced. | 75 // |host| will never be dereferenced. |
77 void UpdateAudioStream(void* host, int stream_id, | 76 void UpdateAudioStream(void* host, int stream_id, |
78 const std::string& property, Value* value); | 77 const std::string& property, Value* value); |
79 | 78 |
80 // Removes |item| from |data_|. | 79 // Removes |item| from |data_|. |
81 void DeleteItem(const std::string& item); | 80 void DeleteItem(const std::string& item); |
82 | 81 |
83 // Sets data_.id.property = value and notifies attached UIs using update_fn. | 82 // Sets data_.id.property = value and notifies attached UIs using update_fn. |
84 // id may be any depth, e.g. "video.decoders.1.2.3" | 83 // id may be any depth, e.g. "video.decoders.1.2.3" |
85 void UpdateItem(const std::string& update_fn, const std::string& id, | 84 void UpdateItem(const std::string& update_fn, const std::string& id, |
86 const std::string& property, Value* value); | 85 const std::string& property, Value* value); |
87 | 86 |
88 // Calls javascript |function|(|value|) on each attached UI. | 87 // Calls javascript |function|(|value|) on each attached UI. |
89 void SendUpdate(const std::string& function, Value* value); | 88 void SendUpdate(const std::string& function, Value* value); |
90 | 89 |
91 DictionaryValue data_; | 90 DictionaryValue data_; |
92 ObserverList<MediaInternalsObserver> observers_; | 91 ObserverList<MediaInternalsObserver> observers_; |
93 scoped_ptr<MediaStreamCaptureIndicator> media_stream_capture_indicator_; | 92 scoped_refptr<MediaStreamCaptureIndicator> media_stream_capture_indicator_; |
94 | 93 |
95 DISALLOW_COPY_AND_ASSIGN(MediaInternals); | 94 DISALLOW_COPY_AND_ASSIGN(MediaInternals); |
96 }; | 95 }; |
97 | 96 |
98 #endif // CHROME_BROWSER_MEDIA_MEDIA_INTERNALS_H_ | 97 #endif // CHROME_BROWSER_MEDIA_MEDIA_INTERNALS_H_ |
OLD | NEW |