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

Side by Side Diff: content/renderer/media/cdm/render_cdm_factory.cc

Issue 2409423002: Move ENABLE_PEPPER_CDMS to a buildflag header. (Closed)
Patch Set: Fix and format Created 4 years, 2 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 | « content/renderer/media/cdm/render_cdm_factory.h ('k') | content/renderer/render_frame_impl.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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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/renderer/media/cdm/render_cdm_factory.h" 5 #include "content/renderer/media/cdm/render_cdm_factory.h"
6 6
7 #include <memory> 7 #include <memory>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/location.h" 10 #include "base/location.h"
11 #include "base/logging.h" 11 #include "base/logging.h"
12 #include "base/single_thread_task_runner.h" 12 #include "base/single_thread_task_runner.h"
13 #include "base/threading/thread_task_runner_handle.h" 13 #include "base/threading/thread_task_runner_handle.h"
14 #include "media/base/cdm_config.h" 14 #include "media/base/cdm_config.h"
15 #include "media/base/cdm_promise.h" 15 #include "media/base/cdm_promise.h"
16 #include "media/base/key_systems.h" 16 #include "media/base/key_systems.h"
17 #include "media/base/media_keys.h" 17 #include "media/base/media_keys.h"
18 #include "media/cdm/aes_decryptor.h" 18 #include "media/cdm/aes_decryptor.h"
19 #include "ppapi/features/features.h"
19 #include "url/gurl.h" 20 #include "url/gurl.h"
20 #if defined(ENABLE_PEPPER_CDMS) 21
22 #if BUILDFLAG(ENABLE_PEPPER_CDMS)
21 #include "content/renderer/media/cdm/ppapi_decryptor.h" 23 #include "content/renderer/media/cdm/ppapi_decryptor.h"
22 #endif // defined(ENABLE_PEPPER_CDMS) 24 #endif // BUILDFLAG(ENABLE_PEPPER_CDMS)
23 25
24 namespace content { 26 namespace content {
25 27
26 #if defined(ENABLE_PEPPER_CDMS) 28 #if BUILDFLAG(ENABLE_PEPPER_CDMS)
27 RenderCdmFactory::RenderCdmFactory( 29 RenderCdmFactory::RenderCdmFactory(
28 const CreatePepperCdmCB& create_pepper_cdm_cb) 30 const CreatePepperCdmCB& create_pepper_cdm_cb)
29 : create_pepper_cdm_cb_(create_pepper_cdm_cb) {} 31 : create_pepper_cdm_cb_(create_pepper_cdm_cb) {}
30 #else 32 #else
31 RenderCdmFactory::RenderCdmFactory() {} 33 RenderCdmFactory::RenderCdmFactory() {}
32 #endif // defined(ENABLE_PEPPER_CDMS) 34 #endif // BUILDFLAG(ENABLE_PEPPER_CDMS)
33 35
34 RenderCdmFactory::~RenderCdmFactory() { 36 RenderCdmFactory::~RenderCdmFactory() {
35 DCHECK(thread_checker_.CalledOnValidThread()); 37 DCHECK(thread_checker_.CalledOnValidThread());
36 } 38 }
37 39
38 void RenderCdmFactory::Create( 40 void RenderCdmFactory::Create(
39 const std::string& key_system, 41 const std::string& key_system,
40 const GURL& security_origin, 42 const GURL& security_origin,
41 const media::CdmConfig& cdm_config, 43 const media::CdmConfig& cdm_config,
42 const media::SessionMessageCB& session_message_cb, 44 const media::SessionMessageCB& session_message_cb,
(...skipping 13 matching lines...) Expand all
56 DCHECK(!cdm_config.allow_distinctive_identifier); 58 DCHECK(!cdm_config.allow_distinctive_identifier);
57 DCHECK(!cdm_config.allow_persistent_state); 59 DCHECK(!cdm_config.allow_persistent_state);
58 scoped_refptr<media::MediaKeys> cdm( 60 scoped_refptr<media::MediaKeys> cdm(
59 new media::AesDecryptor(security_origin, session_message_cb, 61 new media::AesDecryptor(security_origin, session_message_cb,
60 session_closed_cb, session_keys_change_cb)); 62 session_closed_cb, session_keys_change_cb));
61 base::ThreadTaskRunnerHandle::Get()->PostTask( 63 base::ThreadTaskRunnerHandle::Get()->PostTask(
62 FROM_HERE, base::Bind(cdm_created_cb, cdm, "")); 64 FROM_HERE, base::Bind(cdm_created_cb, cdm, ""));
63 return; 65 return;
64 } 66 }
65 67
66 #if defined(ENABLE_PEPPER_CDMS) 68 #if BUILDFLAG(ENABLE_PEPPER_CDMS)
67 DCHECK(!cdm_config.use_hw_secure_codecs); 69 DCHECK(!cdm_config.use_hw_secure_codecs);
68 PpapiDecryptor::Create( 70 PpapiDecryptor::Create(
69 key_system, security_origin, cdm_config.allow_distinctive_identifier, 71 key_system, security_origin, cdm_config.allow_distinctive_identifier,
70 cdm_config.allow_persistent_state, create_pepper_cdm_cb_, 72 cdm_config.allow_persistent_state, create_pepper_cdm_cb_,
71 session_message_cb, session_closed_cb, session_keys_change_cb, 73 session_message_cb, session_closed_cb, session_keys_change_cb,
72 session_expiration_update_cb, cdm_created_cb); 74 session_expiration_update_cb, cdm_created_cb);
73 #else 75 #else
74 // No possible CDM to create, so fail the request. 76 // No possible CDM to create, so fail the request.
75 base::ThreadTaskRunnerHandle::Get()->PostTask( 77 base::ThreadTaskRunnerHandle::Get()->PostTask(
76 FROM_HERE, 78 FROM_HERE,
77 base::Bind(cdm_created_cb, nullptr, "Key system not supported.")); 79 base::Bind(cdm_created_cb, nullptr, "Key system not supported."));
78 #endif // defined(ENABLE_PEPPER_CDMS) 80 #endif // BUILDFLAG(ENABLE_PEPPER_CDMS)
79 } 81 }
80 82
81 } // namespace content 83 } // namespace content
OLDNEW
« no previous file with comments | « content/renderer/media/cdm/render_cdm_factory.h ('k') | content/renderer/render_frame_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698