Updating trunk VERSION from 2139.0 to 2140.0
[chromium-blink-merge.git] / content / browser / media / android / media_drm_credential_manager.h
blobf2cb0fa1fe7c42cd7064b7abb5268dafeab6bf38
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_
8 #include <jni.h>
9 #include <string>
11 #include "base/callback.h"
12 #include "base/memory/singleton.h"
13 #include "media/base/android/media_drm_bridge.h"
15 namespace content {
17 // This class manages the media DRM credentials on Android.
18 class MediaDrmCredentialManager {
19 public:
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. The result is returned in the
28 // |reset_credentials_cb|.
29 void ResetCredentials(const ResetCredentialsCB& reset_credentials_cb);
31 static bool RegisterMediaDrmCredentialManager(JNIEnv* env);
33 private:
34 friend struct DefaultSingletonTraits<MediaDrmCredentialManager>;
35 friend class Singleton<MediaDrmCredentialManager>;
36 typedef media::MediaDrmBridge::SecurityLevel SecurityLevel;
38 MediaDrmCredentialManager();
39 ~MediaDrmCredentialManager();
41 // Callback function passed to MediaDrmBridge. It is called when credentials
42 // reset is completed.
43 void OnResetCredentialsCompleted(SecurityLevel security_level, bool success);
45 // Resets DRM credentials for a particular |security_level|. Returns false if
46 // we fail to create the MediaDrmBridge at all, in which case we cannot reset
47 // the credentials. Otherwise, the result is returned asynchronously in
48 // OnResetCredentialsCompleted() function.
49 bool ResetCredentialsInternal(SecurityLevel security_level);
51 // The MediaDrmBridge object used to perform the credential reset.
52 scoped_ptr<media::MediaDrmBridge> media_drm_bridge_;
54 // The callback provided by the caller.
55 ResetCredentialsCB reset_credentials_cb_;
57 DISALLOW_COPY_AND_ASSIGN(MediaDrmCredentialManager);
60 } // namespace content
62 #endif // CONTENT_BROWSER_MEDIA_ANDROID_MEDIA_DRM_CREDENTIAL_MANAGER_H_