Commit dea7b936 authored by grunell's avatar grunell Committed by Commit bot

Stricter default RequestMediaAccessPermission and CheckMediaAccessPermission implementations.

We should not end up in the default implementation and want to track if this happens.

* Add new media stream result, "not supported".
* Add an error log in RenderFrameHostDelegate and WebContentsDelegate default implementations of the above functions and in Request... also use the new result.

BUG=416233
NOTRY=true

Review URL: https://codereview.chromium.org/584383002

Cr-Commit-Position: refs/heads/master@{#296779}
parent 4d6eee4b
......@@ -39,16 +39,18 @@ WebContents* RenderFrameHostDelegate::GetAsWebContents() {
void RenderFrameHostDelegate::RequestMediaAccessPermission(
const MediaStreamRequest& request,
const MediaResponseCallback& callback) {
LOG(ERROR) << "RenderFrameHostDelegate::RequestMediaAccessPermission: "
<< "Not supported.";
callback.Run(MediaStreamDevices(),
MEDIA_DEVICE_INVALID_STATE,
MEDIA_DEVICE_NOT_SUPPORTED,
scoped_ptr<MediaStreamUI>());
}
bool RenderFrameHostDelegate::CheckMediaAccessPermission(
const GURL& security_origin,
MediaStreamType type) {
DCHECK(type == MEDIA_DEVICE_AUDIO_CAPTURE ||
type == MEDIA_DEVICE_VIDEO_CAPTURE);
LOG(ERROR) << "RenderFrameHostDelegate::CheckMediaAccessPermission: "
<< "Not supported.";
return false;
}
......
......@@ -164,8 +164,10 @@ void WebContentsDelegate::RequestMediaAccessPermission(
WebContents* web_contents,
const MediaStreamRequest& request,
const MediaResponseCallback& callback) {
LOG(ERROR) << "WebContentsDelegate::RequestMediaAccessPermission: "
<< "Not supported.";
callback.Run(MediaStreamDevices(),
MEDIA_DEVICE_INVALID_STATE,
MEDIA_DEVICE_NOT_SUPPORTED,
scoped_ptr<MediaStreamUI>());
}
......@@ -173,8 +175,8 @@ bool WebContentsDelegate::CheckMediaAccessPermission(
WebContents* web_contents,
const GURL& security_origin,
MediaStreamType type) {
DCHECK(type == MEDIA_DEVICE_AUDIO_CAPTURE ||
type == MEDIA_DEVICE_VIDEO_CAPTURE);
LOG(ERROR) << "WebContentsDelegate::CheckMediaAccessPermission: "
<< "Not supported.";
return false;
}
......
......@@ -79,7 +79,7 @@ enum MediaStreamRequestResult {
MEDIA_DEVICE_CAPTURE_FAILURE = 8,
MEDIA_DEVICE_CONSTRAINT_NOT_SATISFIED = 9,
MEDIA_DEVICE_TRACK_START_FAILURE = 10,
MEDIA_DEVICE_NOT_SUPPORTED = 11,
NUM_MEDIA_REQUEST_RESULTS
};
......
......@@ -46263,6 +46263,7 @@ To add a new entry, add it with any value and run test to compute valid value.
<int value="8" label="Capture Failure"/>
<int value="9" label="Constraint Not Satisfied"/>
<int value="10" label="Track Start Failure"/>
<int value="11" label="Not Supported"/>
</enum>
<enum name="MediaStreamRequestState" type="int">
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment