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