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

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

Issue 1007163003: media: Check kDisableInfobarForProtectedMediaIdentifier in ProtectedMediaIdentifierPermissionContex… (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@proxy_decryptor_request_permission
Patch Set: rebase only 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
« no previous file with comments | « chrome/browser/media/protected_media_identifier_permission_context.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/command_line.h"
11 #include "base/lazy_instance.h" 10 #include "base/lazy_instance.h"
12 #include "base/memory/scoped_ptr.h" 11 #include "base/memory/scoped_ptr.h"
13 #include "base/task_runner.h" 12 #include "base/task_runner.h"
14 #include "content/common/media/cdm_messages.h" 13 #include "content/common/media/cdm_messages.h"
15 #include "content/public/browser/browser_thread.h" 14 #include "content/public/browser/browser_thread.h"
16 #include "content/public/browser/content_browser_client.h" 15 #include "content/public/browser/content_browser_client.h"
17 #include "content/public/browser/render_frame_host.h" 16 #include "content/public/browser/render_frame_host.h"
18 #include "content/public/browser/render_process_host.h" 17 #include "content/public/browser/render_process_host.h"
19 #include "content/public/browser/render_view_host.h" 18 #include "content/public/browser/render_view_host.h"
20 #include "content/public/browser/web_contents.h" 19 #include "content/public/browser/web_contents.h"
21 #include "content/public/common/content_switches.h"
22 #include "media/base/browser_cdm.h" 20 #include "media/base/browser_cdm.h"
23 #include "media/base/browser_cdm_factory.h" 21 #include "media/base/browser_cdm_factory.h"
24 #include "media/base/cdm_promise.h" 22 #include "media/base/cdm_promise.h"
25 #include "media/base/limits.h" 23 #include "media/base/limits.h"
26 #include "media/base/media_switches.h"
27 24
28 namespace content { 25 namespace content {
29 26
30 using media::BrowserCdm; 27 using media::BrowserCdm;
31 using media::MediaKeys; 28 using media::MediaKeys;
32 29
33 namespace { 30 namespace {
34 31
35 // Maximum lengths for various EME API parameters. These are checks to 32 // Maximum lengths for various EME API parameters. These are checks to
36 // prevent unnecessarily large parameters from being passed around, and the 33 // prevent unnecessarily large parameters from being passed around, and the
(...skipping 322 matching lines...) Expand 10 before | Expand all | Expand 10 after
359 eme_init_data_type = media::EME_INIT_DATA_TYPE_CENC; 356 eme_init_data_type = media::EME_INIT_DATA_TYPE_CENC;
360 break; 357 break;
361 #endif 358 #endif
362 default: 359 default:
363 NOTREACHED(); 360 NOTREACHED();
364 promise->reject(MediaKeys::INVALID_ACCESS_ERROR, 0, 361 promise->reject(MediaKeys::INVALID_ACCESS_ERROR, 0,
365 "Invalid init data type."); 362 "Invalid init data type.");
366 return; 363 return;
367 } 364 }
368 365
369 #if defined(OS_ANDROID)
370 if (base::CommandLine::ForCurrentProcess()->HasSwitch(
371 switches::kDisableInfobarForProtectedMediaIdentifier)) {
372 CreateSessionAndGenerateRequestIfPermitted(
373 render_frame_id, cdm_id, eme_init_data_type, init_data, promise.Pass(),
374 true /* allowed */);
375 return;
376 }
377 #endif
378
379 BrowserCdm* cdm = GetCdm(render_frame_id, cdm_id); 366 BrowserCdm* cdm = GetCdm(render_frame_id, cdm_id);
380 if (!cdm) { 367 if (!cdm) {
381 DLOG(WARNING) << "No CDM found for: " << render_frame_id << ", " << cdm_id; 368 DLOG(WARNING) << "No CDM found for: " << render_frame_id << ", " << cdm_id;
382 promise->reject(MediaKeys::INVALID_STATE_ERROR, 0, "CDM not found."); 369 promise->reject(MediaKeys::INVALID_STATE_ERROR, 0, "CDM not found.");
383 return; 370 return;
384 } 371 }
385 372
386 CheckPermissionStatus( 373 CheckPermissionStatus(
387 render_frame_id, cdm_id, 374 render_frame_id, cdm_id,
388 base::Bind(&BrowserCdmManager::CreateSessionAndGenerateRequestIfPermitted, 375 base::Bind(&BrowserCdmManager::CreateSessionAndGenerateRequestIfPermitted,
(...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after
585 } 572 }
586 573
587 // Only the temporary session type is supported in browser CDM path. 574 // Only the temporary session type is supported in browser CDM path.
588 // TODO(xhwang): Add SessionType support if needed. 575 // TODO(xhwang): Add SessionType support if needed.
589 cdm->CreateSessionAndGenerateRequest(media::MediaKeys::TEMPORARY_SESSION, 576 cdm->CreateSessionAndGenerateRequest(media::MediaKeys::TEMPORARY_SESSION,
590 init_data_type_string, &init_data[0], 577 init_data_type_string, &init_data[0],
591 init_data.size(), promise.Pass()); 578 init_data.size(), promise.Pass());
592 } 579 }
593 580
594 } // namespace content 581 } // namespace content
OLDNEW
« no previous file with comments | « chrome/browser/media/protected_media_identifier_permission_context.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698