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

Unified Diff: components/cdm/browser/media_drm_storage_impl.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 side-by-side diff with in-line comments
Download patch
Index: components/cdm/browser/media_drm_storage_impl.h
diff --git a/components/cdm/browser/media_drm_storage_impl.h b/components/cdm/browser/media_drm_storage_impl.h
new file mode 100644
index 0000000000000000000000000000000000000000..fdf4589ce9d64754e63b62e91ded41b305e1a2df
--- /dev/null
+++ b/components/cdm/browser/media_drm_storage_impl.h
@@ -0,0 +1,56 @@
+// 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 COMPONENTS_CDM_BROWSER_MEDIA_DRM_STORAGE_IMPL_H_
+#define COMPONENTS_CDM_BROWSER_MEDIA_DRM_STORAGE_IMPL_H_
+
+#include "content/public/browser/render_frame_host.h"
+#include "media/mojo/interfaces/media_drm_storage.mojom.h"
+#include "url/origin.h"
+
+class PrefService;
+
+namespace user_prefs {
+class PrefRegistrySyncable;
+}
+
+namespace cdm {
+
+// Implements media::mojom::MediaDrmStorage using PrefService.
+// This file is located under components/ so that it can be shared by multiple
+// content embedders (e.g. chrome and chromecast).
+class MediaDrmStorageImpl : public media::mojom::MediaDrmStorage {
+ public:
+ static void RegisterProfilePrefs(user_prefs::PrefRegistrySyncable* registry);
+
+ explicit MediaDrmStorageImpl(PrefService* pref_service);
+ ~MediaDrmStorageImpl() final;
dcheng 2017/03/29 01:17:23 Alternatively, the entire class can be marked fina
xhwang 2017/03/29 20:47:25 Done. But then do I still need to mark each overr
+
+ // media::mojom::MediaDrmStorage implementation.
+ void Initialize(const url::Origin& origin) final;
+ void OnProvisioned(const OnProvisionedCallback& callback) final;
+ void SavePersistentSession(
+ const std::string& session_id,
+ const std::vector<uint8_t>& key_set_id,
+ const std::string& mime_type,
+ const SavePersistentSessionCallback& callback) final;
+ void LoadPersistentSession(
+ const std::string& session_id,
+ const LoadPersistentSessionCallback& callback) final;
+ void RemovePersistentSession(
+ const std::string& session_id,
+ const RemovePersistentSessionCallback& callback) final;
+
+ private:
+ PrefService* pref_service_;
+
+ // Store the origin in a string so it can be used as a key in the dictionary.
+ std::string origin_;
+
+ base::WeakPtrFactory<MediaDrmStorageImpl> weak_factory_;
+};
+
+} // namespace cdm
+
+#endif // COMPONENTS_CDM_BROWSER_MEDIA_DRM_STORAGE_IMPL_H_

Powered by Google App Engine
This is Rietveld 408576698