| 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/permission_bubble_media_access_handler.h" | 5 #include "chrome/browser/media/permission_bubble_media_access_handler.h" |
| 6 | 6 |
| 7 #include "base/metrics/field_trial.h" | 7 #include "base/metrics/field_trial.h" |
| 8 #include "chrome/browser/media/media_permission.h" | 8 #include "chrome/browser/media/media_permission.h" |
| 9 #include "chrome/browser/media/media_stream_device_permissions.h" | 9 #include "chrome/browser/media/media_stream_device_permissions.h" |
| 10 #include "chrome/browser/media/media_stream_infobar_delegate.h" | 10 #include "chrome/browser/media/media_stream_infobar_delegate.h" |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 56 content::WebContents* web_contents, | 56 content::WebContents* web_contents, |
| 57 const GURL& security_origin, | 57 const GURL& security_origin, |
| 58 content::MediaStreamType type, | 58 content::MediaStreamType type, |
| 59 const extensions::Extension* extension) { | 59 const extensions::Extension* extension) { |
| 60 Profile* profile = | 60 Profile* profile = |
| 61 Profile::FromBrowserContext(web_contents->GetBrowserContext()); | 61 Profile::FromBrowserContext(web_contents->GetBrowserContext()); |
| 62 ContentSettingsType content_settings_type = | 62 ContentSettingsType content_settings_type = |
| 63 type == content::MEDIA_DEVICE_AUDIO_CAPTURE | 63 type == content::MEDIA_DEVICE_AUDIO_CAPTURE |
| 64 ? CONTENT_SETTINGS_TYPE_MEDIASTREAM_MIC | 64 ? CONTENT_SETTINGS_TYPE_MEDIASTREAM_MIC |
| 65 : CONTENT_SETTINGS_TYPE_MEDIASTREAM_CAMERA; | 65 : CONTENT_SETTINGS_TYPE_MEDIASTREAM_CAMERA; |
| 66 MediaPermission permission(content_settings_type, | 66 MediaPermission permission( |
| 67 content::MEDIA_DEVICE_ACCESS, security_origin, | 67 content_settings_type, content::MEDIA_DEVICE_ACCESS, security_origin, |
| 68 profile); | 68 web_contents->GetLastCommittedURL().GetOrigin(), profile); |
| 69 content::MediaStreamRequestResult unused; | 69 content::MediaStreamRequestResult unused; |
| 70 if (permission.GetPermissionStatus(&unused) == CONTENT_SETTING_ALLOW) | 70 if (permission.GetPermissionStatus(&unused) == CONTENT_SETTING_ALLOW) |
| 71 return true; | 71 return true; |
| 72 | 72 |
| 73 return false; | 73 return false; |
| 74 } | 74 } |
| 75 | 75 |
| 76 void PermissionBubbleMediaAccessHandler::HandleRequest( | 76 void PermissionBubbleMediaAccessHandler::HandleRequest( |
| 77 content::WebContents* web_contents, | 77 content::WebContents* web_contents, |
| 78 const content::MediaStreamRequest& request, | 78 const content::MediaStreamRequest& request, |
| (...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 193 int type, | 193 int type, |
| 194 const content::NotificationSource& source, | 194 const content::NotificationSource& source, |
| 195 const content::NotificationDetails& details) { | 195 const content::NotificationDetails& details) { |
| 196 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 196 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
| 197 if (type == content::NOTIFICATION_WEB_CONTENTS_DESTROYED) { | 197 if (type == content::NOTIFICATION_WEB_CONTENTS_DESTROYED) { |
| 198 content::WebContents* web_contents = | 198 content::WebContents* web_contents = |
| 199 content::Source<content::WebContents>(source).ptr(); | 199 content::Source<content::WebContents>(source).ptr(); |
| 200 pending_requests_.erase(web_contents); | 200 pending_requests_.erase(web_contents); |
| 201 } | 201 } |
| 202 } | 202 } |
| OLD | NEW |