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

Side by Side Diff: media/base/android/media_drm_storage.h

Issue 2765343003: media: Add MediaDrmStorage (Closed)
Patch Set: fix compile error Created 3 years, 9 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
(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 {
24 public:
25 MediaDrmStorage();
26 virtual ~MediaDrmStorage();
27
28 // Callback to return whether the operation succeeded.
29 using ResultCB = base::OnceCallback<void(bool)>;
30
31 // Callback to return the result of LoadPersistentSession. |key_set_id| and
32 // |mime_type| must be non-empty if |success| is true, and vice versa.
33 using LoadPersistentSessionCB =
34 base::OnceCallback<void(bool success,
35 const std::vector<uint8_t>& key_set_id,
36 const std::string& mime_type)>;
37
38 // Binds |this| to |origin|.
39 // TODO(xhwang): We should NOT use the real origin for provisioning. Use a
40 // random origin ID instead.
41 virtual void Initialize(const url::Origin& origin) = 0;
42
43 // Called when MediaDrm is provisioned for the origin bound to |this|.
44 // The implementation should keep track of the storing time so that the
45 // information can be cleared based on selected time range (e.g. for clearing
46 // browsing data).
47 virtual void OnProvisioned(ResultCB result_cb) = 0;
48
49 // Saves the persistent session info for |session_id| in the storage.
50 // The implementation should keep track of the storing time so that the
51 // information can be cleared based on selected time range (e.g. for clearing
52 // browsing data).
53 virtual void SavePersistentSession(const std::string& session_id,
54 const std::vector<uint8_t>& key_set_id,
55 const std::string& mime_type,
56 ResultCB result_cb) = 0;
57
58 // Loads the persistent session info for |session_id| from the storage.
59 virtual void LoadPersistentSession(
60 const std::string& session_id,
61 LoadPersistentSessionCB load_persistent_session_cb) = 0;
62
63 // Removes the persistent session info for |session_id| from the storage.
64 virtual void RemovePersistentSession(const std::string& session_id,
65 ResultCB result_cb) = 0;
66
67 private:
68 DISALLOW_COPY_AND_ASSIGN(MediaDrmStorage);
69 };
70
71 using CreateStorageCB = base::Callback<std::unique_ptr<MediaDrmStorage>()>;
72
73 } // namespace media
74
75 #endif // MEDIA_BASE_ANDROID_MEDIA_DRM_STORAGE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698