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

Unified Diff: chrome/browser/media/webrtc/permission_bubble_media_access_handler.cc

Issue 2123863004: ScreenCapture for Android phase1, part II (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: address comments Created 4 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: chrome/browser/media/webrtc/permission_bubble_media_access_handler.cc
diff --git a/chrome/browser/media/webrtc/permission_bubble_media_access_handler.cc b/chrome/browser/media/webrtc/permission_bubble_media_access_handler.cc
index 1a9da71eb59bbf9ba6c26895b67cf9aa98aeb871..5b1855353838f0e904929e9e7048f3e0c30fc56b 100644
--- a/chrome/browser/media/webrtc/permission_bubble_media_access_handler.cc
+++ b/chrome/browser/media/webrtc/permission_bubble_media_access_handler.cc
@@ -24,7 +24,9 @@
#include "base/bind.h"
#include "base/bind_helpers.h"
+#include "chrome/browser/android/chrome_feature_list.h"
#include "chrome/browser/media/webrtc/media_stream_infobar_delegate_android.h"
+#include "chrome/browser/media/webrtc/screen_capture_infobar_delegate_android.h"
#include "chrome/browser/permissions/permission_update_infobar_delegate_android.h"
#else
#include "chrome/browser/permissions/permission_request_manager.h"
@@ -77,8 +79,14 @@ PermissionBubbleMediaAccessHandler::~PermissionBubbleMediaAccessHandler() {
bool PermissionBubbleMediaAccessHandler::SupportsStreamType(
const content::MediaStreamType type,
const extensions::Extension* extension) {
+#if BUILDFLAG(ANDROID_JAVA_UI)
+ return type == content::MEDIA_DEVICE_VIDEO_CAPTURE ||
+ type == content::MEDIA_DEVICE_AUDIO_CAPTURE ||
+ type == content::MEDIA_DESKTOP_VIDEO_CAPTURE;
+#else
return type == content::MEDIA_DEVICE_VIDEO_CAPTURE ||
type == content::MEDIA_DEVICE_AUDIO_CAPTURE;
+#endif
}
bool PermissionBubbleMediaAccessHandler::CheckMediaAccessPermission(
@@ -106,6 +114,18 @@ void PermissionBubbleMediaAccessHandler::HandleRequest(
const extensions::Extension* extension) {
DCHECK_CURRENTLY_ON(BrowserThread::UI);
+#if BUILDFLAG(ANDROID_JAVA_UI)
+ if (request.video_type == content::MEDIA_DESKTOP_VIDEO_CAPTURE &&
+ !base::FeatureList::IsEnabled(
+ chrome::android::kUserMediaScreenCapturing)) {
+ // If screen capturing isn't enabled on Android, we'll use "invalid state"
+ // as result, same as on desktop.
+ callback.Run(content::MediaStreamDevices(),
+ content::MEDIA_DEVICE_INVALID_STATE, nullptr);
+ return;
+ }
+#endif // BUILDFLAG(ANDROID_JAVA_UI)
+
RequestsQueue& queue = pending_requests_[web_contents];
queue.push_back(PendingAccessRequest(request, callback));
@@ -128,9 +148,20 @@ void PermissionBubbleMediaAccessHandler::ProcessQueuedAccessRequest(
DCHECK(!it->second.empty());
+ const content::MediaStreamRequest request = it->second.front().request;
+#if BUILDFLAG(ANDROID_JAVA_UI)
+ if (request.video_type == content::MEDIA_DESKTOP_VIDEO_CAPTURE) {
+ ScreenCaptureInfoBarDelegateAndroid::Create(
+ web_contents, request,
+ base::Bind(&PermissionBubbleMediaAccessHandler::OnAccessRequestResponse,
+ base::Unretained(this), web_contents));
+ return;
+ }
+#endif
+
std::unique_ptr<MediaStreamDevicesController> controller(
new MediaStreamDevicesController(
- web_contents, it->second.front().request,
+ web_contents, request,
base::Bind(
&PermissionBubbleMediaAccessHandler::OnAccessRequestResponse,
base::Unretained(this), web_contents)));

Powered by Google App Engine
This is Rietveld 408576698