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

Side by Side Diff: content/browser/media/cdm/browser_cdm_manager.cc

Issue 1020683003: Make content::PermissionType an enum class. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix android compile 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 unified diff | Download patch
OLDNEW
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"
11 #include "base/memory/scoped_ptr.h" 11 #include "base/memory/scoped_ptr.h"
12 #include "base/task_runner.h" 12 #include "base/task_runner.h"
13 #include "content/common/media/cdm_messages.h" 13 #include "content/common/media/cdm_messages.h"
14 #include "content/public/browser/browser_thread.h" 14 #include "content/public/browser/browser_thread.h"
15 #include "content/public/browser/content_browser_client.h" 15 #include "content/public/browser/content_browser_client.h"
16 #include "content/public/browser/permission_type.h"
16 #include "content/public/browser/render_frame_host.h" 17 #include "content/public/browser/render_frame_host.h"
17 #include "content/public/browser/render_process_host.h" 18 #include "content/public/browser/render_process_host.h"
18 #include "content/public/browser/render_view_host.h" 19 #include "content/public/browser/render_view_host.h"
19 #include "content/public/browser/web_contents.h" 20 #include "content/public/browser/web_contents.h"
20 #include "media/base/browser_cdm.h" 21 #include "media/base/browser_cdm.h"
21 #include "media/base/browser_cdm_factory.h" 22 #include "media/base/browser_cdm_factory.h"
22 #include "media/base/cdm_promise.h" 23 #include "media/base/cdm_promise.h"
23 #include "media/base/limits.h" 24 #include "media/base/limits.h"
24 25
25 namespace content { 26 namespace content {
(...skipping 489 matching lines...) Expand 10 before | Expand all | Expand 10 after
515 const base::Callback<void(bool)>& permission_status_cb) { 516 const base::Callback<void(bool)>& permission_status_cb) {
516 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 517 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
517 518
518 RenderFrameHost* rfh = 519 RenderFrameHost* rfh =
519 RenderFrameHost::FromID(render_process_id_, render_frame_id); 520 RenderFrameHost::FromID(render_process_id_, render_frame_id);
520 WebContents* web_contents = WebContents::FromRenderFrameHost(rfh); 521 WebContents* web_contents = WebContents::FromRenderFrameHost(rfh);
521 GURL embedding_origin = web_contents->GetLastCommittedURL().GetOrigin(); 522 GURL embedding_origin = web_contents->GetLastCommittedURL().GetOrigin();
522 523
523 PermissionStatus permission_status = 524 PermissionStatus permission_status =
524 GetContentClient()->browser()->GetPermissionStatus( 525 GetContentClient()->browser()->GetPermissionStatus(
525 content::PERMISSION_PROTECTED_MEDIA_IDENTIFIER, 526 content::PermissionType::PROTECTED_MEDIA_IDENTIFIER,
526 web_contents->GetBrowserContext(), security_origin, embedding_origin); 527 web_contents->GetBrowserContext(), security_origin, embedding_origin);
527 528
528 bool allowed = (permission_status == PERMISSION_STATUS_GRANTED); 529 bool allowed = (permission_status == PERMISSION_STATUS_GRANTED);
529 if (!task_runner_->RunsTasksOnCurrentThread()) { 530 if (!task_runner_->RunsTasksOnCurrentThread()) {
530 task_runner_->PostTask(FROM_HERE, 531 task_runner_->PostTask(FROM_HERE,
531 base::Bind(permission_status_cb, allowed)); 532 base::Bind(permission_status_cb, allowed));
532 } else { 533 } else {
533 permission_status_cb.Run(allowed); 534 permission_status_cb.Run(allowed);
534 } 535 }
535 } 536 }
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
572 } 573 }
573 574
574 // Only the temporary session type is supported in browser CDM path. 575 // Only the temporary session type is supported in browser CDM path.
575 // TODO(xhwang): Add SessionType support if needed. 576 // TODO(xhwang): Add SessionType support if needed.
576 cdm->CreateSessionAndGenerateRequest(media::MediaKeys::TEMPORARY_SESSION, 577 cdm->CreateSessionAndGenerateRequest(media::MediaKeys::TEMPORARY_SESSION,
577 init_data_type_string, &init_data[0], 578 init_data_type_string, &init_data[0],
578 init_data.size(), promise.Pass()); 579 init_data.size(), promise.Pass());
579 } 580 }
580 581
581 } // namespace content 582 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/frame_host/render_frame_host_impl.cc ('k') | content/browser/permissions/permission_service_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698