| 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 543 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 554 | 554 |
| 555 if (!IsUserAcceptAllowed(content_type)) { | 555 if (!IsUserAcceptAllowed(content_type)) { |
| 556 *denial_reason = content::MEDIA_DEVICE_PERMISSION_DENIED; | 556 *denial_reason = content::MEDIA_DEVICE_PERMISSION_DENIED; |
| 557 return CONTENT_SETTING_BLOCK; | 557 return CONTENT_SETTING_BLOCK; |
| 558 } | 558 } |
| 559 | 559 |
| 560 if (ContentTypeIsRequested(content_type, request)) { | 560 if (ContentTypeIsRequested(content_type, request)) { |
| 561 DCHECK(content::IsOriginSecure(request_.security_origin) || | 561 DCHECK(content::IsOriginSecure(request_.security_origin) || |
| 562 request_.request_type == content::MEDIA_OPEN_DEVICE_PEPPER_ONLY); | 562 request_.request_type == content::MEDIA_OPEN_DEVICE_PEPPER_ONLY); |
| 563 MediaPermission permission(content_type, request.security_origin, | 563 MediaPermission permission(content_type, request.security_origin, |
| 564 web_contents_->GetLastCommittedURL().GetOrigin(), profile_); | 564 web_contents_->GetLastCommittedURL().GetOrigin(), |
| 565 profile_, web_contents_); |
| 565 return permission.GetPermissionStatusWithDeviceRequired(requested_device_id, | 566 return permission.GetPermissionStatusWithDeviceRequired(requested_device_id, |
| 566 denial_reason); | 567 denial_reason); |
| 567 } | 568 } |
| 568 // Return the default content setting if the device is not requested. | 569 // Return the default content setting if the device is not requested. |
| 569 return CONTENT_SETTING_DEFAULT; | 570 return CONTENT_SETTING_DEFAULT; |
| 570 } | 571 } |
| 571 | 572 |
| 572 ContentSetting MediaStreamDevicesController::GetNewSetting( | 573 ContentSetting MediaStreamDevicesController::GetNewSetting( |
| 573 ContentSettingsType content_type, | 574 ContentSettingsType content_type, |
| 574 ContentSetting old_setting, | 575 ContentSetting old_setting, |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 610 if (android_permission_blocked) | 611 if (android_permission_blocked) |
| 611 return false; | 612 return false; |
| 612 | 613 |
| 613 // Don't approve device requests if the tab was hidden. | 614 // Don't approve device requests if the tab was hidden. |
| 614 // TODO(qinmin): Add a test for this. http://crbug.com/396869. | 615 // TODO(qinmin): Add a test for this. http://crbug.com/396869. |
| 615 // TODO(raymes): Shouldn't this apply to all permissions not just audio/video? | 616 // TODO(raymes): Shouldn't this apply to all permissions not just audio/video? |
| 616 return web_contents_->GetRenderWidgetHostView()->IsShowing(); | 617 return web_contents_->GetRenderWidgetHostView()->IsShowing(); |
| 617 #endif | 618 #endif |
| 618 return true; | 619 return true; |
| 619 } | 620 } |
| OLD | NEW |