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
3 // found in the LICENSE file.
5 #ifndef CONTENT_BROWSER_MEDIA_ANDROID_MEDIA_DRM_CREDENTIAL_MANAGER_H_
6 #define CONTENT_BROWSER_MEDIA_ANDROID_MEDIA_DRM_CREDENTIAL_MANAGER_H_
11 #include "base/callback.h"
12 #include "base/memory/singleton.h"
13 #include "media/base/android/media_drm_bridge.h"
17 // This class manages the media DRM credentials on Android.
18 class MediaDrmCredentialManager {
20 static MediaDrmCredentialManager* GetInstance();
22 typedef base::Callback<void(bool)> ResetCredentialsCB;
24 // Called to reset the DRM credentials. (for Java)
25 static void ResetCredentials(JNIEnv* env, jclass clazz, jobject callback);
27 // Called to reset the DRM credentials.
28 void ResetCredentials(const ResetCredentialsCB& callback);
30 static bool RegisterMediaDrmCredentialManager(JNIEnv* env);
33 friend struct DefaultSingletonTraits<MediaDrmCredentialManager>;
34 friend class Singleton<MediaDrmCredentialManager>;
36 MediaDrmCredentialManager();
37 ~MediaDrmCredentialManager();
40 // Callback function passed to MediaDrmBridge. It is called when reset
42 void OnResetCredentialsCompleted(const std::string& security_level,
45 // Reset DRM credentials for a particular security level. Returns false if
46 // we fail to create the MediaDrmBridge, or true otherwise.
47 bool ResetCredentialsInternal(const std::string& security_level);
49 // The MediaDrmBridge object used to perform the credential reset.
50 scoped_ptr<media::MediaDrmBridge> media_drm_bridge_;
52 // The callback provided by the caller.
53 ResetCredentialsCB reset_credentials_cb_;
55 DISALLOW_COPY_AND_ASSIGN(MediaDrmCredentialManager);
58 } // namespace content
60 #endif // CONTENT_BROWSER_MEDIA_ANDROID_MEDIA_DRM_CREDENTIAL_MANAGER_H_