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

Side by Side Diff: media/mojo/services/mojo_cdm_service.h

Issue 2425663003: media: Use native CDM enum types in media mojo interfaces (Closed)
Patch Set: comments addressed 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 | « media/mojo/services/mojo_cdm_promise.cc ('k') | media/mojo/services/mojo_cdm_service.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 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 #ifndef MEDIA_MOJO_SERVICES_MOJO_CDM_SERVICE_H_ 5 #ifndef MEDIA_MOJO_SERVICES_MOJO_CDM_SERVICE_H_
6 #define MEDIA_MOJO_SERVICES_MOJO_CDM_SERVICE_H_ 6 #define MEDIA_MOJO_SERVICES_MOJO_CDM_SERVICE_H_
7 7
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <memory> 10 #include <memory>
11 11
12 #include "base/callback.h" 12 #include "base/callback.h"
13 #include "base/compiler_specific.h" 13 #include "base/compiler_specific.h"
14 #include "base/macros.h" 14 #include "base/macros.h"
15 #include "base/memory/ref_counted.h" 15 #include "base/memory/ref_counted.h"
16 #include "base/memory/weak_ptr.h" 16 #include "base/memory/weak_ptr.h"
17 #include "media/base/eme_constants.h"
17 #include "media/base/media_keys.h" 18 #include "media/base/media_keys.h"
18 #include "media/mojo/interfaces/content_decryption_module.mojom.h" 19 #include "media/mojo/interfaces/content_decryption_module.mojom.h"
19 #include "media/mojo/services/media_mojo_export.h" 20 #include "media/mojo/services/media_mojo_export.h"
20 #include "media/mojo/services/mojo_cdm_promise.h" 21 #include "media/mojo/services/mojo_cdm_promise.h"
21 #include "media/mojo/services/mojo_cdm_service_context.h" 22 #include "media/mojo/services/mojo_cdm_service_context.h"
22 #include "media/mojo/services/mojo_decryptor_service.h" 23 #include "media/mojo/services/mojo_decryptor_service.h"
23 24
24 namespace media { 25 namespace media {
25 26
26 class CdmFactory; 27 class CdmFactory;
27 28
28 // A mojom::ContentDecryptionModule implementation backed by a 29 // A mojom::ContentDecryptionModule implementation backed by a
29 // media::MediaKeys. 30 // media::MediaKeys.
30 class MEDIA_MOJO_EXPORT MojoCdmService 31 class MEDIA_MOJO_EXPORT MojoCdmService
31 : NON_EXPORTED_BASE(public mojom::ContentDecryptionModule) { 32 : NON_EXPORTED_BASE(public mojom::ContentDecryptionModule) {
32 public: 33 public:
34 using SessionType = MediaKeys::SessionType;
35
33 // Get the CDM associated with |cdm_id|, which is unique per process. 36 // Get the CDM associated with |cdm_id|, which is unique per process.
34 // Can be called on any thread. The returned CDM is not guaranteed to be 37 // Can be called on any thread. The returned CDM is not guaranteed to be
35 // thread safe. 38 // thread safe.
36 // Note: This provides a generic hack to get the CDM in the process where 39 // Note: This provides a generic hack to get the CDM in the process where
37 // MojoMediaApplication is running, regardless of which render process or 40 // MojoMediaApplication is running, regardless of which render process or
38 // render frame the caller is associated with. In the future, we should move 41 // render frame the caller is associated with. In the future, we should move
39 // all out-of-process media players into the MojoMediaApplicaiton so that we 42 // all out-of-process media players into the MojoMediaApplicaiton so that we
40 // can use MojoCdmServiceContext (per render frame) to get the CDM. 43 // can use MojoCdmServiceContext (per render frame) to get the CDM.
41 static scoped_refptr<MediaKeys> LegacyGetCdm(int cdm_id); 44 static scoped_refptr<MediaKeys> LegacyGetCdm(int cdm_id);
42 45
43 // Constructs a MojoCdmService and strongly binds it to the |request|. 46 // Constructs a MojoCdmService and strongly binds it to the |request|.
44 MojoCdmService(base::WeakPtr<MojoCdmServiceContext> context, 47 MojoCdmService(base::WeakPtr<MojoCdmServiceContext> context,
45 CdmFactory* cdm_factory); 48 CdmFactory* cdm_factory);
46 49
47 ~MojoCdmService() final; 50 ~MojoCdmService() final;
48 51
49 // mojom::ContentDecryptionModule implementation. 52 // mojom::ContentDecryptionModule implementation.
50 void SetClient(mojom::ContentDecryptionModuleClientPtr client) final; 53 void SetClient(mojom::ContentDecryptionModuleClientPtr client) final;
51 void Initialize(const std::string& key_system, 54 void Initialize(const std::string& key_system,
52 const std::string& security_origin, 55 const std::string& security_origin,
53 mojom::CdmConfigPtr cdm_config, 56 mojom::CdmConfigPtr cdm_config,
54 const InitializeCallback& callback) final; 57 const InitializeCallback& callback) final;
55 void SetServerCertificate(const std::vector<uint8_t>& certificate_data, 58 void SetServerCertificate(const std::vector<uint8_t>& certificate_data,
56 const SetServerCertificateCallback& callback) final; 59 const SetServerCertificateCallback& callback) final;
57 void CreateSessionAndGenerateRequest( 60 void CreateSessionAndGenerateRequest(
58 mojom::ContentDecryptionModule::SessionType session_type, 61 SessionType session_type,
59 mojom::ContentDecryptionModule::InitDataType init_data_type, 62 EmeInitDataType init_data_type,
60 const std::vector<uint8_t>& init_data, 63 const std::vector<uint8_t>& init_data,
61 const CreateSessionAndGenerateRequestCallback& callback) final; 64 const CreateSessionAndGenerateRequestCallback& callback) final;
62 void LoadSession(mojom::ContentDecryptionModule::SessionType session_type, 65 void LoadSession(SessionType session_type,
63 const std::string& session_id, 66 const std::string& session_id,
64 const LoadSessionCallback& callback) final; 67 const LoadSessionCallback& callback) final;
65 void UpdateSession(const std::string& session_id, 68 void UpdateSession(const std::string& session_id,
66 const std::vector<uint8_t>& response, 69 const std::vector<uint8_t>& response,
67 const UpdateSessionCallback& callback) final; 70 const UpdateSessionCallback& callback) final;
68 void CloseSession(const std::string& session_id, 71 void CloseSession(const std::string& session_id,
69 const CloseSessionCallback& callback) final; 72 const CloseSessionCallback& callback) final;
70 void RemoveSession(const std::string& session_id, 73 void RemoveSession(const std::string& session_id,
71 const RemoveSessionCallback& callback) final; 74 const RemoveSessionCallback& callback) final;
72 75
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
112 115
113 base::WeakPtr<MojoCdmService> weak_this_; 116 base::WeakPtr<MojoCdmService> weak_this_;
114 base::WeakPtrFactory<MojoCdmService> weak_factory_; 117 base::WeakPtrFactory<MojoCdmService> weak_factory_;
115 118
116 DISALLOW_COPY_AND_ASSIGN(MojoCdmService); 119 DISALLOW_COPY_AND_ASSIGN(MojoCdmService);
117 }; 120 };
118 121
119 } // namespace media 122 } // namespace media
120 123
121 #endif // MEDIA_MOJO_SERVICES_MOJO_CDM_SERVICE_H_ 124 #endif // MEDIA_MOJO_SERVICES_MOJO_CDM_SERVICE_H_
OLDNEW
« no previous file with comments | « media/mojo/services/mojo_cdm_promise.cc ('k') | media/mojo/services/mojo_cdm_service.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698