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