Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(334)

Side by Side Diff: content/browser/renderer_host/media/media_stream_manager.h

Issue 667943003: Standardize usage of virtual/override/final in content/browser/ (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 // MediaStreamManager is used to open/enumerate media capture devices (video 5 // MediaStreamManager is used to open/enumerate media capture devices (video
6 // supported now). Call flow: 6 // supported now). Call flow:
7 // 1. GenerateStream is called when a render process wants to use a capture 7 // 1. GenerateStream is called when a render process wants to use a capture
8 // device. 8 // device.
9 // 2. MediaStreamManager will ask MediaStreamUIController for permission to 9 // 2. MediaStreamManager will ask MediaStreamUIController for permission to
10 // use devices and for which device to use. 10 // use devices and for which device to use.
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
65 public base::MessageLoop::DestructionObserver, 65 public base::MessageLoop::DestructionObserver,
66 public base::PowerObserver, 66 public base::PowerObserver,
67 public base::SystemMonitor::DevicesChangedObserver { 67 public base::SystemMonitor::DevicesChangedObserver {
68 public: 68 public:
69 // Callback to deliver the result of a media request. 69 // Callback to deliver the result of a media request.
70 typedef base::Callback<void(const MediaStreamDevices& devices, 70 typedef base::Callback<void(const MediaStreamDevices& devices,
71 scoped_ptr<MediaStreamUIProxy> ui)> 71 scoped_ptr<MediaStreamUIProxy> ui)>
72 MediaRequestResponseCallback; 72 MediaRequestResponseCallback;
73 73
74 explicit MediaStreamManager(media::AudioManager* audio_manager); 74 explicit MediaStreamManager(media::AudioManager* audio_manager);
75 virtual ~MediaStreamManager(); 75 ~MediaStreamManager() override;
76 76
77 // Used to access VideoCaptureManager. 77 // Used to access VideoCaptureManager.
78 VideoCaptureManager* video_capture_manager(); 78 VideoCaptureManager* video_capture_manager();
79 79
80 // Used to access AudioInputDeviceManager. 80 // Used to access AudioInputDeviceManager.
81 AudioInputDeviceManager* audio_input_device_manager(); 81 AudioInputDeviceManager* audio_input_device_manager();
82 82
83 // Creates a new media access request which is identified by a unique string 83 // Creates a new media access request which is identified by a unique string
84 // that's returned to the caller. This will trigger the infobar and ask users 84 // that's returned to the caller. This will trigger the infobar and ask users
85 // for access to the device. |render_process_id| and |render_frame_id| are 85 // for access to the device. |render_process_id| and |render_frame_id| are
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
158 const ResourceContext::SaltCallback& rc, 158 const ResourceContext::SaltCallback& rc,
159 const GURL& security_origin, 159 const GURL& security_origin,
160 const std::string& source_id, 160 const std::string& source_id,
161 std::string* device_id) const; 161 std::string* device_id) const;
162 162
163 // Called by UI to make sure the device monitor is started so that UI receive 163 // Called by UI to make sure the device monitor is started so that UI receive
164 // notifications about device changes. 164 // notifications about device changes.
165 void EnsureDeviceMonitorStarted(); 165 void EnsureDeviceMonitorStarted();
166 166
167 // Implements MediaStreamProviderListener. 167 // Implements MediaStreamProviderListener.
168 virtual void Opened(MediaStreamType stream_type, 168 void Opened(MediaStreamType stream_type, int capture_session_id) override;
169 int capture_session_id) override; 169 void Closed(MediaStreamType stream_type, int capture_session_id) override;
170 virtual void Closed(MediaStreamType stream_type, 170 void DevicesEnumerated(MediaStreamType stream_type,
171 int capture_session_id) override; 171 const StreamDeviceInfoArray& devices) override;
172 virtual void DevicesEnumerated(MediaStreamType stream_type, 172 void Aborted(MediaStreamType stream_type, int capture_session_id) override;
173 const StreamDeviceInfoArray& devices) override;
174 virtual void Aborted(MediaStreamType stream_type,
175 int capture_session_id) override;
176 173
177 // Implements base::SystemMonitor::DevicesChangedObserver. 174 // Implements base::SystemMonitor::DevicesChangedObserver.
178 virtual void OnDevicesChanged( 175 void OnDevicesChanged(base::SystemMonitor::DeviceType device_type) override;
179 base::SystemMonitor::DeviceType device_type) override;
180 176
181 // Called by the tests to specify a fake UI that should be used for next 177 // Called by the tests to specify a fake UI that should be used for next
182 // generated stream (or when using --use-fake-ui-for-media-stream). 178 // generated stream (or when using --use-fake-ui-for-media-stream).
183 void UseFakeUI(scoped_ptr<FakeMediaStreamUIProxy> fake_ui); 179 void UseFakeUI(scoped_ptr<FakeMediaStreamUIProxy> fake_ui);
184 180
185 // Returns all devices currently opened by a request with label |label|. 181 // Returns all devices currently opened by a request with label |label|.
186 // If no request with |label| exist, an empty array is returned. 182 // If no request with |label| exist, an empty array is returned.
187 StreamDeviceInfoArray GetDevicesOpenedByRequest( 183 StreamDeviceInfoArray GetDevicesOpenedByRequest(
188 const std::string& label) const; 184 const std::string& label) const;
189 185
190 // This object gets deleted on the UI thread after the IO thread has been 186 // This object gets deleted on the UI thread after the IO thread has been
191 // destroyed. So we need to know when IO thread is being destroyed so that 187 // destroyed. So we need to know when IO thread is being destroyed so that
192 // we can delete VideoCaptureManager and AudioInputDeviceManager. Normally 188 // we can delete VideoCaptureManager and AudioInputDeviceManager. Normally
193 // this is handled by 189 // this is handled by
194 // base::MessageLoop::DestructionObserver::WillDestroyCurrentMessageLoop. 190 // base::MessageLoop::DestructionObserver::WillDestroyCurrentMessageLoop.
195 // But for some tests which use TestBrowserThreadBundle, we need to call 191 // But for some tests which use TestBrowserThreadBundle, we need to call
196 // WillDestroyCurrentMessageLoop explicitly because the notification happens 192 // WillDestroyCurrentMessageLoop explicitly because the notification happens
197 // too late. (see http://crbug.com/247525#c14). 193 // too late. (see http://crbug.com/247525#c14).
198 virtual void WillDestroyCurrentMessageLoop() override; 194 void WillDestroyCurrentMessageLoop() override;
199 195
200 // Sends log messages to the render process hosts whose corresponding render 196 // Sends log messages to the render process hosts whose corresponding render
201 // processes are making device requests, to be used by the 197 // processes are making device requests, to be used by the
202 // webrtcLoggingPrivate API if requested. 198 // webrtcLoggingPrivate API if requested.
203 void AddLogMessageOnIOThread(const std::string& message); 199 void AddLogMessageOnIOThread(const std::string& message);
204 200
205 // Adds |message| to native logs for outstanding device requests, for use by 201 // Adds |message| to native logs for outstanding device requests, for use by
206 // render processes hosts whose corresponding render processes are requesting 202 // render processes hosts whose corresponding render processes are requesting
207 // logging from webrtcLoggingPrivate API. Safe to call from any thread. 203 // logging from webrtcLoggingPrivate API. Safe to call from any thread.
208 static void SendMessageToNativeLog(const std::string& message); 204 static void SendMessageToNativeLog(const std::string& message);
209 205
210 // base::PowerObserver overrides. 206 // base::PowerObserver overrides.
211 virtual void OnSuspend() override; 207 void OnSuspend() override;
212 virtual void OnResume() override; 208 void OnResume() override;
213 209
214 protected: 210 protected:
215 // Used for testing. 211 // Used for testing.
216 MediaStreamManager(); 212 MediaStreamManager();
217 213
218 private: 214 private:
219 // Contains all data needed to keep track of requests. 215 // Contains all data needed to keep track of requests.
220 class DeviceRequest; 216 class DeviceRequest;
221 217
222 // Cache enumerated device list. 218 // Cache enumerated device list.
(...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after
416 412
417 bool use_fake_ui_; 413 bool use_fake_ui_;
418 scoped_ptr<FakeMediaStreamUIProxy> fake_ui_; 414 scoped_ptr<FakeMediaStreamUIProxy> fake_ui_;
419 415
420 DISALLOW_COPY_AND_ASSIGN(MediaStreamManager); 416 DISALLOW_COPY_AND_ASSIGN(MediaStreamManager);
421 }; 417 };
422 418
423 } // namespace content 419 } // namespace content
424 420
425 #endif // CONTENT_BROWSER_RENDERER_HOST_MEDIA_MEDIA_STREAM_MANAGER_H_ 421 #endif // CONTENT_BROWSER_RENDERER_HOST_MEDIA_MEDIA_STREAM_MANAGER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698