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

Unified Diff: chrome/browser/media/android/cdm/media_drm_storage_factory.cc

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 | « chrome/browser/media/android/cdm/media_drm_storage_factory.h ('k') | chrome/browser/prefs/browser_prefs.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/media/android/cdm/media_drm_storage_factory.cc
diff --git a/chrome/browser/media/android/cdm/media_drm_storage_factory.cc b/chrome/browser/media/android/cdm/media_drm_storage_factory.cc
new file mode 100644
index 0000000000000000000000000000000000000000..ef492db7a27d676247e7789d0d6b061e5d92e7ab
--- /dev/null
+++ b/chrome/browser/media/android/cdm/media_drm_storage_factory.cc
@@ -0,0 +1,53 @@
+// 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.
+
+#include "chrome/browser/media/android/cdm/media_drm_storage_factory.h"
+
+#include <utility>
+
+#include "base/logging.h"
+#include "base/memory/ptr_util.h"
+#include "chrome/browser/profiles/profile.h"
+#include "components/cdm/browser/media_drm_storage_impl.h"
+#include "components/prefs/pref_service.h"
+#include "content/public/browser/browser_context.h"
+#include "content/public/browser/browser_thread.h"
+#include "content/public/browser/render_frame_host.h"
+#include "content/public/browser/web_contents.h"
+#include "mojo/public/cpp/bindings/strong_binding.h"
+
+namespace chrome {
+
+void CreateMediaDrmStorage(content::RenderFrameHost* render_frame_host,
+ media::mojom::MediaDrmStorageRequest request) {
+ DVLOG(1) << __func__;
+ DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
+ DCHECK(render_frame_host);
+
+ content::WebContents* web_contents =
+ content::WebContents::FromRenderFrameHost(render_frame_host);
+ DCHECK(web_contents) << "WebContents not available.";
+
+ content::BrowserContext* browser_context = web_contents->GetBrowserContext();
+ DCHECK(browser_context) << "BrowserContext not available.";
+
+ Profile* profile = Profile::FromBrowserContext(browser_context);
+ DCHECK(profile) << "Profile not available.";
+
+ PrefService* pref_service = profile->GetPrefs();
+ DCHECK(pref_service) << "PrefService not available.";
+
+ url::Origin origin = render_frame_host->GetLastCommittedOrigin();
+ if (origin.unique()) {
+ DVLOG(1) << __func__ << ": Unique origin.";
+ return;
+ }
+
+ // The object will be deleted on connection error, or when the frame navigates
+ // away.
+ new cdm::MediaDrmStorageImpl(render_frame_host, pref_service, origin,
+ std::move(request));
+}
+
+} // namespace chrome
« no previous file with comments | « chrome/browser/media/android/cdm/media_drm_storage_factory.h ('k') | chrome/browser/prefs/browser_prefs.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698