OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/media/cdm/browser_cdm_manager.h" | 5 #include "content/browser/media/cdm/browser_cdm_manager.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include <memory> | 9 #include <memory> |
10 #include <string> | 10 #include <string> |
(...skipping 655 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
666 RenderFrameHost* rfh = | 666 RenderFrameHost* rfh = |
667 RenderFrameHost::FromID(render_process_id_, render_frame_id); | 667 RenderFrameHost::FromID(render_process_id_, render_frame_id); |
668 WebContents* web_contents = WebContents::FromRenderFrameHost(rfh); | 668 WebContents* web_contents = WebContents::FromRenderFrameHost(rfh); |
669 PermissionManager* permission_manager = | 669 PermissionManager* permission_manager = |
670 web_contents->GetBrowserContext()->GetPermissionManager(); | 670 web_contents->GetBrowserContext()->GetPermissionManager(); |
671 if (!permission_manager) { | 671 if (!permission_manager) { |
672 permission_status_cb.Run(false); | 672 permission_status_cb.Run(false); |
673 return; | 673 return; |
674 } | 674 } |
675 | 675 |
676 permissions::mojom::PermissionStatus permission_status = | 676 blink::mojom::PermissionStatus permission_status = |
677 permission_manager->GetPermissionStatus( | 677 permission_manager->GetPermissionStatus( |
678 PermissionType::PROTECTED_MEDIA_IDENTIFIER, security_origin, | 678 PermissionType::PROTECTED_MEDIA_IDENTIFIER, security_origin, |
679 web_contents->GetLastCommittedURL().GetOrigin()); | 679 web_contents->GetLastCommittedURL().GetOrigin()); |
680 | 680 |
681 bool allowed = | 681 bool allowed = (permission_status == blink::mojom::PermissionStatus::GRANTED); |
682 (permission_status == permissions::mojom::PermissionStatus::GRANTED); | |
683 if (!task_runner_->RunsTasksOnCurrentThread()) { | 682 if (!task_runner_->RunsTasksOnCurrentThread()) { |
684 task_runner_->PostTask(FROM_HERE, | 683 task_runner_->PostTask(FROM_HERE, |
685 base::Bind(permission_status_cb, allowed)); | 684 base::Bind(permission_status_cb, allowed)); |
686 } else { | 685 } else { |
687 permission_status_cb.Run(allowed); | 686 permission_status_cb.Run(allowed); |
688 } | 687 } |
689 } | 688 } |
690 | 689 |
691 void BrowserCdmManager::CreateSessionAndGenerateRequestIfPermitted( | 690 void BrowserCdmManager::CreateSessionAndGenerateRequestIfPermitted( |
692 int render_frame_id, | 691 int render_frame_id, |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
731 scoped_refptr<MediaKeys> cdm = GetCdm(render_frame_id, cdm_id); | 730 scoped_refptr<MediaKeys> cdm = GetCdm(render_frame_id, cdm_id); |
732 if (!cdm) { | 731 if (!cdm) { |
733 promise->reject(MediaKeys::INVALID_STATE_ERROR, 0, "CDM not found."); | 732 promise->reject(MediaKeys::INVALID_STATE_ERROR, 0, "CDM not found."); |
734 return; | 733 return; |
735 } | 734 } |
736 | 735 |
737 cdm->LoadSession(session_type, session_id, std::move(promise)); | 736 cdm->LoadSession(session_type, session_id, std::move(promise)); |
738 } | 737 } |
739 | 738 |
740 } // namespace content | 739 } // namespace content |
OLD | NEW |