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

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

Issue 265993002: Add Promises for EME (Chromium side) (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 6 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
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 <string> 9 #include <string>
10 #include <vector> 10 #include <vector>
11 11
12 #include "base/android/scoped_java_ref.h" 12 #include "base/android/scoped_java_ref.h"
13 #include "base/callback.h" 13 #include "base/callback.h"
14 #include "base/memory/scoped_ptr.h" 14 #include "base/memory/scoped_ptr.h"
15 #include "media/base/media_export.h" 15 #include "media/base/media_export.h"
16 #include "media/base/media_keys.h" 16 #include "media/base/media_keys.h"
17 #include "url/gurl.h" 17 #include "url/gurl.h"
18 18
19 class GURL; 19 class GURL;
20 20
21 namespace media { 21 namespace media {
22 22
23 class MediaPlayerManager; 23 class MediaPlayerManager;
24 24
25 // This class provides DRM services for android EME implementation. 25 // This class provides DRM services for android EME implementation.
26 // TODO(qinmin): implement all the functions in this class. 26 // TODO(qinmin): implement all the functions in this class.
27 class MEDIA_EXPORT MediaDrmBridge : public MediaKeys { 27 class MEDIA_EXPORT MediaDrmBridge {
28 public: 28 public:
29 enum SecurityLevel { 29 enum SecurityLevel {
30 SECURITY_LEVEL_NONE = 0, 30 SECURITY_LEVEL_NONE = 0,
31 SECURITY_LEVEL_1 = 1, 31 SECURITY_LEVEL_1 = 1,
32 SECURITY_LEVEL_3 = 3, 32 SECURITY_LEVEL_3 = 3,
33 }; 33 };
34 34
35 typedef base::Callback<void(bool)> ResetCredentialsCB; 35 typedef base::Callback<void(bool)> ResetCredentialsCB;
36 36
37 virtual ~MediaDrmBridge(); 37 virtual ~MediaDrmBridge();
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
75 75
76 // Returns true if |security_level| is successfully set, or false otherwise. 76 // Returns true if |security_level| is successfully set, or false otherwise.
77 // Call this function right after Create() and before any other calls. 77 // Call this function right after Create() and before any other calls.
78 // Note: 78 // Note:
79 // - If this function is not called, the default security level of the device 79 // - If this function is not called, the default security level of the device
80 // will be used. 80 // will be used.
81 // - It's recommended to call this function only once on a MediaDrmBridge 81 // - It's recommended to call this function only once on a MediaDrmBridge
82 // object. Calling this function multiples times may cause errors. 82 // object. Calling this function multiples times may cause errors.
83 bool SetSecurityLevel(SecurityLevel security_level); 83 bool SetSecurityLevel(SecurityLevel security_level);
84 84
85 // MediaKeys implementations. 85 // Media key operations.
86 virtual bool CreateSession(uint32 session_id, 86 bool CreateSession(uint32 session_id,
87 const std::string& content_type, 87 const std::string& content_type,
88 const uint8* init_data, 88 const uint8* init_data,
89 int init_data_length) OVERRIDE; 89 int init_data_length);
90 virtual void LoadSession(uint32 session_id, 90 void LoadSession(uint32 session_id, const std::string& web_session_id);
91 const std::string& web_session_id) OVERRIDE; 91 void UpdateSession(uint32 session_id,
92 virtual void UpdateSession(uint32 session_id, 92 const uint8* response,
93 const uint8* response, 93 int response_length);
94 int response_length) OVERRIDE; 94 void ReleaseSession(uint32 session_id);
95 virtual void ReleaseSession(uint32 session_id) OVERRIDE;
96 95
97 // Returns a MediaCrypto object if it's already created. Returns a null object 96 // Returns a MediaCrypto object if it's already created. Returns a null object
98 // otherwise. 97 // otherwise.
99 base::android::ScopedJavaLocalRef<jobject> GetMediaCrypto(); 98 base::android::ScopedJavaLocalRef<jobject> GetMediaCrypto();
100 99
101 // Sets callback which will be called when MediaCrypto is ready. 100 // Sets callback which will be called when MediaCrypto is ready.
102 // If |closure| is null, previously set callback will be cleared. 101 // If |closure| is null, previously set callback will be cleared.
103 void SetMediaCryptoReadyCB(const base::Closure& closure); 102 void SetMediaCryptoReadyCB(const base::Closure& closure);
104 103
105 // Called after a MediaCrypto object is created. 104 // Called after a MediaCrypto object is created.
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
156 base::Closure media_crypto_ready_cb_; 155 base::Closure media_crypto_ready_cb_;
157 156
158 ResetCredentialsCB reset_credentials_cb_; 157 ResetCredentialsCB reset_credentials_cb_;
159 158
160 DISALLOW_COPY_AND_ASSIGN(MediaDrmBridge); 159 DISALLOW_COPY_AND_ASSIGN(MediaDrmBridge);
161 }; 160 };
162 161
163 } // namespace media 162 } // namespace media
164 163
165 #endif // MEDIA_BASE_ANDROID_MEDIA_DRM_BRIDGE_H_ 164 #endif // MEDIA_BASE_ANDROID_MEDIA_DRM_BRIDGE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698