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

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

Issue 2759593002: Remove c/b/media/webrtc/media_permission.{h,cc} (Closed)
Patch Set: Remove c/b/media/webrtc/media_permission.{h,cc} Created 3 years, 8 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
« no previous file with comments | « chrome/browser/media/webrtc/media_stream_devices_controller.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/webrtc/permission_bubble_media_access_handler.h" 5 #include "chrome/browser/media/webrtc/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/webrtc/media_permission.h"
11 #include "chrome/browser/media/webrtc/media_stream_device_permissions.h" 10 #include "chrome/browser/media/webrtc/media_stream_device_permissions.h"
12 #include "chrome/browser/media/webrtc/media_stream_devices_controller.h" 11 #include "chrome/browser/media/webrtc/media_stream_devices_controller.h"
12 #include "chrome/browser/permissions/permission_manager.h"
13 #include "chrome/browser/permissions/permission_result.h"
13 #include "chrome/browser/profiles/profile.h" 14 #include "chrome/browser/profiles/profile.h"
14 #include "chrome/common/pref_names.h" 15 #include "chrome/common/pref_names.h"
15 #include "components/content_settings/core/browser/host_content_settings_map.h" 16 #include "components/content_settings/core/browser/host_content_settings_map.h"
16 #include "content/public/browser/browser_thread.h" 17 #include "content/public/browser/browser_thread.h"
17 #include "content/public/browser/notification_service.h" 18 #include "content/public/browser/notification_service.h"
18 #include "content/public/browser/notification_types.h" 19 #include "content/public/browser/notification_types.h"
19 #include "content/public/browser/web_contents.h" 20 #include "content/public/browser/web_contents.h"
20 21
21 #if defined(OS_ANDROID) 22 #if defined(OS_ANDROID)
22 #include <vector> 23 #include <vector>
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
75 const GURL& security_origin, 76 const GURL& security_origin,
76 content::MediaStreamType type, 77 content::MediaStreamType type,
77 const extensions::Extension* extension) { 78 const extensions::Extension* extension) {
78 Profile* profile = 79 Profile* profile =
79 Profile::FromBrowserContext(web_contents->GetBrowserContext()); 80 Profile::FromBrowserContext(web_contents->GetBrowserContext());
80 ContentSettingsType content_settings_type = 81 ContentSettingsType content_settings_type =
81 type == content::MEDIA_DEVICE_AUDIO_CAPTURE 82 type == content::MEDIA_DEVICE_AUDIO_CAPTURE
82 ? CONTENT_SETTINGS_TYPE_MEDIASTREAM_MIC 83 ? CONTENT_SETTINGS_TYPE_MEDIASTREAM_MIC
83 : CONTENT_SETTINGS_TYPE_MEDIASTREAM_CAMERA; 84 : CONTENT_SETTINGS_TYPE_MEDIASTREAM_CAMERA;
84 85
85 MediaPermission permission(content_settings_type, security_origin, 86 DCHECK(!security_origin.is_empty());
86 web_contents->GetLastCommittedURL().GetOrigin(), 87 GURL embedding_origin = web_contents->GetLastCommittedURL().GetOrigin();
87 profile, web_contents); 88 PermissionManager* permission_manager = PermissionManager::Get(profile);
88 content::MediaStreamRequestResult unused; 89 return permission_manager
89 return permission.GetPermissionStatus(&unused) == CONTENT_SETTING_ALLOW; 90 ->GetPermissionStatus(content_settings_type, security_origin,
91 embedding_origin)
92 .content_setting == CONTENT_SETTING_ALLOW;
90 } 93 }
91 94
92 void PermissionBubbleMediaAccessHandler::HandleRequest( 95 void PermissionBubbleMediaAccessHandler::HandleRequest(
93 content::WebContents* web_contents, 96 content::WebContents* web_contents,
94 const content::MediaStreamRequest& request, 97 const content::MediaStreamRequest& request,
95 const content::MediaResponseCallback& callback, 98 const content::MediaResponseCallback& callback,
96 const extensions::Extension* extension) { 99 const extensions::Extension* extension) {
97 DCHECK_CURRENTLY_ON(BrowserThread::UI); 100 DCHECK_CURRENTLY_ON(BrowserThread::UI);
98 101
99 #if defined(OS_ANDROID) 102 #if defined(OS_ANDROID)
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after
212 215
213 void PermissionBubbleMediaAccessHandler::Observe( 216 void PermissionBubbleMediaAccessHandler::Observe(
214 int type, 217 int type,
215 const content::NotificationSource& source, 218 const content::NotificationSource& source,
216 const content::NotificationDetails& details) { 219 const content::NotificationDetails& details) {
217 DCHECK_CURRENTLY_ON(BrowserThread::UI); 220 DCHECK_CURRENTLY_ON(BrowserThread::UI);
218 DCHECK_EQ(content::NOTIFICATION_WEB_CONTENTS_DESTROYED, type); 221 DCHECK_EQ(content::NOTIFICATION_WEB_CONTENTS_DESTROYED, type);
219 222
220 pending_requests_.erase(content::Source<content::WebContents>(source).ptr()); 223 pending_requests_.erase(content::Source<content::WebContents>(source).ptr());
221 } 224 }
OLDNEW
« no previous file with comments | « chrome/browser/media/webrtc/media_stream_devices_controller.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698