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

Side by Side Diff: content/browser/media/android/media_drm_credential_manager.h

Issue 24152015: [Android] JNI binding for MediaDrmCredentialManager (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Move constructor & destructor bodies to .cc Created 7 years, 3 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 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 #include "base/memory/singleton.h"
12 namespace media { 13 #include "media/base/android/media_drm_bridge.h"
13 class MediaDrmBridge;
14 }
15 14
16 namespace content { 15 namespace content {
17 16
18 // This class manages the media DRM credentials on Android. 17 // This class manages the media DRM credentials on Android.
19 class MediaDrmCredentialManager { 18 class MediaDrmCredentialManager {
20 public: 19 public:
21 MediaDrmCredentialManager(); 20 static MediaDrmCredentialManager* GetInstance();
22 ~MediaDrmCredentialManager();
23 21
24 typedef base::Callback<void(bool)> ResetCredentialsCB; 22 typedef base::Callback<void(bool)> ResetCredentialsCB;
25 23
24 // Called to reset the DRM credentials. (for Java)
25 static void ResetCredentials(JNIEnv* env, jclass clazz, jobject callback);
26
26 // Called to reset the DRM credentials. 27 // Called to reset the DRM credentials.
27 void ResetCredentials(const ResetCredentialsCB& callback); 28 void ResetCredentials(const ResetCredentialsCB& callback);
28 29
30 static bool RegisterMediaDrmCredentialManager(JNIEnv* env);
31
29 private: 32 private:
33 friend struct DefaultSingletonTraits<MediaDrmCredentialManager>;
34 friend class Singleton<MediaDrmCredentialManager>;
35
36 MediaDrmCredentialManager();
37 ~MediaDrmCredentialManager();
38
39
30 // Callback function passed to MediaDrmBridge. It is called when reset 40 // Callback function passed to MediaDrmBridge. It is called when reset
31 // completed. 41 // completed.
32 void OnResetCredentialsCompleted(const std::string& security_level, 42 void OnResetCredentialsCompleted(const std::string& security_level,
33 bool success); 43 bool success);
34 44
35 // Reset DRM credentials for a particular security level. Returns false if 45 // Reset DRM credentials for a particular security level. Returns false if
36 // we fail to create the MediaDrmBridge, or true otherwise. 46 // we fail to create the MediaDrmBridge, or true otherwise.
37 bool ResetCredentialsInternal(const std::string& security_level); 47 bool ResetCredentialsInternal(const std::string& security_level);
38 48
39 // The MediaDrmBridge object used to perform the credential reset. 49 // The MediaDrmBridge object used to perform the credential reset.
40 scoped_ptr<media::MediaDrmBridge> media_drm_bridge_; 50 scoped_ptr<media::MediaDrmBridge> media_drm_bridge_;
41 51
42 // The callback provided by the caller. 52 // The callback provided by the caller.
43 ResetCredentialsCB reset_credentials_cb_; 53 ResetCredentialsCB reset_credentials_cb_;
44 54
45 DISALLOW_COPY_AND_ASSIGN(MediaDrmCredentialManager); 55 DISALLOW_COPY_AND_ASSIGN(MediaDrmCredentialManager);
46 }; 56 };
47 57
48 } // namespace content 58 } // namespace content
49 59
50 #endif // CONTENT_BROWSER_MEDIA_ANDROID_MEDIA_DRM_CREDENTIAL_MANAGER_H_ 60 #endif // CONTENT_BROWSER_MEDIA_ANDROID_MEDIA_DRM_CREDENTIAL_MANAGER_H_
OLDNEW
« no previous file with comments | « content/browser/android/browser_jni_registrar.cc ('k') | content/browser/media/android/media_drm_credential_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698