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

Unified Diff: chrome/browser/media/android/cdm/media_drm_storage_factory.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 side-by-side diff with in-line comments
Download patch
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..fc54ccc614f314b448618045d0111adee326521a
--- /dev/null
+++ b/chrome/browser/media/android/cdm/media_drm_storage_factory.cc
@@ -0,0 +1,48 @@
+// 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 "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(2) << __func__;
+ DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
+ DCHECK(render_frame_host);
+
+ content::WebContents* web_contents =
+ content::WebContents::FromRenderFrameHost(render_frame_host);
+ if (!web_contents)
dcheng 2017/03/29 01:17:22 I'm curious how many of these early returns are ac
xhwang 2017/03/29 20:47:25 Well, I have the same question. But I'd rather cod
+ return;
+
+ content::BrowserContext* browser_context = web_contents->GetBrowserContext();
dcheng 2017/03/29 01:17:22 Similarly, it doesn't seem like this should /ever/
xhwang 2017/03/29 20:47:25 Similarly, it's not clear to me whether this could
+ if (!browser_context)
+ return;
+
+ Profile* profile = Profile::FromBrowserContext(browser_context);
+ if (!profile)
+ return;
+
+ PrefService* pref_service = profile->GetPrefs();
liberato (no reviews please) 2017/03/28 16:42:43 how does lifetime for |pref_service| work? for in
xhwang 2017/03/29 20:47:25 I don't really know. But I am following how PrefSe
+ if (!pref_service)
+ return;
yucliu1 2017/03/27 19:06:41 Are we able to launch the page if these early retu
xhwang 2017/03/27 20:28:46 All of these should never happen in practice :) I
xhwang 2017/03/29 20:47:25 Done.
+
+ mojo::MakeStrongBinding(
+ base::MakeUnique<cdm::MediaDrmStorageImpl>(pref_service),
+ std::move(request));
dcheng 2017/03/29 01:17:22 Nit: #include <utility>
xhwang 2017/03/29 20:47:25 Done.
+}
+
+} // namespace chrome

Powered by Google App Engine
This is Rietveld 408576698