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

Side by Side Diff: chrome/browser/media/android/cdm/media_drm_storage_factory.cc

Issue 2765343003: media: Add MediaDrmStorage (Closed)
Patch Set: rebase only Created 3 years, 8 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 "chrome/browser/media/android/cdm/media_drm_storage_factory.h"
6
7 #include <utility>
8
9 #include "base/logging.h"
10 #include "base/memory/ptr_util.h"
11 #include "chrome/browser/profiles/profile.h"
12 #include "components/cdm/browser/media_drm_storage_impl.h"
13 #include "components/prefs/pref_service.h"
14 #include "content/public/browser/browser_context.h"
15 #include "content/public/browser/browser_thread.h"
16 #include "content/public/browser/render_frame_host.h"
17 #include "content/public/browser/web_contents.h"
18 #include "mojo/public/cpp/bindings/strong_binding.h"
19
20 namespace chrome {
21
22 void CreateMediaDrmStorage(content::RenderFrameHost* render_frame_host,
23 media::mojom::MediaDrmStorageRequest request) {
24 DVLOG(1) << __func__;
25 DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
26 DCHECK(render_frame_host);
27
28 content::WebContents* web_contents =
29 content::WebContents::FromRenderFrameHost(render_frame_host);
30 DCHECK(web_contents) << "WebContents not available.";
31
32 content::BrowserContext* browser_context = web_contents->GetBrowserContext();
33 DCHECK(browser_context) << "BrowserContext not available.";
34
35 Profile* profile = Profile::FromBrowserContext(browser_context);
36 DCHECK(profile) << "Profile not available.";
37
38 PrefService* pref_service = profile->GetPrefs();
39 DCHECK(pref_service) << "PrefService not available.";
40
41 url::Origin origin = render_frame_host->GetLastCommittedOrigin();
42 if (origin.unique()) {
43 DVLOG(1) << __func__ << ": Unique origin.";
44 return;
45 }
46
47 // The object will be deleted on connection error, or when the frame navigates
48 // away.
49 new cdm::MediaDrmStorageImpl(render_frame_host, pref_service, origin,
50 std::move(request));
51 }
52
53 } // namespace chrome
OLDNEW
« 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