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

Unified Diff: chrome/browser/media/media_stream_devices_controller.h

Issue 10912004: Begin adding support for tab mirroring via the MediaStream audio/video capturing (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 4 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 side-by-side diff with in-line comments
Download patch
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_;

Powered by Google App Engine
This is Rietveld 408576698