| OLD | NEW |
| 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" | 10 #include "chrome/browser/media/webrtc/media_permission.h" |
| (...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 97 const extensions::Extension* extension) { | 97 const extensions::Extension* extension) { |
| 98 Profile* profile = | 98 Profile* profile = |
| 99 Profile::FromBrowserContext(web_contents->GetBrowserContext()); | 99 Profile::FromBrowserContext(web_contents->GetBrowserContext()); |
| 100 ContentSettingsType content_settings_type = | 100 ContentSettingsType content_settings_type = |
| 101 type == content::MEDIA_DEVICE_AUDIO_CAPTURE | 101 type == content::MEDIA_DEVICE_AUDIO_CAPTURE |
| 102 ? CONTENT_SETTINGS_TYPE_MEDIASTREAM_MIC | 102 ? CONTENT_SETTINGS_TYPE_MEDIASTREAM_MIC |
| 103 : CONTENT_SETTINGS_TYPE_MEDIASTREAM_CAMERA; | 103 : CONTENT_SETTINGS_TYPE_MEDIASTREAM_CAMERA; |
| 104 | 104 |
| 105 MediaPermission permission(content_settings_type, security_origin, | 105 MediaPermission permission(content_settings_type, security_origin, |
| 106 web_contents->GetLastCommittedURL().GetOrigin(), | 106 web_contents->GetLastCommittedURL().GetOrigin(), |
| 107 profile); | 107 profile, web_contents); |
| 108 content::MediaStreamRequestResult unused; | 108 content::MediaStreamRequestResult unused; |
| 109 return permission.GetPermissionStatus(&unused) == CONTENT_SETTING_ALLOW; | 109 return permission.GetPermissionStatus(&unused) == CONTENT_SETTING_ALLOW; |
| 110 } | 110 } |
| 111 | 111 |
| 112 void PermissionBubbleMediaAccessHandler::HandleRequest( | 112 void PermissionBubbleMediaAccessHandler::HandleRequest( |
| 113 content::WebContents* web_contents, | 113 content::WebContents* web_contents, |
| 114 const content::MediaStreamRequest& request, | 114 const content::MediaStreamRequest& request, |
| 115 const content::MediaResponseCallback& callback, | 115 const content::MediaResponseCallback& callback, |
| 116 const extensions::Extension* extension) { | 116 const extensions::Extension* extension) { |
| 117 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 117 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
| (...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 275 | 275 |
| 276 void PermissionBubbleMediaAccessHandler::Observe( | 276 void PermissionBubbleMediaAccessHandler::Observe( |
| 277 int type, | 277 int type, |
| 278 const content::NotificationSource& source, | 278 const content::NotificationSource& source, |
| 279 const content::NotificationDetails& details) { | 279 const content::NotificationDetails& details) { |
| 280 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 280 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
| 281 DCHECK_EQ(content::NOTIFICATION_WEB_CONTENTS_DESTROYED, type); | 281 DCHECK_EQ(content::NOTIFICATION_WEB_CONTENTS_DESTROYED, type); |
| 282 | 282 |
| 283 pending_requests_.erase(content::Source<content::WebContents>(source).ptr()); | 283 pending_requests_.erase(content::Source<content::WebContents>(source).ptr()); |
| 284 } | 284 } |
| OLD | NEW |