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 <string> | 7 #include <string> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/lazy_instance.h" | 10 #include "base/lazy_instance.h" |
(...skipping 607 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
618 RenderFrameHost* rfh = | 618 RenderFrameHost* rfh = |
619 RenderFrameHost::FromID(render_process_id_, render_frame_id); | 619 RenderFrameHost::FromID(render_process_id_, render_frame_id); |
620 WebContents* web_contents = WebContents::FromRenderFrameHost(rfh); | 620 WebContents* web_contents = WebContents::FromRenderFrameHost(rfh); |
621 PermissionManager* permission_manager = | 621 PermissionManager* permission_manager = |
622 web_contents->GetBrowserContext()->GetPermissionManager(); | 622 web_contents->GetBrowserContext()->GetPermissionManager(); |
623 if (!permission_manager) { | 623 if (!permission_manager) { |
624 permission_status_cb.Run(false); | 624 permission_status_cb.Run(false); |
625 return; | 625 return; |
626 } | 626 } |
627 | 627 |
628 PermissionStatus permission_status = permission_manager->GetPermissionStatus( | 628 permission::Status permission_status = |
629 PermissionType::PROTECTED_MEDIA_IDENTIFIER, security_origin, | 629 permission_manager->GetPermissionStatus( |
630 web_contents->GetLastCommittedURL().GetOrigin()); | 630 PermissionType::PROTECTED_MEDIA_IDENTIFIER, security_origin, |
| 631 web_contents->GetLastCommittedURL().GetOrigin()); |
631 | 632 |
632 bool allowed = (permission_status == PERMISSION_STATUS_GRANTED); | 633 bool allowed = (permission_status == permission::STATUS_GRANTED); |
633 if (!task_runner_->RunsTasksOnCurrentThread()) { | 634 if (!task_runner_->RunsTasksOnCurrentThread()) { |
634 task_runner_->PostTask(FROM_HERE, | 635 task_runner_->PostTask(FROM_HERE, |
635 base::Bind(permission_status_cb, allowed)); | 636 base::Bind(permission_status_cb, allowed)); |
636 } else { | 637 } else { |
637 permission_status_cb.Run(allowed); | 638 permission_status_cb.Run(allowed); |
638 } | 639 } |
639 } | 640 } |
640 | 641 |
641 void BrowserCdmManager::CreateSessionAndGenerateRequestIfPermitted( | 642 void BrowserCdmManager::CreateSessionAndGenerateRequestIfPermitted( |
642 int render_frame_id, | 643 int render_frame_id, |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
681 BrowserCdm* cdm = GetCdm(render_frame_id, cdm_id); | 682 BrowserCdm* cdm = GetCdm(render_frame_id, cdm_id); |
682 if (!cdm) { | 683 if (!cdm) { |
683 promise->reject(MediaKeys::INVALID_STATE_ERROR, 0, "CDM not found."); | 684 promise->reject(MediaKeys::INVALID_STATE_ERROR, 0, "CDM not found."); |
684 return; | 685 return; |
685 } | 686 } |
686 | 687 |
687 cdm->LoadSession(session_type, session_id, promise.Pass()); | 688 cdm->LoadSession(session_type, session_id, promise.Pass()); |
688 } | 689 } |
689 | 690 |
690 } // namespace content | 691 } // namespace content |
OLD | NEW |