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

Side by Side Diff: media/cdm/default_cdm_factory.cc

Issue 1131753003: Plumb |use_secure_codecs| through to BrowserCdmFactoryAndroid. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Update unittest. Created 5 years, 7 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 "media/cdm/default_cdm_factory.h" 5 #include "media/cdm/default_cdm_factory.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/bind_helpers.h" 8 #include "base/bind_helpers.h"
9 #include "base/location.h" 9 #include "base/location.h"
10 #include "base/single_thread_task_runner.h" 10 #include "base/single_thread_task_runner.h"
11 #include "base/thread_task_runner_handle.h" 11 #include "base/thread_task_runner_handle.h"
12 #include "media/base/key_systems.h" 12 #include "media/base/key_systems.h"
13 #include "media/cdm/aes_decryptor.h" 13 #include "media/cdm/aes_decryptor.h"
14 #include "url/gurl.h" 14 #include "url/gurl.h"
15 15
16 namespace media { 16 namespace media {
17 17
18 DefaultCdmFactory::DefaultCdmFactory() { 18 DefaultCdmFactory::DefaultCdmFactory() {
19 } 19 }
20 20
21 DefaultCdmFactory::~DefaultCdmFactory() { 21 DefaultCdmFactory::~DefaultCdmFactory() {
22 } 22 }
23 23
24 void DefaultCdmFactory::Create( 24 void DefaultCdmFactory::Create(
25 const std::string& key_system, 25 const std::string& key_system,
26 bool allow_distinctive_identifier,
27 bool allow_persistent_state,
28 const GURL& security_origin, 26 const GURL& security_origin,
27 const CdmConfig& cdm_config,
29 const SessionMessageCB& session_message_cb, 28 const SessionMessageCB& session_message_cb,
30 const SessionClosedCB& session_closed_cb, 29 const SessionClosedCB& session_closed_cb,
31 const LegacySessionErrorCB& legacy_session_error_cb, 30 const LegacySessionErrorCB& legacy_session_error_cb,
32 const SessionKeysChangeCB& session_keys_change_cb, 31 const SessionKeysChangeCB& session_keys_change_cb,
33 const SessionExpirationUpdateCB& session_expiration_update_cb, 32 const SessionExpirationUpdateCB& session_expiration_update_cb,
34 const CdmCreatedCB& cdm_created_cb) { 33 const CdmCreatedCB& cdm_created_cb) {
35 if (!security_origin.is_valid()) { 34 if (!security_origin.is_valid()) {
36 base::ThreadTaskRunnerHandle::Get()->PostTask( 35 base::ThreadTaskRunnerHandle::Get()->PostTask(
37 FROM_HERE, base::Bind(cdm_created_cb, nullptr, "Invalid origin.")); 36 FROM_HERE, base::Bind(cdm_created_cb, nullptr, "Invalid origin."));
38 return; 37 return;
39 } 38 }
40 if (!CanUseAesDecryptor(key_system)) { 39 if (!CanUseAesDecryptor(key_system)) {
41 base::ThreadTaskRunnerHandle::Get()->PostTask( 40 base::ThreadTaskRunnerHandle::Get()->PostTask(
42 FROM_HERE, 41 FROM_HERE,
43 base::Bind(cdm_created_cb, nullptr, "Unsupported key system.")); 42 base::Bind(cdm_created_cb, nullptr, "Unsupported key system."));
44 return; 43 return;
45 } 44 }
46 45
47 scoped_ptr<MediaKeys> cdm( 46 scoped_ptr<MediaKeys> cdm(
48 new AesDecryptor(security_origin, session_message_cb, session_closed_cb, 47 new AesDecryptor(security_origin, session_message_cb, session_closed_cb,
49 session_keys_change_cb)); 48 session_keys_change_cb));
50 base::ThreadTaskRunnerHandle::Get()->PostTask( 49 base::ThreadTaskRunnerHandle::Get()->PostTask(
51 FROM_HERE, base::Bind(cdm_created_cb, base::Passed(&cdm), "")); 50 FROM_HERE, base::Bind(cdm_created_cb, base::Passed(&cdm), ""));
52 } 51 }
53 52
54 } // namespace media 53 } // namespace media
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698