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

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

Issue 1928493002: Use url::Origin to represent security origins in MediaStream-related code. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 4 years, 7 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 // AudioRendererHost serves audio related requests from AudioRenderer which 5 // AudioRendererHost serves audio related requests from AudioRenderer which
6 // lives inside the render process and provide access to audio hardware. 6 // lives inside the render process and provide access to audio hardware.
7 // 7 //
8 // This class is owned by RenderProcessHostImpl, and instantiated on UI 8 // This class is owned by RenderProcessHostImpl, and instantiated on UI
9 // thread, but all other operations and method calls happen on IO thread, so we 9 // thread, but all other operations and method calls happen on IO thread, so we
10 // need to be extra careful about the lifetime of this object. AudioManager is a 10 // need to be extra careful about the lifetime of this object. AudioManager is a
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after
140 // |session_id| is used for unified IO to find out which input device to be 140 // |session_id| is used for unified IO to find out which input device to be
141 // opened for the stream. For clients that do not use unified IO, 141 // opened for the stream. For clients that do not use unified IO,
142 // |session_id| will be ignored and the given |device_id| and 142 // |session_id| will be ignored and the given |device_id| and
143 // |security_origin| will be used to select the output device. 143 // |security_origin| will be used to select the output device.
144 // Upon completion of the process, the peer is notified with the device output 144 // Upon completion of the process, the peer is notified with the device output
145 // parameters via the NotifyDeviceAuthorized message. 145 // parameters via the NotifyDeviceAuthorized message.
146 void OnRequestDeviceAuthorization(int stream_id, 146 void OnRequestDeviceAuthorization(int stream_id,
147 int render_frame_id, 147 int render_frame_id,
148 int session_id, 148 int session_id,
149 const std::string& device_id, 149 const std::string& device_id,
150 const url::Origin& gurl_security_origin); 150 const url::Origin& security_origin);
151 151
152 // Creates an audio output stream with the specified format. 152 // Creates an audio output stream with the specified format.
153 // Upon success/failure, the peer is notified via the NotifyStreamCreated 153 // Upon success/failure, the peer is notified via the NotifyStreamCreated
154 // message. 154 // message.
155 void OnCreateStream(int stream_id, 155 void OnCreateStream(int stream_id,
156 int render_frame_id, 156 int render_frame_id,
157 const media::AudioParameters& params); 157 const media::AudioParameters& params);
158 158
159 // Play the audio stream referenced by |stream_id|. 159 // Play the audio stream referenced by |stream_id|.
160 void OnPlayStream(int stream_id); 160 void OnPlayStream(int stream_id);
161 161
162 // Pause the audio stream referenced by |stream_id|. 162 // Pause the audio stream referenced by |stream_id|.
163 void OnPauseStream(int stream_id); 163 void OnPauseStream(int stream_id);
164 164
165 // Close the audio stream referenced by |stream_id|. 165 // Close the audio stream referenced by |stream_id|.
166 void OnCloseStream(int stream_id); 166 void OnCloseStream(int stream_id);
167 167
168 // Set the volume of the audio stream referenced by |stream_id|. 168 // Set the volume of the audio stream referenced by |stream_id|.
169 void OnSetVolume(int stream_id, double volume); 169 void OnSetVolume(int stream_id, double volume);
170 170
171 // Helper methods. 171 // Helper methods.
172 172
173 // Proceed with device authorization after checking permissions. 173 // Proceed with device authorization after checking permissions.
174 void OnDeviceAuthorized(int stream_id, 174 void OnDeviceAuthorized(int stream_id,
175 const std::string& device_id, 175 const std::string& device_id,
176 const GURL& security_origin, 176 const url::Origin& security_origin,
177 bool have_access); 177 bool have_access);
178 178
179 // Proceed with device authorization after translating device ID. 179 // Proceed with device authorization after translating device ID.
180 void OnDeviceIDTranslated(int stream_id, 180 void OnDeviceIDTranslated(int stream_id,
181 bool device_found, 181 bool device_found,
182 const AudioOutputDeviceInfo& device_info); 182 const AudioOutputDeviceInfo& device_info);
183 183
184 // Start the actual creation of an audio stream, after the device 184 // Start the actual creation of an audio stream, after the device
185 // authorization process is complete. 185 // authorization process is complete.
186 void DoCreateStream(int stream_id, 186 void DoCreateStream(int stream_id,
(...skipping 25 matching lines...) Expand all
212 // Returns NULL if not found. 212 // Returns NULL if not found.
213 AudioEntry* LookupById(int stream_id); 213 AudioEntry* LookupById(int stream_id);
214 214
215 // A helper method to update the number of playing streams and alert the 215 // A helper method to update the number of playing streams and alert the
216 // ResourceScheduler when the renderer starts or stops playing an audiostream. 216 // ResourceScheduler when the renderer starts or stops playing an audiostream.
217 void UpdateNumPlayingStreams(AudioEntry* entry, bool is_playing); 217 void UpdateNumPlayingStreams(AudioEntry* entry, bool is_playing);
218 218
219 // Check if the renderer process has access to the requested output device. 219 // Check if the renderer process has access to the requested output device.
220 void CheckOutputDeviceAccess(int render_frame_id, 220 void CheckOutputDeviceAccess(int render_frame_id,
221 const std::string& device_id, 221 const std::string& device_id,
222 const GURL& gurl_security_origin, 222 const url::Origin& security_origin,
223 const OutputDeviceAccessCB& callback); 223 const OutputDeviceAccessCB& callback);
224 224
225 // Invoke |callback| after permission to use a device has been checked. 225 // Invoke |callback| after permission to use a device has been checked.
226 void AccessChecked(std::unique_ptr<MediaStreamUIProxy> ui_proxy, 226 void AccessChecked(std::unique_ptr<MediaStreamUIProxy> ui_proxy,
227 const OutputDeviceAccessCB& callback, 227 const OutputDeviceAccessCB& callback,
228 bool have_access); 228 bool have_access);
229 229
230 // Translate the hashed |device_id| to a unique device ID. 230 // Translate the hashed |device_id| to a unique device ID.
231 void TranslateDeviceID(const std::string& device_id, 231 void TranslateDeviceID(const std::string& device_id,
232 const GURL& gurl_security_origin, 232 const url::Origin& security_origin,
233 const OutputDeviceInfoCB& callback, 233 const OutputDeviceInfoCB& callback,
234 const AudioOutputDeviceEnumeration& enumeration); 234 const AudioOutputDeviceEnumeration& enumeration);
235 235
236 // Helper method to check if the authorization procedure for stream 236 // Helper method to check if the authorization procedure for stream
237 // |stream_id| has started. 237 // |stream_id| has started.
238 bool IsAuthorizationStarted(int stream_id); 238 bool IsAuthorizationStarted(int stream_id);
239 239
240 // ID of the RenderProcessHost that owns this instance. 240 // ID of the RenderProcessHost that owns this instance.
241 const int render_process_id_; 241 const int render_process_id_;
242 242
(...skipping 23 matching lines...) Expand all
266 // The maximum number of simultaneous streams during the lifetime of this 266 // The maximum number of simultaneous streams during the lifetime of this
267 // host. Reported as UMA stat at shutdown. 267 // host. Reported as UMA stat at shutdown.
268 size_t max_simultaneous_streams_; 268 size_t max_simultaneous_streams_;
269 269
270 DISALLOW_COPY_AND_ASSIGN(AudioRendererHost); 270 DISALLOW_COPY_AND_ASSIGN(AudioRendererHost);
271 }; 271 };
272 272
273 } // namespace content 273 } // namespace content
274 274
275 #endif // CONTENT_BROWSER_RENDERER_HOST_MEDIA_AUDIO_RENDERER_HOST_H_ 275 #endif // CONTENT_BROWSER_RENDERER_HOST_MEDIA_AUDIO_RENDERER_HOST_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698