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

Unified Diff: components/cdm/browser/media_drm_storage_impl.h

Issue 2765343003: media: Add MediaDrmStorage (Closed)
Patch Set: rebase only 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
« no previous file with comments | « components/cdm/browser/DEPS ('k') | components/cdm/browser/media_drm_storage_impl.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..c71a90d1cf7a15b3ed39aca23279b231a5bd9a0c
--- /dev/null
+++ b/components/cdm/browser/media_drm_storage_impl.h
@@ -0,0 +1,69 @@
+// 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 "content/public/browser/web_contents_observer.h"
+#include "media/mojo/interfaces/media_drm_storage.mojom.h"
+#include "mojo/public/cpp/bindings/binding.h"
+#include "url/origin.h"
+
+class PrefRegistrySimple;
+class PrefService;
+
+namespace content {
+class RenderFrameHost;
+}
+
+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 final : public media::mojom::MediaDrmStorage,
+ public content::WebContentsObserver {
+ public:
+ static void RegisterProfilePrefs(PrefRegistrySimple* registry);
+
+ MediaDrmStorageImpl(content::RenderFrameHost* render_frame_host,
+ PrefService* pref_service,
+ const url::Origin& origin,
+ media::mojom::MediaDrmStorageRequest request);
+ ~MediaDrmStorageImpl() final;
+
+ // media::mojom::MediaDrmStorage implementation.
+ void Initialize(const url::Origin& origin) final;
+ void OnProvisioned(const OnProvisionedCallback& callback) final;
+ void SavePersistentSession(
+ const std::string& session_id,
+ media::mojom::SessionDataPtr session_data,
+ 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;
+
+ // content::WebContentsObserver implementation.
+ void RenderFrameDeleted(content::RenderFrameHost* render_frame_host) final;
+ void DidFinishNavigation(content::NavigationHandle* navigation_handle) final;
+
+ private:
+ // Stops observing WebContents and delete |this|.
+ void Close();
+
+ content::RenderFrameHost* const render_frame_host_ = nullptr;
+ PrefService* const pref_service_ = nullptr;
+ const url::Origin origin_;
+ bool initialized_ = false;
+
+ mojo::Binding<media::mojom::MediaDrmStorage> binding_;
+};
+
+} // namespace cdm
+
+#endif // COMPONENTS_CDM_BROWSER_MEDIA_DRM_STORAGE_IMPL_H_
« no previous file with comments | « components/cdm/browser/DEPS ('k') | components/cdm/browser/media_drm_storage_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698