| 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 "content/browser/renderer_host/media/audio_renderer_host.h" | 5 #include "content/browser/renderer_host/media/audio_renderer_host.h" |
| 6 | 6 |
| 7 #include <stdint.h> | 7 #include <stdint.h> |
| 8 #include <utility> | 8 #include <utility> |
| 9 | 9 |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| (...skipping 743 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 754 return false; | 754 return false; |
| 755 } | 755 } |
| 756 | 756 |
| 757 void AudioRendererHost::CheckOutputDeviceAccess( | 757 void AudioRendererHost::CheckOutputDeviceAccess( |
| 758 int render_frame_id, | 758 int render_frame_id, |
| 759 const std::string& device_id, | 759 const std::string& device_id, |
| 760 const GURL& gurl_security_origin, | 760 const GURL& gurl_security_origin, |
| 761 const OutputDeviceAccessCB& callback) { | 761 const OutputDeviceAccessCB& callback) { |
| 762 DCHECK_CURRENTLY_ON(BrowserThread::IO); | 762 DCHECK_CURRENTLY_ON(BrowserThread::IO); |
| 763 | 763 |
| 764 if (!ChildProcessSecurityPolicyImpl::GetInstance()->CanRequestURL( | 764 // Check security origin if nondefault device is requested. |
| 765 // Ignore check for default device, which is always authorized. |
| 766 if (!IsDefaultDeviceId(device_id) && |
| 767 !ChildProcessSecurityPolicyImpl::GetInstance()->CanRequestURL( |
| 765 render_process_id_, gurl_security_origin)) { | 768 render_process_id_, gurl_security_origin)) { |
| 766 content::bad_message::ReceivedBadMessage(this, | 769 content::bad_message::ReceivedBadMessage(this, |
| 767 bad_message::ARH_UNAUTHORIZED_URL); | 770 bad_message::ARH_UNAUTHORIZED_URL); |
| 768 return; | 771 return; |
| 769 } | 772 } |
| 770 | 773 |
| 771 if (device_id.empty()) { | 774 if (device_id.empty()) { |
| 772 callback.Run(true); | 775 callback.Run(true); |
| 773 } else { | 776 } else { |
| 774 // Check that MediaStream device permissions have been granted, | 777 // Check that MediaStream device permissions have been granted, |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 819 callback.Run(false, device_info); | 822 callback.Run(false, device_info); |
| 820 } | 823 } |
| 821 | 824 |
| 822 bool AudioRendererHost::IsAuthorizationStarted(int stream_id) { | 825 bool AudioRendererHost::IsAuthorizationStarted(int stream_id) { |
| 823 DCHECK_CURRENTLY_ON(BrowserThread::IO); | 826 DCHECK_CURRENTLY_ON(BrowserThread::IO); |
| 824 const auto& i = authorizations_.find(stream_id); | 827 const auto& i = authorizations_.find(stream_id); |
| 825 return i != authorizations_.end(); | 828 return i != authorizations_.end(); |
| 826 } | 829 } |
| 827 | 830 |
| 828 } // namespace content | 831 } // namespace content |
| OLD | NEW |