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

Side by Side Diff: components/cdm/browser/media_drm_storage_impl.cc

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 #include "components/cdm/browser/media_drm_storage_impl.h"
6
7 #include "base/logging.h"
8 #include "base/memory/ptr_util.h"
9 #include "base/optional.h"
10 #include "components/pref_registry/pref_registry_syncable.h"
11 #include "components/prefs/pref_service.h"
12 #include "components/prefs/scoped_user_pref_update.h"
13 #include "content/public/browser/browser_thread.h"
14
15 // The storage will be managed by PrefService. All data will be stored in a
16 // dictionary under the key "media.media_drm_storage". The dictionary is
17 // structured as follows:
18 //
19 // {
20 // $origin: {
21 // "origin_id": $origin_id
22 // "creation_time": $creation_time
23 // "sessions" : {
24 // $session_id: {
25 // "key_set_id": $key_set_id,
26 // "mime_type": $mime_type,
27 // "creation_time": $creation_time
28 // },
29 // # more session_id map...
30 // }
31 // },
32 // # more origin map...
33 // }
34
35 namespace cdm {
36
37 namespace {
38
39 const char kMediaDrmStorage[] = "media.media_drm_storage";
40
41 } // namespace
42
43 // static
44 void MediaDrmStorageImpl::RegisterProfilePrefs(
45 user_prefs::PrefRegistrySyncable* registry) {
46 registry->RegisterDictionaryPref(kMediaDrmStorage,
47 new base::DictionaryValue());
48 }
49
50 MediaDrmStorageImpl::MediaDrmStorageImpl(PrefService* pref_service)
51 : pref_service_(pref_service), weak_factory_(this) {
52 DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
53 DCHECK(pref_service_);
54 }
55
56 MediaDrmStorageImpl::~MediaDrmStorageImpl() {
57 DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
58 }
59
60 void MediaDrmStorageImpl::Initialize(const url::Origin& origin) {
61 DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
62 DCHECK(!origin.unique());
63 origin_ = origin.Serialize();
dcheng 2017/03/29 01:17:23 Rather than passing the origin over Mojo, can we j
xhwang 2017/03/29 20:47:25 Yeah, that's what we chat about before and propose
dcheng 2017/03/29 21:15:12 I think I'm missing something: the GPU process is
xhwang 2017/03/29 21:30:44 We have many out-of-process media components. For
dcheng 2017/03/30 00:29:15 There are some complexities with plumbing here, bu
64 }
65
66 void MediaDrmStorageImpl::OnProvisioned(const OnProvisionedCallback& callback) {
67 DVLOG(2) << __func__;
68 DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
69 DCHECK(!origin_.empty());
dcheng 2017/03/29 01:17:23 Note that we shouldn't be DCHECKing these sorts of
xhwang 2017/03/29 20:47:25 FWIW, the CDM (MediaDrm) is actually running in th
70
71 NOTIMPLEMENTED();
xhwang 2017/03/24 21:22:38 Partial implementation of these functions and some
72 callback.Run(false);
73 }
74
75 void MediaDrmStorageImpl::SavePersistentSession(
76 const std::string& session_id,
77 const std::vector<uint8_t>& key_set_id,
78 const std::string& mime_type,
79 const SavePersistentSessionCallback& callback) {
80 DVLOG(2) << __func__;
81 DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
82 DCHECK(!origin_.empty());
83
84 NOTIMPLEMENTED();
85 callback.Run(false);
86 }
87
88 void MediaDrmStorageImpl::LoadPersistentSession(
89 const std::string& session_id,
90 const LoadPersistentSessionCallback& callback) {
91 DVLOG(2) << __func__;
92 DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
93 DCHECK(!origin_.empty());
94
95 NOTIMPLEMENTED();
96 callback.Run(false, {}, "");
97 }
98
99 void MediaDrmStorageImpl::RemovePersistentSession(
100 const std::string& session_id,
101 const RemovePersistentSessionCallback& callback) {
102 DVLOG(2) << __func__;
103 DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
104 DCHECK(!origin_.empty());
105
106 NOTIMPLEMENTED();
107 callback.Run(false);
108 }
109
110 } // namespace cdm
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698