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 blink::mojom::PermissionStatus permission_status = | 676 permissions::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 = (permission_status == blink::mojom::PermissionStatus::GRANTED); | 681 bool allowed = |
| 682 (permission_status == permissions::mojom::PermissionStatus::GRANTED); |
682 if (!task_runner_->RunsTasksOnCurrentThread()) { | 683 if (!task_runner_->RunsTasksOnCurrentThread()) { |
683 task_runner_->PostTask(FROM_HERE, | 684 task_runner_->PostTask(FROM_HERE, |
684 base::Bind(permission_status_cb, allowed)); | 685 base::Bind(permission_status_cb, allowed)); |
685 } else { | 686 } else { |
686 permission_status_cb.Run(allowed); | 687 permission_status_cb.Run(allowed); |
687 } | 688 } |
688 } | 689 } |
689 | 690 |
690 void BrowserCdmManager::CreateSessionAndGenerateRequestIfPermitted( | 691 void BrowserCdmManager::CreateSessionAndGenerateRequestIfPermitted( |
691 int render_frame_id, | 692 int render_frame_id, |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
730 scoped_refptr<MediaKeys> cdm = GetCdm(render_frame_id, cdm_id); | 731 scoped_refptr<MediaKeys> cdm = GetCdm(render_frame_id, cdm_id); |
731 if (!cdm) { | 732 if (!cdm) { |
732 promise->reject(MediaKeys::INVALID_STATE_ERROR, 0, "CDM not found."); | 733 promise->reject(MediaKeys::INVALID_STATE_ERROR, 0, "CDM not found."); |
733 return; | 734 return; |
734 } | 735 } |
735 | 736 |
736 cdm->LoadSession(session_type, session_id, std::move(promise)); | 737 cdm->LoadSession(session_type, session_id, std::move(promise)); |
737 } | 738 } |
738 | 739 |
739 } // namespace content | 740 } // namespace content |
OLD | NEW |