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

Side by Side Diff: media/mojo/clients/mojo_cdm_factory.cc

Issue 2882813002: media: Convert mojo media defines to buildflags (Closed)
Patch Set: rebase Created 3 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
« no previous file with comments | « media/mojo/clients/BUILD.gn ('k') | media/mojo/clients/mojo_decoder_factory.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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/mojo/clients/mojo_cdm_factory.h" 5 #include "media/mojo/clients/mojo_cdm_factory.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/location.h" 8 #include "base/location.h"
9 #include "base/single_thread_task_runner.h" 9 #include "base/single_thread_task_runner.h"
10 #include "base/threading/thread_task_runner_handle.h" 10 #include "base/threading/thread_task_runner_handle.h"
11 #include "media/base/content_decryption_module.h" 11 #include "media/base/content_decryption_module.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 "media/mojo/clients/mojo_cdm.h" 14 #include "media/mojo/clients/mojo_cdm.h"
15 #include "media/mojo/features.h"
15 #include "services/service_manager/public/cpp/connect.h" 16 #include "services/service_manager/public/cpp/connect.h"
16 #include "services/service_manager/public/interfaces/interface_provider.mojom.h" 17 #include "services/service_manager/public/interfaces/interface_provider.mojom.h"
17 18
18 namespace media { 19 namespace media {
19 20
20 MojoCdmFactory::MojoCdmFactory( 21 MojoCdmFactory::MojoCdmFactory(
21 service_manager::mojom::InterfaceProvider* interface_provider) 22 service_manager::mojom::InterfaceProvider* interface_provider)
22 : interface_provider_(interface_provider) { 23 : interface_provider_(interface_provider) {
23 DCHECK(interface_provider_); 24 DCHECK(interface_provider_);
24 } 25 }
(...skipping 15 matching lines...) Expand all
40 base::ThreadTaskRunnerHandle::Get()->PostTask( 41 base::ThreadTaskRunnerHandle::Get()->PostTask(
41 FROM_HERE, base::Bind(cdm_created_cb, nullptr, "Invalid origin.")); 42 FROM_HERE, base::Bind(cdm_created_cb, nullptr, "Invalid origin."));
42 return; 43 return;
43 } 44 }
44 45
45 // When MojoRenderer is used, the real Renderer is running in a remote process, 46 // When MojoRenderer is used, the real Renderer is running in a remote process,
46 // which cannot use an AesDecryptor running locally. In this case, always 47 // which cannot use an AesDecryptor running locally. In this case, always
47 // create the MojoCdm, giving the remote CDM a chance to handle |key_system|. 48 // create the MojoCdm, giving the remote CDM a chance to handle |key_system|.
48 // Note: We should not run AesDecryptor in the browser process except for 49 // Note: We should not run AesDecryptor in the browser process except for
49 // testing. See http://crbug.com/441957 50 // testing. See http://crbug.com/441957
50 #if !defined(ENABLE_MOJO_RENDERER) 51 #if !BUILDFLAG(ENABLE_MOJO_RENDERER)
51 if (CanUseAesDecryptor(key_system)) { 52 if (CanUseAesDecryptor(key_system)) {
52 scoped_refptr<ContentDecryptionModule> cdm( 53 scoped_refptr<ContentDecryptionModule> cdm(
53 new AesDecryptor(security_origin, session_message_cb, session_closed_cb, 54 new AesDecryptor(security_origin, session_message_cb, session_closed_cb,
54 session_keys_change_cb, session_expiration_update_cb)); 55 session_keys_change_cb, session_expiration_update_cb));
55 base::ThreadTaskRunnerHandle::Get()->PostTask( 56 base::ThreadTaskRunnerHandle::Get()->PostTask(
56 FROM_HERE, base::Bind(cdm_created_cb, cdm, "")); 57 FROM_HERE, base::Bind(cdm_created_cb, cdm, ""));
57 return; 58 return;
58 } 59 }
59 #endif 60 #endif
60 61
61 mojom::ContentDecryptionModulePtr cdm_ptr; 62 mojom::ContentDecryptionModulePtr cdm_ptr;
62 service_manager::GetInterface<mojom::ContentDecryptionModule>( 63 service_manager::GetInterface<mojom::ContentDecryptionModule>(
63 interface_provider_, &cdm_ptr); 64 interface_provider_, &cdm_ptr);
64 65
65 MojoCdm::Create(key_system, security_origin, cdm_config, std::move(cdm_ptr), 66 MojoCdm::Create(key_system, security_origin, cdm_config, std::move(cdm_ptr),
66 session_message_cb, session_closed_cb, session_keys_change_cb, 67 session_message_cb, session_closed_cb, session_keys_change_cb,
67 session_expiration_update_cb, cdm_created_cb); 68 session_expiration_update_cb, cdm_created_cb);
68 } 69 }
69 70
70 } // namespace media 71 } // namespace media
OLDNEW
« no previous file with comments | « media/mojo/clients/BUILD.gn ('k') | media/mojo/clients/mojo_decoder_factory.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698