Chromium Code Reviews| Index: media/base/android/media_drm_storage.h |
| diff --git a/media/base/android/media_drm_storage.h b/media/base/android/media_drm_storage.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..220e9f044bf091f5a5464d06cc4eb7bd020d9c3a |
| --- /dev/null |
| +++ b/media/base/android/media_drm_storage.h |
| @@ -0,0 +1,71 @@ |
| +// Copyright 2017 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. |
| + |
| +#ifndef MEDIA_BASE_ANDROID_MEDIA_DRM_STORAGE_H_ |
| +#define MEDIA_BASE_ANDROID_MEDIA_DRM_STORAGE_H_ |
| + |
| +#include <stdint.h> |
| + |
| +#include <memory> |
| +#include <string> |
| +#include <vector> |
| + |
| +#include "base/callback.h" |
| +#include "base/macros.h" |
| +#include "media/base/media_export.h" |
| +#include "url/origin.h" |
| + |
| +namespace media { |
| + |
| +// Allows MediaDrmBridge to store and retrieve persistent data. This is needed |
| +// for features like per-origin provisioning and persistent license support. |
| +class MEDIA_EXPORT MediaDrmStorage { |
|
xhwang
2017/03/23 00:25:11
yucliu: This will be the main interface passed to
|
| + public: |
| + MediaDrmStorage(); |
| + virtual ~MediaDrmStorage(); |
| + |
| + using ResultCB = base::OnceCallback<void(bool)>; |
| + using LoadPersistentSessionCB = |
| + base::OnceCallback<void(bool, |
| + const std::vector<uint8_t>& key_set_id, |
|
yucliu1
2017/03/23 01:07:16
We may want std::string key_set_id.
xhwang
2017/03/23 05:22:06
Will the Java side pass a string for the key_set_i
|
| + const std::string& mime_type)>; |
| + |
| + // Binds |this| to |origin|. |
| + // TODO(xhwang): We should NOT use the real origin for provisioning. Use a |
| + // random origin ID instead. |
| + virtual void Initialize(const url::Origin& origin) = 0; |
| + |
| + // Called when MediaDrm is provisioned for the origin bound to |this|. |
| + // The implementation should keep track of the storing time so that the |
| + // information can be cleared based on selected time range (e.g. for clearing |
| + // browsing data). |
| + virtual void OnProvisioned(ResultCB result_cb) = 0; |
|
yucliu1
2017/03/23 01:07:16
Should we have a function to clear the provisioned
xhwang
2017/03/23 05:22:06
This will happen on the browser side, and doesn't
|
| + |
| + // Saves the persistent session info for |session_id| in the storage. |
| + // The implementation should keep track of the storing time so that the |
| + // information can be cleared based on selected time range (e.g. for clearing |
| + // browsing data). |
| + virtual void SavePersistentSession(const std::string& session_id, |
| + const std::vector<uint8_t>& key_set_id, |
| + const std::string& mime_type, |
| + ResultCB result_cb) = 0; |
| + |
| + // Loads the persistent session info for |session_id| from the storage. |
| + virtual void LoadPersistentSession( |
| + const std::string& session_id, |
| + LoadPersistentSessionCB load_persistent_session_cb) = 0; |
| + |
| + // Removes the persistent session info for |session_id| from the storage. |
| + virtual void RemovePersistentSession(const std::string& session_id, |
| + ResultCB result_cb) = 0; |
| + |
| + private: |
| + DISALLOW_COPY_AND_ASSIGN(MediaDrmStorage); |
| +}; |
| + |
| +using CreateStorageCB = base::Callback<std::unique_ptr<MediaDrmStorage>()>; |
| + |
| +} // namespace media |
| + |
| +#endif // MEDIA_BASE_ANDROID_MEDIA_DRM_STORAGE_H_ |