Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1564)

Unified Diff: content/browser/media/cdm/browser_cdm_manager.cc

Issue 1011953003: Refactor Permissions related method out of ContentBrowserClient. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@permission_type_enum_class
Patch Set: fix cros Created 5 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: content/browser/media/cdm/browser_cdm_manager.cc
diff --git a/content/browser/media/cdm/browser_cdm_manager.cc b/content/browser/media/cdm/browser_cdm_manager.cc
index 6f3c28d94fcc4573dc652f3cdf5127b360970dd0..bf3bca68915116708e82dae03cec529c21bdddda 100644
--- a/content/browser/media/cdm/browser_cdm_manager.cc
+++ b/content/browser/media/cdm/browser_cdm_manager.cc
@@ -11,8 +11,10 @@
#include "base/memory/scoped_ptr.h"
#include "base/task_runner.h"
#include "content/common/media/cdm_messages.h"
+#include "content/public/browser/browser_context.h"
#include "content/public/browser/browser_thread.h"
#include "content/public/browser/content_browser_client.h"
+#include "content/public/browser/permission_manager.h"
#include "content/public/browser/permission_type.h"
#include "content/public/browser/render_frame_host.h"
#include "content/public/browser/render_process_host.h"
@@ -519,12 +521,17 @@ void BrowserCdmManager::CheckPermissionStatusOnUIThread(
RenderFrameHost* rfh =
RenderFrameHost::FromID(render_process_id_, render_frame_id);
WebContents* web_contents = WebContents::FromRenderFrameHost(rfh);
- GURL embedding_origin = web_contents->GetLastCommittedURL().GetOrigin();
+ PermissionManager* permission_manager =
+ web_contents->GetBrowserContext()->GetPermissionManager();
+ if (!permission_manager) {
+ permission_status_cb.Run(false);
+ return;
+ }
- PermissionStatus permission_status =
- GetContentClient()->browser()->GetPermissionStatus(
- content::PermissionType::PROTECTED_MEDIA_IDENTIFIER,
- web_contents->GetBrowserContext(), security_origin, embedding_origin);
+ PermissionStatus permission_status = permission_manager->GetPermissionStatus(
+ content::PermissionType::PROTECTED_MEDIA_IDENTIFIER,
+ security_origin,
+ web_contents->GetLastCommittedURL().GetOrigin());
bool allowed = (permission_status == PERMISSION_STATUS_GRANTED);
if (!task_runner_->RunsTasksOnCurrentThread()) {
« no previous file with comments | « content/browser/frame_host/render_frame_host_impl.cc ('k') | content/browser/permissions/permission_service_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698