| OLD | NEW |
| 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 #ifndef CONTENT_BROWSER_MEDIA_ANDROID_MEDIA_DRM_CREDENTIAL_MANAGER_H_ | 5 #ifndef CONTENT_BROWSER_MEDIA_ANDROID_MEDIA_DRM_CREDENTIAL_MANAGER_H_ |
| 6 #define CONTENT_BROWSER_MEDIA_ANDROID_MEDIA_DRM_CREDENTIAL_MANAGER_H_ | 6 #define CONTENT_BROWSER_MEDIA_ANDROID_MEDIA_DRM_CREDENTIAL_MANAGER_H_ |
| 7 | 7 |
| 8 #include <jni.h> |
| 8 #include <string> | 9 #include <string> |
| 9 | 10 |
| 10 #include "base/callback.h" | 11 #include "base/callback.h" |
| 11 | 12 |
| 12 namespace media { | 13 namespace media { |
| 13 class MediaDrmBridge; | 14 class MediaDrmBridge; |
| 14 } | 15 } |
| 15 | 16 |
| 16 namespace content { | 17 namespace content { |
| 17 | 18 |
| 18 // This class manages the media DRM credentials on Android. | 19 // This class manages the media DRM credentials on Android. |
| 19 class MediaDrmCredentialManager { | 20 class MediaDrmCredentialManager { |
| 20 public: | 21 public: |
| 21 MediaDrmCredentialManager(); | 22 MediaDrmCredentialManager(); |
| 22 ~MediaDrmCredentialManager(); | 23 |
| 24 void Destroy(JNIEnv* env, jobject obj); |
| 23 | 25 |
| 24 typedef base::Callback<void(bool)> ResetCredentialsCB; | 26 typedef base::Callback<void(bool)> ResetCredentialsCB; |
| 25 | 27 |
| 26 // Called to reset the DRM credentials. | 28 // Called to reset the DRM credentials. |
| 27 void ResetCredentials(const ResetCredentialsCB& callback); | 29 void ResetCredentials(const ResetCredentialsCB& callback); |
| 28 | 30 |
| 31 // Called to reset the DRM credentials. (for Java) |
| 32 void ResetCredentials(JNIEnv* env, jobject obj, jobject callback); |
| 33 |
| 34 static bool RegisterMediaDrmCredentialManager(JNIEnv* env); |
| 35 |
| 29 private: | 36 private: |
| 37 ~MediaDrmCredentialManager(); |
| 38 |
| 30 // Callback function passed to MediaDrmBridge. It is called when reset | 39 // Callback function passed to MediaDrmBridge. It is called when reset |
| 31 // completed. | 40 // completed. |
| 32 void OnResetCredentialsCompleted(const std::string& security_level, | 41 void OnResetCredentialsCompleted(const std::string& security_level, |
| 33 bool success); | 42 bool success); |
| 34 | 43 |
| 35 // Reset DRM credentials for a particular security level. Returns false if | 44 // Reset DRM credentials for a particular security level. Returns false if |
| 36 // we fail to create the MediaDrmBridge, or true otherwise. | 45 // we fail to create the MediaDrmBridge, or true otherwise. |
| 37 bool ResetCredentialsInternal(const std::string& security_level); | 46 bool ResetCredentialsInternal(const std::string& security_level); |
| 38 | 47 |
| 39 // The MediaDrmBridge object used to perform the credential reset. | 48 // The MediaDrmBridge object used to perform the credential reset. |
| 40 scoped_ptr<media::MediaDrmBridge> media_drm_bridge_; | 49 scoped_ptr<media::MediaDrmBridge> media_drm_bridge_; |
| 41 | 50 |
| 42 // The callback provided by the caller. | 51 // The callback provided by the caller. |
| 43 ResetCredentialsCB reset_credentials_cb_; | 52 ResetCredentialsCB reset_credentials_cb_; |
| 44 | 53 |
| 45 DISALLOW_COPY_AND_ASSIGN(MediaDrmCredentialManager); | 54 DISALLOW_COPY_AND_ASSIGN(MediaDrmCredentialManager); |
| 46 }; | 55 }; |
| 47 | 56 |
| 48 } // namespace content | 57 } // namespace content |
| 49 | 58 |
| 50 #endif // CONTENT_BROWSER_MEDIA_ANDROID_MEDIA_DRM_CREDENTIAL_MANAGER_H_ | 59 #endif // CONTENT_BROWSER_MEDIA_ANDROID_MEDIA_DRM_CREDENTIAL_MANAGER_H_ |
| OLD | NEW |