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

Unified Diff: content/browser/renderer_host/media/media_stream_manager.cc

Issue 180633008: Add different error codes for getUserMedia. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fixed comments Created 6 years, 10 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_manager.cc
diff --git a/content/browser/renderer_host/media/media_stream_manager.cc b/content/browser/renderer_host/media/media_stream_manager.cc
index 14c0d4dc4675bb96ae83d0b79c0eb23a82f6ca30..f48a1bb13424f6552137cfb0cee4cd3142cd1a34 100644
--- a/content/browser/renderer_host/media/media_stream_manager.cc
+++ b/content/browser/renderer_host/media/media_stream_manager.cc
@@ -1030,7 +1030,7 @@ void MediaStreamManager::SetupRequest(const std::string& label) {
if (!request->security_origin.is_valid()) {
LOG(ERROR) << "Invalid security origin. "
<< request->security_origin;
- FinalizeRequestFailed(label, request);
+ FinalizeRequestFailed(label, request, content::INVALID_SECURITY_ORIGIN);
return;
}
@@ -1044,14 +1044,14 @@ void MediaStreamManager::SetupRequest(const std::string& label) {
audio_type == MEDIA_TAB_AUDIO_CAPTURE ||
video_type == MEDIA_TAB_VIDEO_CAPTURE;
if (is_web_contents_capture && !SetupTabCaptureRequest(request)) {
- FinalizeRequestFailed(label, request);
+ FinalizeRequestFailed(label, request, content::TAB_CAPTURE_FAILURE);
return;
}
bool is_screen_capture =
video_type == MEDIA_DESKTOP_VIDEO_CAPTURE;
if (is_screen_capture && !SetupScreenCaptureRequest(request)) {
- FinalizeRequestFailed(label, request);
+ FinalizeRequestFailed(label, request, content::SCREEN_CAPTURE_FAILURE);
return;
}
@@ -1078,7 +1078,7 @@ void MediaStreamManager::SetupRequest(const std::string& label) {
}
if (!SetupDeviceCaptureRequest(request)) {
- FinalizeRequestFailed(label, request);
+ FinalizeRequestFailed(label, request, content::DEVICE_CAPTURE_FAILURE);
return;
}
}
@@ -1273,11 +1273,13 @@ void MediaStreamManager::FinalizeGenerateStream(const std::string& label,
void MediaStreamManager::FinalizeRequestFailed(
const std::string& label,
- DeviceRequest* request) {
+ DeviceRequest* request,
+ content::MediaStreamRequestResult result) {
if (request->requester)
request->requester->StreamGenerationFailed(
request->requesting_view_id,
- request->page_request_id);
+ request->page_request_id,
+ result);
if (request->request_type == MEDIA_DEVICE_ACCESS &&
!request->callback.is_null()) {
@@ -1524,7 +1526,7 @@ void MediaStreamManager::DevicesEnumerated(
break;
}
if (!SetupDeviceCaptureRequest(request))
- FinalizeRequestFailed(*it, request);
+ FinalizeRequestFailed(*it, request, content::DEVICE_CAPTURE_FAILURE);
else
PostRequestToUI(*it, request);
break;
@@ -1590,7 +1592,8 @@ void MediaStreamManager::AddLogMessageOnUIThread(
void MediaStreamManager::HandleAccessRequestResponse(
const std::string& label,
- const MediaStreamDevices& devices) {
+ const MediaStreamDevices& devices,
+ content::MediaStreamRequestResult result) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
DVLOG(1) << "HandleAccessRequestResponse("
<< ", {label = " << label << "})";
@@ -1607,8 +1610,8 @@ void MediaStreamManager::HandleAccessRequestResponse(
}
// Handle the case when the request was denied.
- if (devices.empty()) {
- FinalizeRequestFailed(label, request);
+ if (result != content::OK) {
+ FinalizeRequestFailed(label, request, result);
return;
}

Powered by Google App Engine
This is Rietveld 408576698