Chromium Code Reviews| Index: content/public/android/java/src/org/chromium/content/browser/MediaDrmCredentialManager.java |
| diff --git a/content/public/android/java/src/org/chromium/content/browser/MediaDrmCredentialManager.java b/content/public/android/java/src/org/chromium/content/browser/MediaDrmCredentialManager.java |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..5f7b24a5f52b00acc7441ff8856c36dfc4aa40fb |
| --- /dev/null |
| +++ b/content/public/android/java/src/org/chromium/content/browser/MediaDrmCredentialManager.java |
| @@ -0,0 +1,62 @@ |
| +// Copyright 2013 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +package org.chromium.content.browser; |
| + |
| +import org.chromium.base.CalledByNative; |
| +import org.chromium.base.JNINamespace; |
| + |
| +/** |
| + * A wrapper of the android MediaDrmCredentialManager |
| + */ |
| +@JNINamespace("content") |
| +public class MediaDrmCredentialManager { |
| + private int mNativeMediaDrmCredentialManager; |
| + |
| + /** |
| + * Callback interface for getting notified from credential reset. |
| + */ |
| + public interface MediaDrmCredentialManagerCallback { |
| + /** |
| + * This method will be called when credential reset attempt is done. |
| + * @param succeeded Whether or not if it succeeded. |
| + */ |
| + @CalledByNative("MediaDrmCredentialManagerCallback") |
| + public void onCredentialResetFinished(boolean succeeded); |
| + } |
| + |
| + /** |
| + * Allocates and initializes the C++ side of this class. |
| + */ |
| + public MediaDrmCredentialManager() { |
| + mNativeMediaDrmCredentialManager = nativeInit(); |
| + } |
| + |
| + /** |
| + * Clean up the C++ side of this class. After the call, this class instance shouldn't be used. |
| + */ |
| + public void destroy() { |
| + nativeDestroy(mNativeMediaDrmCredentialManager); |
| + mNativeMediaDrmCredentialManager = 0; |
| + } |
| + |
| + @Override |
| + protected void finalize() { |
| + assert mNativeMediaDrmCredentialManager == 0; |
| + } |
| + |
| + /** |
| + * Attempts to reset the DRM credentials. |
| + * @param callback It notifies whether or not it succeeded. |
| + */ |
| + public void ResetCredentials(MediaDrmCredentialManagerCallback callback) { |
|
Yaron
2013/09/20 23:53:57
Err. resetCredentials.
Kibeom Kim (inactive)
2013/09/23 18:28:23
Done.
|
| + assert mNativeMediaDrmCredentialManager != 0; |
| + nativeResetCredentials(mNativeMediaDrmCredentialManager, callback); |
| + } |
| + |
| + private static native int nativeInit(); |
| + private static native void nativeDestroy(int nativeMediaDrmCredentialManager); |
| + private static native void nativeResetCredentials(int nativeMediaDrmCredentialManager, |
| + MediaDrmCredentialManagerCallback callback); |
| +} |