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

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

Issue 2765343003: media: Add MediaDrmStorage (Closed)
Patch Set: Move MediaDrmStorageImpl to components/ 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 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 "base/logging.h"
8 #include "base/memory/ptr_util.h"
9 #include "chrome/browser/profiles/profile.h"
10 #include "components/cdm/browser/media_drm_storage_impl.h"
11 #include "components/prefs/pref_service.h"
12 #include "content/public/browser/browser_context.h"
13 #include "content/public/browser/browser_thread.h"
14 #include "content/public/browser/render_frame_host.h"
15 #include "content/public/browser/web_contents.h"
16 #include "mojo/public/cpp/bindings/strong_binding.h"
17
18 namespace chrome {
19
20 void CreateMediaDrmStorage(content::RenderFrameHost* render_frame_host,
21 media::mojom::MediaDrmStorageRequest request) {
22 DVLOG(2) << __func__;
23 DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
24 DCHECK(render_frame_host);
25
26 content::WebContents* web_contents =
27 content::WebContents::FromRenderFrameHost(render_frame_host);
28 if (!web_contents)
29 return;
30
31 content::BrowserContext* browser_context = web_contents->GetBrowserContext();
32 if (!browser_context)
33 return;
34
35 Profile* profile = Profile::FromBrowserContext(browser_context);
36 if (!profile)
37 return;
38
39 PrefService* pref_service = profile->GetPrefs();
40 if (!pref_service)
41 return;
42
43 mojo::MakeStrongBinding(
44 base::MakeUnique<cdm::MediaDrmStorageImpl>(pref_service),
45 std::move(request));
46 }
47
48 } // namespace chrome
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698