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

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

Issue 2412493003: Revert of Move ENABLE_PEPPER_CDMS to a buildflag header. (Closed)
Patch Set: 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"
20 #include "url/gurl.h" 19 #include "url/gurl.h"
21 20 #if defined(ENABLE_PEPPER_CDMS)
22 #if BUILDFLAG(ENABLE_PEPPER_CDMS)
23 #include "content/renderer/media/cdm/ppapi_decryptor.h" 21 #include "content/renderer/media/cdm/ppapi_decryptor.h"
24 #endif // BUILDFLAG(ENABLE_PEPPER_CDMS) 22 #endif // defined(ENABLE_PEPPER_CDMS)
25 23
26 namespace content { 24 namespace content {
27 25
28 #if BUILDFLAG(ENABLE_PEPPER_CDMS) 26 #if defined(ENABLE_PEPPER_CDMS)
29 RenderCdmFactory::RenderCdmFactory( 27 RenderCdmFactory::RenderCdmFactory(
30 const CreatePepperCdmCB& create_pepper_cdm_cb) 28 const CreatePepperCdmCB& create_pepper_cdm_cb)
31 : create_pepper_cdm_cb_(create_pepper_cdm_cb) {} 29 : create_pepper_cdm_cb_(create_pepper_cdm_cb) {}
32 #else 30 #else
33 RenderCdmFactory::RenderCdmFactory() {} 31 RenderCdmFactory::RenderCdmFactory() {}
34 #endif // BUILDFLAG(ENABLE_PEPPER_CDMS) 32 #endif // defined(ENABLE_PEPPER_CDMS)
35 33
36 RenderCdmFactory::~RenderCdmFactory() { 34 RenderCdmFactory::~RenderCdmFactory() {
37 DCHECK(thread_checker_.CalledOnValidThread()); 35 DCHECK(thread_checker_.CalledOnValidThread());
38 } 36 }
39 37
40 void RenderCdmFactory::Create( 38 void RenderCdmFactory::Create(
41 const std::string& key_system, 39 const std::string& key_system,
42 const GURL& security_origin, 40 const GURL& security_origin,
43 const media::CdmConfig& cdm_config, 41 const media::CdmConfig& cdm_config,
44 const media::SessionMessageCB& session_message_cb, 42 const media::SessionMessageCB& session_message_cb,
(...skipping 13 matching lines...) Expand all
58 DCHECK(!cdm_config.allow_distinctive_identifier); 56 DCHECK(!cdm_config.allow_distinctive_identifier);
59 DCHECK(!cdm_config.allow_persistent_state); 57 DCHECK(!cdm_config.allow_persistent_state);
60 scoped_refptr<media::MediaKeys> cdm( 58 scoped_refptr<media::MediaKeys> cdm(
61 new media::AesDecryptor(security_origin, session_message_cb, 59 new media::AesDecryptor(security_origin, session_message_cb,
62 session_closed_cb, session_keys_change_cb)); 60 session_closed_cb, session_keys_change_cb));
63 base::ThreadTaskRunnerHandle::Get()->PostTask( 61 base::ThreadTaskRunnerHandle::Get()->PostTask(
64 FROM_HERE, base::Bind(cdm_created_cb, cdm, "")); 62 FROM_HERE, base::Bind(cdm_created_cb, cdm, ""));
65 return; 63 return;
66 } 64 }
67 65
68 #if BUILDFLAG(ENABLE_PEPPER_CDMS) 66 #if defined(ENABLE_PEPPER_CDMS)
69 DCHECK(!cdm_config.use_hw_secure_codecs); 67 DCHECK(!cdm_config.use_hw_secure_codecs);
70 PpapiDecryptor::Create( 68 PpapiDecryptor::Create(
71 key_system, security_origin, cdm_config.allow_distinctive_identifier, 69 key_system, security_origin, cdm_config.allow_distinctive_identifier,
72 cdm_config.allow_persistent_state, create_pepper_cdm_cb_, 70 cdm_config.allow_persistent_state, create_pepper_cdm_cb_,
73 session_message_cb, session_closed_cb, session_keys_change_cb, 71 session_message_cb, session_closed_cb, session_keys_change_cb,
74 session_expiration_update_cb, cdm_created_cb); 72 session_expiration_update_cb, cdm_created_cb);
75 #else 73 #else
76 // No possible CDM to create, so fail the request. 74 // No possible CDM to create, so fail the request.
77 base::ThreadTaskRunnerHandle::Get()->PostTask( 75 base::ThreadTaskRunnerHandle::Get()->PostTask(
78 FROM_HERE, 76 FROM_HERE,
79 base::Bind(cdm_created_cb, nullptr, "Key system not supported.")); 77 base::Bind(cdm_created_cb, nullptr, "Key system not supported."));
80 #endif // BUILDFLAG(ENABLE_PEPPER_CDMS) 78 #endif // defined(ENABLE_PEPPER_CDMS)
81 } 79 }
82 80
83 } // namespace content 81 } // 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