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 CONTENT_BROWSER_MEDIA_MEDIA_INTERNALS_H_ | 5 #ifndef CONTENT_BROWSER_MEDIA_MEDIA_INTERNALS_H_ |
6 #define CONTENT_BROWSER_MEDIA_MEDIA_INTERNALS_H_ | 6 #define CONTENT_BROWSER_MEDIA_MEDIA_INTERNALS_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 16 matching lines...) Expand all Loading... |
27 | 27 |
28 // This class stores information about currently active media. | 28 // This class stores information about currently active media. |
29 class CONTENT_EXPORT MediaInternals | 29 class CONTENT_EXPORT MediaInternals |
30 : NON_EXPORTED_BASE(public media::AudioLogFactory) { | 30 : NON_EXPORTED_BASE(public media::AudioLogFactory) { |
31 public: | 31 public: |
32 // Called with the update string. | 32 // Called with the update string. |
33 typedef base::Callback<void(const base::string16&)> UpdateCallback; | 33 typedef base::Callback<void(const base::string16&)> UpdateCallback; |
34 | 34 |
35 static MediaInternals* GetInstance(); | 35 static MediaInternals* GetInstance(); |
36 | 36 |
37 virtual ~MediaInternals(); | 37 ~MediaInternals() override; |
38 | 38 |
39 // Called when a MediaEvent occurs. | 39 // Called when a MediaEvent occurs. |
40 void OnMediaEvents(int render_process_id, | 40 void OnMediaEvents(int render_process_id, |
41 const std::vector<media::MediaLogEvent>& events); | 41 const std::vector<media::MediaLogEvent>& events); |
42 | 42 |
43 // Add/remove update callbacks (see above). Must be called on the IO thread. | 43 // Add/remove update callbacks (see above). Must be called on the IO thread. |
44 void AddUpdateCallback(const UpdateCallback& callback); | 44 void AddUpdateCallback(const UpdateCallback& callback); |
45 void RemoveUpdateCallback(const UpdateCallback& callback); | 45 void RemoveUpdateCallback(const UpdateCallback& callback); |
46 | 46 |
47 // Sends all audio cached data to each registered UpdateCallback. | 47 // Sends all audio cached data to each registered UpdateCallback. |
48 void SendAudioStreamData(); | 48 void SendAudioStreamData(); |
49 | 49 |
50 // Sends all video capture capabilities cached data to each registered | 50 // Sends all video capture capabilities cached data to each registered |
51 // UpdateCallback. | 51 // UpdateCallback. |
52 void SendVideoCaptureDeviceCapabilities(); | 52 void SendVideoCaptureDeviceCapabilities(); |
53 | 53 |
54 // Called to inform of the capabilities enumerated for video devices. | 54 // Called to inform of the capabilities enumerated for video devices. |
55 void UpdateVideoCaptureDeviceCapabilities( | 55 void UpdateVideoCaptureDeviceCapabilities( |
56 const media::VideoCaptureDeviceInfos& video_capture_device_infos); | 56 const media::VideoCaptureDeviceInfos& video_capture_device_infos); |
57 | 57 |
58 // AudioLogFactory implementation. Safe to call from any thread. | 58 // AudioLogFactory implementation. Safe to call from any thread. |
59 virtual scoped_ptr<media::AudioLog> CreateAudioLog( | 59 scoped_ptr<media::AudioLog> CreateAudioLog(AudioComponent component) override; |
60 AudioComponent component) override; | |
61 | 60 |
62 private: | 61 private: |
63 friend class AudioLogImpl; | 62 friend class AudioLogImpl; |
64 friend class MediaInternalsTest; | 63 friend class MediaInternalsTest; |
65 friend struct base::DefaultLazyInstanceTraits<MediaInternals>; | 64 friend struct base::DefaultLazyInstanceTraits<MediaInternals>; |
66 | 65 |
67 MediaInternals(); | 66 MediaInternals(); |
68 | 67 |
69 // Sends |update| to each registered UpdateCallback. Safe to call from any | 68 // Sends |update| to each registered UpdateCallback. Safe to call from any |
70 // thread, but will forward to the IO thread. | 69 // thread, but will forward to the IO thread. |
(...skipping 18 matching lines...) Expand all Loading... |
89 base::Lock lock_; | 88 base::Lock lock_; |
90 base::DictionaryValue audio_streams_cached_data_; | 89 base::DictionaryValue audio_streams_cached_data_; |
91 int owner_ids_[AUDIO_COMPONENT_MAX]; | 90 int owner_ids_[AUDIO_COMPONENT_MAX]; |
92 | 91 |
93 DISALLOW_COPY_AND_ASSIGN(MediaInternals); | 92 DISALLOW_COPY_AND_ASSIGN(MediaInternals); |
94 }; | 93 }; |
95 | 94 |
96 } // namespace content | 95 } // namespace content |
97 | 96 |
98 #endif // CONTENT_BROWSER_MEDIA_MEDIA_INTERNALS_H_ | 97 #endif // CONTENT_BROWSER_MEDIA_MEDIA_INTERNALS_H_ |
OLD | NEW |