| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/media_stream_devices_controller.h" | 5 #include "chrome/browser/media/webrtc/media_stream_devices_controller.h" |
| 6 | 6 |
| 7 #include <map> | 7 #include <map> |
| 8 #include <utility> | 8 #include <utility> |
| 9 | 9 |
| 10 #include "base/callback_helpers.h" | 10 #include "base/callback_helpers.h" |
| (...skipping 555 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 566 *denial_reason = content::MEDIA_DEVICE_PERMISSION_DENIED; | 566 *denial_reason = content::MEDIA_DEVICE_PERMISSION_DENIED; |
| 567 return CONTENT_SETTING_BLOCK; | 567 return CONTENT_SETTING_BLOCK; |
| 568 } | 568 } |
| 569 | 569 |
| 570 content::PermissionType permission_type = | 570 content::PermissionType permission_type = |
| 571 GetPermissionTypeForContentSettingsType(content_type); | 571 GetPermissionTypeForContentSettingsType(content_type); |
| 572 if (ContentTypeIsRequested(permission_type, request)) { | 572 if (ContentTypeIsRequested(permission_type, request)) { |
| 573 DCHECK(content::IsOriginSecure(request_.security_origin) || | 573 DCHECK(content::IsOriginSecure(request_.security_origin) || |
| 574 request_.request_type == content::MEDIA_OPEN_DEVICE_PEPPER_ONLY); | 574 request_.request_type == content::MEDIA_OPEN_DEVICE_PEPPER_ONLY); |
| 575 MediaPermission permission(content_type, request.security_origin, | 575 MediaPermission permission(content_type, request.security_origin, |
| 576 web_contents_->GetLastCommittedURL().GetOrigin(), profile_); | 576 web_contents_->GetLastCommittedURL().GetOrigin(), |
| 577 profile_, web_contents_); |
| 577 return permission.GetPermissionStatusWithDeviceRequired(requested_device_id, | 578 return permission.GetPermissionStatusWithDeviceRequired(requested_device_id, |
| 578 denial_reason); | 579 denial_reason); |
| 579 } | 580 } |
| 580 // Return the default content setting if the device is not requested. | 581 // Return the default content setting if the device is not requested. |
| 581 return CONTENT_SETTING_DEFAULT; | 582 return CONTENT_SETTING_DEFAULT; |
| 582 } | 583 } |
| 583 | 584 |
| 584 ContentSetting MediaStreamDevicesController::GetNewSetting( | 585 ContentSetting MediaStreamDevicesController::GetNewSetting( |
| 585 ContentSettingsType content_type, | 586 ContentSettingsType content_type, |
| 586 ContentSetting old_setting, | 587 ContentSetting old_setting, |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 622 if (android_permission_blocked) | 623 if (android_permission_blocked) |
| 623 return false; | 624 return false; |
| 624 | 625 |
| 625 // Don't approve device requests if the tab was hidden. | 626 // Don't approve device requests if the tab was hidden. |
| 626 // TODO(qinmin): Add a test for this. http://crbug.com/396869. | 627 // TODO(qinmin): Add a test for this. http://crbug.com/396869. |
| 627 // TODO(raymes): Shouldn't this apply to all permissions not just audio/video? | 628 // TODO(raymes): Shouldn't this apply to all permissions not just audio/video? |
| 628 return web_contents_->GetRenderWidgetHostView()->IsShowing(); | 629 return web_contents_->GetRenderWidgetHostView()->IsShowing(); |
| 629 #endif | 630 #endif |
| 630 return true; | 631 return true; |
| 631 } | 632 } |
| OLD | NEW |