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

Unified Diff: content/browser/renderer_host/media/media_stream_ui_proxy.h

Issue 562263002: Check media permissions through RenderFrameHostDelegate. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@render_frame_get_sources
Patch Set: Rebase 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 side-by-side diff with in-line comments
Download patch
Index: content/browser/renderer_host/media/media_stream_ui_proxy.h
diff --git a/content/browser/renderer_host/media/media_stream_ui_proxy.h b/content/browser/renderer_host/media/media_stream_ui_proxy.h
index 810a29a5d812568f2397ed6e5dbe2ef2699d9523..cf5ba1ad127e729881b6e3cc0105bb0778ddc0be 100644
--- a/content/browser/renderer_host/media/media_stream_ui_proxy.h
+++ b/content/browser/renderer_host/media/media_stream_ui_proxy.h
@@ -41,6 +41,16 @@ class CONTENT_EXPORT MediaStreamUIProxy {
virtual void RequestAccess(const MediaStreamRequest& request,
const ResponseCallback& response_callback);
+ // Checks if we have permission to access the microphone or camera. Note that
+ // this does not query the user, it checks any stored settings such as policy
+ // or extension permissions. |type| must be MEDIA_DEVICE_AUDIO_CAPTURE
+ // or MEDIA_DEVICE_VIDEO_CAPTURE.
+ virtual void CheckAccess(const GURL& security_origin,
+ MediaStreamType type,
+ int render_process_id,
+ int render_frame_id,
+ const base::Callback<void(bool)>& callback);
+
// Notifies the UI that the MediaStream has been started. Must be called after
// access has been approved using RequestAccess(). |stop_callback| is be
// called on the IO thread after the user has requests the stream to be
@@ -65,6 +75,8 @@ class CONTENT_EXPORT MediaStreamUIProxy {
void ProcessStopRequestFromUI();
void OnWindowId(const WindowIdCallback& window_id_callback,
gfx::NativeViewId* window_id);
+ void OnCheckedAccess(const base::Callback<void(bool)>& callback,
+ bool have_access);
scoped_ptr<Core, content::BrowserThread::DeleteOnUIThread> core_;
ResponseCallback response_callback_;
@@ -81,17 +93,29 @@ class CONTENT_EXPORT FakeMediaStreamUIProxy : public MediaStreamUIProxy {
virtual ~FakeMediaStreamUIProxy();
void SetAvailableDevices(const MediaStreamDevices& devices);
+ void SetMicAccess(bool access);
+ void SetCameraAccess(bool access);
// MediaStreamUIProxy overrides.
virtual void RequestAccess(
const MediaStreamRequest& request,
const ResponseCallback& response_callback) OVERRIDE;
+ virtual void CheckAccess(const GURL& security_origin,
+ MediaStreamType type,
+ int render_process_id,
+ int render_frame_id,
+ const base::Callback<void(bool)>& callback) OVERRIDE;
virtual void OnStarted(const base::Closure& stop_callback,
const WindowIdCallback& window_id_callback) OVERRIDE;
private:
+ // This is used for RequestAccess().
MediaStreamDevices devices_;
+ // These are used for CheckAccess().
+ bool mic_access_;
+ bool camera_access_;
+
DISALLOW_COPY_AND_ASSIGN(FakeMediaStreamUIProxy);
};

Powered by Google App Engine
This is Rietveld 408576698