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

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

Issue 483523006: Check all settings when checking mic and camera access (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Build fix for Android. Created 6 years, 3 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 | Annotate | Revision Log
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 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
43 #include "content/public/browser/media_request_state.h" 43 #include "content/public/browser/media_request_state.h"
44 #include "content/public/browser/resource_context.h" 44 #include "content/public/browser/resource_context.h"
45 45
46 namespace media { 46 namespace media {
47 class AudioManager; 47 class AudioManager;
48 } 48 }
49 49
50 namespace content { 50 namespace content {
51 51
52 class AudioInputDeviceManager; 52 class AudioInputDeviceManager;
53 class BrowserContext;
53 class FakeMediaStreamUIProxy; 54 class FakeMediaStreamUIProxy;
54 class MediaStreamDeviceSettings; 55 class MediaStreamDeviceSettings;
55 class MediaStreamRequester; 56 class MediaStreamRequester;
56 class MediaStreamUIProxy; 57 class MediaStreamUIProxy;
57 class VideoCaptureManager; 58 class VideoCaptureManager;
58 59
59 // MediaStreamManager is used to generate and close new media devices, not to 60 // MediaStreamManager is used to generate and close new media devices, not to
60 // start the media flow. The classes requesting new media streams are answered 61 // start the media flow. The classes requesting new media streams are answered
61 // using MediaStreamRequester. 62 // using MediaStreamRequester.
62 class CONTENT_EXPORT MediaStreamManager 63 class CONTENT_EXPORT MediaStreamManager
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
122 int render_frame_id, 123 int render_frame_id,
123 const std::string& device_id); 124 const std::string& device_id);
124 125
125 // Gets a list of devices of |type|, which must be MEDIA_DEVICE_AUDIO_CAPTURE 126 // Gets a list of devices of |type|, which must be MEDIA_DEVICE_AUDIO_CAPTURE
126 // or MEDIA_DEVICE_VIDEO_CAPTURE. 127 // or MEDIA_DEVICE_VIDEO_CAPTURE.
127 // The request is identified using the string returned to the caller. 128 // The request is identified using the string returned to the caller.
128 // When the |requester| is NULL, MediaStreamManager will enumerate both audio 129 // When the |requester| is NULL, MediaStreamManager will enumerate both audio
129 // and video devices and also start monitoring device changes, such as 130 // and video devices and also start monitoring device changes, such as
130 // plug/unplug. The new device lists will be delivered via media observer to 131 // plug/unplug. The new device lists will be delivered via media observer to
131 // MediaCaptureDevicesDispatcher. 132 // MediaCaptureDevicesDispatcher.
132 // If |have_permission| is false, we remove the device label from the result.
133 virtual std::string EnumerateDevices(MediaStreamRequester* requester, 133 virtual std::string EnumerateDevices(MediaStreamRequester* requester,
134 int render_process_id, 134 int render_process_id,
135 int render_frame_id, 135 int render_frame_id,
136 const ResourceContext::SaltCallback& sc, 136 const ResourceContext::SaltCallback& sc,
137 int page_request_id, 137 int page_request_id,
138 MediaStreamType type, 138 MediaStreamType type,
139 const GURL& security_origin, 139 const GURL& security_origin);
140 bool have_permission);
141 140
142 // Open a device identified by |device_id|. |type| must be either 141 // Open a device identified by |device_id|. |type| must be either
143 // MEDIA_DEVICE_AUDIO_CAPTURE or MEDIA_DEVICE_VIDEO_CAPTURE. 142 // MEDIA_DEVICE_AUDIO_CAPTURE or MEDIA_DEVICE_VIDEO_CAPTURE.
144 // The request is identified using string returned to the caller. 143 // The request is identified using string returned to the caller.
145 void OpenDevice(MediaStreamRequester* requester, 144 void OpenDevice(MediaStreamRequester* requester,
146 int render_process_id, 145 int render_process_id,
147 int render_frame_id, 146 int render_frame_id,
148 const ResourceContext::SaltCallback& sc, 147 const ResourceContext::SaltCallback& sc,
149 int page_request_id, 148 int page_request_id,
150 const std::string& device_id, 149 const std::string& device_id,
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after
316 DeviceRequest* request, 315 DeviceRequest* request,
317 content::MediaStreamRequestResult result); 316 content::MediaStreamRequestResult result);
318 void FinalizeOpenDevice(const std::string& label, 317 void FinalizeOpenDevice(const std::string& label,
319 DeviceRequest* request); 318 DeviceRequest* request);
320 void FinalizeMediaAccessRequest(const std::string& label, 319 void FinalizeMediaAccessRequest(const std::string& label,
321 DeviceRequest* request, 320 DeviceRequest* request,
322 const MediaStreamDevices& devices); 321 const MediaStreamDevices& devices);
323 void FinalizeEnumerateDevices(const std::string& label, 322 void FinalizeEnumerateDevices(const std::string& label,
324 DeviceRequest* request); 323 DeviceRequest* request);
325 324
325 // Checks for media access. Overridden by unit tests.
326 virtual bool CheckMediaAccessPermissionOnUIThread(int render_process_id,
327 const GURL& security_origin,
328 MediaStreamType type);
329 void HandleCheckMediaAccessResponse(const std::string& label,
330 bool have_access);
331
326 // This method is called when an audio or video device is plugged in or 332 // This method is called when an audio or video device is plugged in or
327 // removed. It make sure all MediaStreams that use a removed device is 333 // removed. It make sure all MediaStreams that use a removed device is
328 // stopped and that the render process is notified. |old_devices| is the list 334 // stopped and that the render process is notified. |old_devices| is the list
329 // of previously available devices. |new_devices| is the new 335 // of previously available devices. |new_devices| is the new
330 // list of currently available devices. 336 // list of currently available devices.
331 void StopRemovedDevices(const StreamDeviceInfoArray& old_devices, 337 void StopRemovedDevices(const StreamDeviceInfoArray& old_devices,
332 const StreamDeviceInfoArray& new_devices); 338 const StreamDeviceInfoArray& new_devices);
333 // Helper method used by StopRemovedDevices to stop the use of a certain 339 // Helper method used by StopRemovedDevices to stop the use of a certain
334 // device. 340 // device.
335 void StopRemovedDevice(const MediaStreamDevice& device); 341 void StopRemovedDevice(const MediaStreamDevice& device);
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
393 399
394 bool use_fake_ui_; 400 bool use_fake_ui_;
395 scoped_ptr<FakeMediaStreamUIProxy> fake_ui_; 401 scoped_ptr<FakeMediaStreamUIProxy> fake_ui_;
396 402
397 DISALLOW_COPY_AND_ASSIGN(MediaStreamManager); 403 DISALLOW_COPY_AND_ASSIGN(MediaStreamManager);
398 }; 404 };
399 405
400 } // namespace content 406 } // namespace content
401 407
402 #endif // CONTENT_BROWSER_RENDERER_HOST_MEDIA_MEDIA_STREAM_MANAGER_H_ 408 #endif // CONTENT_BROWSER_RENDERER_HOST_MEDIA_MEDIA_STREAM_MANAGER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698