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

Side by Side Diff: media/base/android/media_drm_bridge.h

Issue 2765343003: media: Add MediaDrmStorage (Closed)
Patch Set: rebase only Created 3 years, 8 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/base/android/android_cdm_factory.cc ('k') | media/base/android/media_drm_bridge.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 (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 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 #ifndef MEDIA_BASE_ANDROID_MEDIA_DRM_BRIDGE_H_ 5 #ifndef MEDIA_BASE_ANDROID_MEDIA_DRM_BRIDGE_H_
6 #define MEDIA_BASE_ANDROID_MEDIA_DRM_BRIDGE_H_ 6 #define MEDIA_BASE_ANDROID_MEDIA_DRM_BRIDGE_H_
7 7
8 #include <jni.h> 8 #include <jni.h>
9 #include <stdint.h> 9 #include <stdint.h>
10 10
11 #include <memory> 11 #include <memory>
12 #include <string> 12 #include <string>
13 #include <vector> 13 #include <vector>
14 14
15 #include "base/android/scoped_java_ref.h" 15 #include "base/android/scoped_java_ref.h"
16 #include "base/callback.h" 16 #include "base/callback.h"
17 #include "base/macros.h" 17 #include "base/macros.h"
18 #include "base/memory/ref_counted.h" 18 #include "base/memory/ref_counted.h"
19 #include "base/memory/weak_ptr.h" 19 #include "base/memory/weak_ptr.h"
20 #include "base/sequenced_task_runner_helpers.h" 20 #include "base/sequenced_task_runner_helpers.h"
21 #include "media/base/android/android_util.h" 21 #include "media/base/android/android_util.h"
22 #include "media/base/android/media_drm_bridge_cdm_context.h" 22 #include "media/base/android/media_drm_bridge_cdm_context.h"
23 #include "media/base/android/media_drm_storage.h"
23 #include "media/base/android/media_drm_storage_bridge.h" 24 #include "media/base/android/media_drm_storage_bridge.h"
24 #include "media/base/cdm_promise.h" 25 #include "media/base/cdm_promise.h"
25 #include "media/base/cdm_promise_adapter.h" 26 #include "media/base/cdm_promise_adapter.h"
26 #include "media/base/content_decryption_module.h" 27 #include "media/base/content_decryption_module.h"
27 #include "media/base/media_export.h" 28 #include "media/base/media_export.h"
28 #include "media/base/player_tracker.h" 29 #include "media/base/player_tracker.h"
29 #include "media/base/provision_fetcher.h" 30 #include "media/base/provision_fetcher.h"
30 #include "media/cdm/player_tracker_impl.h" 31 #include "media/cdm/player_tracker_impl.h"
31 #include "url/gurl.h" 32 #include "url/gurl.h"
32 33
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
89 static std::vector<std::string> GetPlatformKeySystemNames(); 90 static std::vector<std::string> GetPlatformKeySystemNames();
90 91
91 // Returns a MediaDrmBridge instance if |key_system| and |security_level| are 92 // Returns a MediaDrmBridge instance if |key_system| and |security_level| are
92 // supported, and nullptr otherwise. The default security level will be used 93 // supported, and nullptr otherwise. The default security level will be used
93 // if |security_level| is SECURITY_LEVEL_DEFAULT. 94 // if |security_level| is SECURITY_LEVEL_DEFAULT.
94 static scoped_refptr<MediaDrmBridge> Create( 95 static scoped_refptr<MediaDrmBridge> Create(
95 const std::string& key_system, 96 const std::string& key_system,
96 const GURL& security_origin, 97 const GURL& security_origin,
97 SecurityLevel security_level, 98 SecurityLevel security_level,
98 const CreateFetcherCB& create_fetcher_cb, 99 const CreateFetcherCB& create_fetcher_cb,
100 const CreateStorageCB& create_storage_cb,
99 const SessionMessageCB& session_message_cb, 101 const SessionMessageCB& session_message_cb,
100 const SessionClosedCB& session_closed_cb, 102 const SessionClosedCB& session_closed_cb,
101 const SessionKeysChangeCB& session_keys_change_cb, 103 const SessionKeysChangeCB& session_keys_change_cb,
102 const SessionExpirationUpdateCB& session_expiration_update_cb); 104 const SessionExpirationUpdateCB& session_expiration_update_cb);
103 105
104 // Same as Create() except that no session callbacks are provided. This is 106 // Same as Create() except that no session callbacks are provided. This is
105 // used when we need to use MediaDrmBridge without creating any sessions. 107 // used when we need to use MediaDrmBridge without creating any sessions.
106 // TODO(yucliu): Pass |security_origin| here to clear per-origin certs and 108 // TODO(yucliu): Pass |security_origin| here to clear per-origin certs and
107 // licenses. 109 // licenses.
108 static scoped_refptr<MediaDrmBridge> CreateWithoutSessionSupport( 110 static scoped_refptr<MediaDrmBridge> CreateWithoutSessionSupport(
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after
236 238
237 private: 239 private:
238 // For DeleteSoon() in DeleteOnCorrectThread(). 240 // For DeleteSoon() in DeleteOnCorrectThread().
239 friend class base::DeleteHelper<MediaDrmBridge>; 241 friend class base::DeleteHelper<MediaDrmBridge>;
240 242
241 static scoped_refptr<MediaDrmBridge> CreateInternal( 243 static scoped_refptr<MediaDrmBridge> CreateInternal(
242 const std::string& key_system, 244 const std::string& key_system,
243 const GURL& security_origin, 245 const GURL& security_origin,
244 SecurityLevel security_level, 246 SecurityLevel security_level,
245 const CreateFetcherCB& create_fetcher_cb, 247 const CreateFetcherCB& create_fetcher_cb,
248 const CreateStorageCB& create_storage_cb,
246 const SessionMessageCB& session_message_cb, 249 const SessionMessageCB& session_message_cb,
247 const SessionClosedCB& session_closed_cb, 250 const SessionClosedCB& session_closed_cb,
248 const SessionKeysChangeCB& session_keys_change_cb, 251 const SessionKeysChangeCB& session_keys_change_cb,
249 const SessionExpirationUpdateCB& session_expiration_update_cb); 252 const SessionExpirationUpdateCB& session_expiration_update_cb);
250 253
251 // Constructs a MediaDrmBridge for |scheme_uuid| and |security_level|. The 254 // Constructs a MediaDrmBridge for |scheme_uuid| and |security_level|. The
252 // default security level will be used if |security_level| is 255 // default security level will be used if |security_level| is
253 // SECURITY_LEVEL_DEFAULT. Sessions should not be created if session callbacks 256 // SECURITY_LEVEL_DEFAULT. Sessions should not be created if session callbacks
254 // are null. 257 // are null.
255 MediaDrmBridge(const std::vector<uint8_t>& scheme_uuid, 258 MediaDrmBridge(const std::vector<uint8_t>& scheme_uuid,
256 const GURL& security_origin, 259 const GURL& security_origin,
257 SecurityLevel security_level, 260 SecurityLevel security_level,
258 const CreateFetcherCB& create_fetcher_cb, 261 const CreateFetcherCB& create_fetcher_cb,
262 const CreateStorageCB& create_storage_cb,
259 const SessionMessageCB& session_message_cb, 263 const SessionMessageCB& session_message_cb,
260 const SessionClosedCB& session_closed_cb, 264 const SessionClosedCB& session_closed_cb,
261 const SessionKeysChangeCB& session_keys_change_cb, 265 const SessionKeysChangeCB& session_keys_change_cb,
262 const SessionExpirationUpdateCB& session_expiration_update_cb); 266 const SessionExpirationUpdateCB& session_expiration_update_cb);
263 267
264 ~MediaDrmBridge() override; 268 ~MediaDrmBridge() override;
265 269
266 static bool IsSecureDecoderRequired(SecurityLevel security_level); 270 static bool IsSecureDecoderRequired(SecurityLevel security_level);
267 271
268 // Get the security level of the media. 272 // Get the security level of the media.
(...skipping 26 matching lines...) Expand all
295 // MediaCrypto creation has not been notified via NotifyMediaCryptoReady(). 299 // MediaCrypto creation has not been notified via NotifyMediaCryptoReady().
296 // !j_media_crypto_->is_null(): 300 // !j_media_crypto_->is_null():
297 // MediaCrypto creation succeeded and it has been notified. 301 // MediaCrypto creation succeeded and it has been notified.
298 // j_media_crypto_->is_null(): 302 // j_media_crypto_->is_null():
299 // MediaCrypto creation failed and it has been notified. 303 // MediaCrypto creation failed and it has been notified.
300 JavaObjectPtr j_media_crypto_; 304 JavaObjectPtr j_media_crypto_;
301 305
302 // The callback to create a ProvisionFetcher. 306 // The callback to create a ProvisionFetcher.
303 CreateFetcherCB create_fetcher_cb_; 307 CreateFetcherCB create_fetcher_cb_;
304 308
309 // The callback to create a MediaDrmStorage.
310 CreateStorageCB create_storage_cb_;
311
305 // The ProvisionFetcher that requests and receives provisioning data. 312 // The ProvisionFetcher that requests and receives provisioning data.
306 // Non-null iff when a provision request is pending. 313 // Non-null iff when a provision request is pending.
307 std::unique_ptr<ProvisionFetcher> provision_fetcher_; 314 std::unique_ptr<ProvisionFetcher> provision_fetcher_;
308 315
309 // Callbacks for firing session events. 316 // Callbacks for firing session events.
310 SessionMessageCB session_message_cb_; 317 SessionMessageCB session_message_cb_;
311 SessionClosedCB session_closed_cb_; 318 SessionClosedCB session_closed_cb_;
312 SessionKeysChangeCB session_keys_change_cb_; 319 SessionKeysChangeCB session_keys_change_cb_;
313 SessionExpirationUpdateCB session_expiration_update_cb_; 320 SessionExpirationUpdateCB session_expiration_update_cb_;
314 321
(...skipping 12 matching lines...) Expand all
327 334
328 // NOTE: Weak pointers must be invalidated before all other member variables. 335 // NOTE: Weak pointers must be invalidated before all other member variables.
329 base::WeakPtrFactory<MediaDrmBridge> weak_factory_; 336 base::WeakPtrFactory<MediaDrmBridge> weak_factory_;
330 337
331 DISALLOW_COPY_AND_ASSIGN(MediaDrmBridge); 338 DISALLOW_COPY_AND_ASSIGN(MediaDrmBridge);
332 }; 339 };
333 340
334 } // namespace media 341 } // namespace media
335 342
336 #endif // MEDIA_BASE_ANDROID_MEDIA_DRM_BRIDGE_H_ 343 #endif // MEDIA_BASE_ANDROID_MEDIA_DRM_BRIDGE_H_
OLDNEW
« no previous file with comments | « media/base/android/android_cdm_factory.cc ('k') | media/base/android/media_drm_bridge.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698