Chromium Code Reviews| Index: chrome/browser/media/media_stream_devices_controller.h |
| diff --git a/chrome/browser/media/media_stream_devices_controller.h b/chrome/browser/media/media_stream_devices_controller.h |
| index ab77eaad304993b8f9f4850915f03243d81e999b..11a851c60bda87f9ea5736be8422aef3e5436137 100644 |
| --- a/chrome/browser/media/media_stream_devices_controller.h |
| +++ b/chrome/browser/media/media_stream_devices_controller.h |
| @@ -9,7 +9,6 @@ |
| #include "content/public/browser/web_contents_delegate.h" |
| -class GURL; |
| class Profile; |
| class MediaStreamDevicesController { |
| @@ -29,26 +28,37 @@ class MediaStreamDevicesController { |
| // Public methods to be called by MediaStreamInfoBarDelegate; |
| bool has_audio() const { return has_audio_; } |
| bool has_video() const { return has_video_; } |
| + const std::string& GetSecurityOriginSpec() const; |
| content::MediaStreamDevices GetAudioDevices() const; |
| content::MediaStreamDevices GetVideoDevices() const; |
| - const GURL& GetSecurityOrigin() const; |
| + bool IsSafeToAlwaysAllowAudio() const; |
| + bool IsSafeToAlwaysAllowVideo() const; |
| void Accept(const std::string& audio_id, |
| const std::string& video_id, |
| bool always_allow); |
| void Deny(); |
| private: |
| - // Finds a device in the current request with the specified |id| and |type|, |
| - // adds it to the |devices| array and also return the name of the device. |
| - void AddDeviceWithId(content::MediaStreamDeviceType type, |
| - const std::string& id, |
| - content::MediaStreamDevices* devices, |
| - std::string* device_name); |
| + // Used by the various helper methods below to filter an operation on devices |
| + // of a particular type. |
| + typedef bool (*FilterByDeviceTypeFunc)(content::MediaStreamDeviceType); |
| + |
| + // Return true if a secure scheme is being used by the origin AND only |
|
no longer working on chromium
2012/08/31 13:38:22
nit, Returns
miu
2012/09/01 01:32:00
Done.
|
| + // devices of the given |user_type| are present in the subset of devices |
| + // selected by the |is_included| function. |
| + bool IsSafeToAlwaysAllow(FilterByDeviceTypeFunc is_included, |
| + content::MediaStreamDeviceType user_type) const; |
| // Returns true if the media section in content settings is set to |
| // |CONTENT_SETTING_BLOCK|, otherwise returns false. |
| bool IsMediaDeviceBlocked(); |
| + // NOTE on AlwaysAllowOrigin functionality: The rules only apply to user |
| + // capture devices, and not tab mirroring (or other types). Non-user capture |
| + // devices are always denied an AlwaysAllowOrigin status because they refer to |
| + // internal objects whose "IDs" might be re-used for different objects across |
| + // browser sessions. |
| + |
| // Returns true if request's origin is from internal objects like |
| // chrome://URLs, otherwise returns false. |
| bool ShouldAlwaysAllowOrigin(); |
| @@ -69,6 +79,17 @@ class MediaStreamDevicesController { |
| std::string GetFirstDeviceId(content::MediaStreamDeviceType type); |
| + // Find all devices passing the |is_included| predicate and copy them to the |
|
no longer working on chromium
2012/08/31 13:38:22
nit, finds, copies
miu
2012/09/01 01:32:00
Done.
|
| + // given output container. |
| + void FindSubsetOfDevices(FilterByDeviceTypeFunc is_included, |
| + content::MediaStreamDevices* out) const; |
| + |
| + // Find the first device with the given |device_id| within the subset of |
| + // devices passing the |is_included| predicate, or return NULL. |
| + const content::MediaStreamDevice* FindFirstDeviceWithIdInSubset( |
| + FilterByDeviceTypeFunc is_included, |
| + const std::string& device_id) const; |
| + |
| bool has_audio_; |
| bool has_video_; |