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

Side by Side Diff: chrome/browser/media/permission_bubble_media_access_handler.cc

Issue 1828803003: Media permissions: Remove plumbing for insecure pepper requests in Chrome (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address comments and fix tests Created 4 years, 6 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 unified diff | Download patch
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/media/permission_bubble_media_access_handler.h" 5 #include "chrome/browser/media/permission_bubble_media_access_handler.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/metrics/field_trial.h" 9 #include "base/metrics/field_trial.h"
10 #include "chrome/browser/media/media_permission.h" 10 #include "chrome/browser/media/media_permission.h"
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
85 content::WebContents* web_contents, 85 content::WebContents* web_contents,
86 const GURL& security_origin, 86 const GURL& security_origin,
87 content::MediaStreamType type, 87 content::MediaStreamType type,
88 const extensions::Extension* extension) { 88 const extensions::Extension* extension) {
89 Profile* profile = 89 Profile* profile =
90 Profile::FromBrowserContext(web_contents->GetBrowserContext()); 90 Profile::FromBrowserContext(web_contents->GetBrowserContext());
91 ContentSettingsType content_settings_type = 91 ContentSettingsType content_settings_type =
92 type == content::MEDIA_DEVICE_AUDIO_CAPTURE 92 type == content::MEDIA_DEVICE_AUDIO_CAPTURE
93 ? CONTENT_SETTINGS_TYPE_MEDIASTREAM_MIC 93 ? CONTENT_SETTINGS_TYPE_MEDIASTREAM_MIC
94 : CONTENT_SETTINGS_TYPE_MEDIASTREAM_CAMERA; 94 : CONTENT_SETTINGS_TYPE_MEDIASTREAM_CAMERA;
95 // TODO(raymes): This function may be called for a media request coming from
96 // Flash or from WebRTC. However, whether or not this is a request for Flash,
97 // in which case we would use MEDIA_OPEN_DEVICE_PEPPER_ONLY, isn't plumbed
98 // through. Fortunately, post M47, WebRTC requests can't be made from HTTP so
99 // we can assume all HTTP requests are for Flash for the purpose of the
100 // permission check. This special case should be removed after HTTP access for
101 // Flash has been deprecated (crbug.com/526324). See crbug.com/547654 for more
102 // details.
103 bool is_insecure_pepper_request = security_origin.SchemeIs(url::kHttpScheme);
104 95
105 MediaPermission permission( 96 MediaPermission permission(content_settings_type, security_origin,
106 content_settings_type, is_insecure_pepper_request, security_origin,
107 web_contents->GetLastCommittedURL().GetOrigin(), profile); 97 web_contents->GetLastCommittedURL().GetOrigin(), profile);
108 content::MediaStreamRequestResult unused; 98 content::MediaStreamRequestResult unused;
109 return permission.GetPermissionStatus(&unused) == CONTENT_SETTING_ALLOW; 99 return permission.GetPermissionStatus(&unused) == CONTENT_SETTING_ALLOW;
110 } 100 }
111 101
112 void PermissionBubbleMediaAccessHandler::HandleRequest( 102 void PermissionBubbleMediaAccessHandler::HandleRequest(
113 content::WebContents* web_contents, 103 content::WebContents* web_contents,
114 const content::MediaStreamRequest& request, 104 const content::MediaStreamRequest& request,
115 const content::MediaResponseCallback& callback, 105 const content::MediaResponseCallback& callback,
116 const extensions::Extension* extension) { 106 const extensions::Extension* extension) {
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after
247 int type, 237 int type,
248 const content::NotificationSource& source, 238 const content::NotificationSource& source,
249 const content::NotificationDetails& details) { 239 const content::NotificationDetails& details) {
250 DCHECK_CURRENTLY_ON(BrowserThread::UI); 240 DCHECK_CURRENTLY_ON(BrowserThread::UI);
251 if (type == content::NOTIFICATION_WEB_CONTENTS_DESTROYED) { 241 if (type == content::NOTIFICATION_WEB_CONTENTS_DESTROYED) {
252 content::WebContents* web_contents = 242 content::WebContents* web_contents =
253 content::Source<content::WebContents>(source).ptr(); 243 content::Source<content::WebContents>(source).ptr();
254 pending_requests_.erase(web_contents); 244 pending_requests_.erase(web_contents);
255 } 245 }
256 } 246 }
OLDNEW
« no previous file with comments | « chrome/browser/media/media_stream_devices_controller_browsertest.cc ('k') | chrome/browser/policy/policy_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698