OLD | NEW |
---|---|
(Empty) | |
1 // Copyright 2017 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. | |
4 | |
5 #ifndef MEDIA_BASE_ANDROID_MEDIA_DRM_STORAGE_H_ | |
6 #define MEDIA_BASE_ANDROID_MEDIA_DRM_STORAGE_H_ | |
7 | |
8 #include <stdint.h> | |
9 | |
10 #include <memory> | |
11 #include <string> | |
12 #include <vector> | |
13 | |
14 #include "base/callback.h" | |
15 #include "base/macros.h" | |
16 #include "media/base/media_export.h" | |
17 #include "url/origin.h" | |
18 | |
19 namespace media { | |
20 | |
21 // Allows MediaDrmBridge to store and retrieve persistent data. This is needed | |
22 // for features like per-origin provisioning and persistent license support. | |
23 class MEDIA_EXPORT MediaDrmStorage { | |
xhwang
2017/03/23 00:25:11
yucliu: This will be the main interface passed to
| |
24 public: | |
25 MediaDrmStorage(); | |
26 virtual ~MediaDrmStorage(); | |
27 | |
28 using ResultCB = base::OnceCallback<void(bool)>; | |
29 using LoadPersistentSessionCB = | |
30 base::OnceCallback<void(bool, | |
31 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
| |
32 const std::string& mime_type)>; | |
33 | |
34 // Binds |this| to |origin|. | |
35 // TODO(xhwang): We should NOT use the real origin for provisioning. Use a | |
36 // random origin ID instead. | |
37 virtual void Initialize(const url::Origin& origin) = 0; | |
38 | |
39 // Called when MediaDrm is provisioned for the origin bound to |this|. | |
40 // The implementation should keep track of the storing time so that the | |
41 // information can be cleared based on selected time range (e.g. for clearing | |
42 // browsing data). | |
43 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
| |
44 | |
45 // Saves the persistent session info for |session_id| in the storage. | |
46 // The implementation should keep track of the storing time so that the | |
47 // information can be cleared based on selected time range (e.g. for clearing | |
48 // browsing data). | |
49 virtual void SavePersistentSession(const std::string& session_id, | |
50 const std::vector<uint8_t>& key_set_id, | |
51 const std::string& mime_type, | |
52 ResultCB result_cb) = 0; | |
53 | |
54 // Loads the persistent session info for |session_id| from the storage. | |
55 virtual void LoadPersistentSession( | |
56 const std::string& session_id, | |
57 LoadPersistentSessionCB load_persistent_session_cb) = 0; | |
58 | |
59 // Removes the persistent session info for |session_id| from the storage. | |
60 virtual void RemovePersistentSession(const std::string& session_id, | |
61 ResultCB result_cb) = 0; | |
62 | |
63 private: | |
64 DISALLOW_COPY_AND_ASSIGN(MediaDrmStorage); | |
65 }; | |
66 | |
67 using CreateStorageCB = base::Callback<std::unique_ptr<MediaDrmStorage>()>; | |
68 | |
69 } // namespace media | |
70 | |
71 #endif // MEDIA_BASE_ANDROID_MEDIA_DRM_STORAGE_H_ | |
OLD | NEW |