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

Side by Side Diff: content/browser/media/media_interface_proxy.cc

Issue 2882813002: media: Convert mojo media defines to buildflags (Closed)
Patch Set: rebase Created 3 years, 7 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
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "content/browser/media/media_interface_proxy.h" 5 #include "content/browser/media/media_interface_proxy.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/memory/ptr_util.h" 10 #include "base/memory/ptr_util.h"
11 #include "content/public/browser/content_browser_client.h" 11 #include "content/public/browser/content_browser_client.h"
12 #include "content/public/browser/render_frame_host.h" 12 #include "content/public/browser/render_frame_host.h"
13 #include "content/public/common/content_client.h" 13 #include "content/public/common/content_client.h"
14 #include "content/public/common/service_manager_connection.h" 14 #include "content/public/common/service_manager_connection.h"
15 #include "media/mojo/features.h"
15 #include "media/mojo/interfaces/media_service.mojom.h" 16 #include "media/mojo/interfaces/media_service.mojom.h"
16 #include "media/mojo/services/media_interface_provider.h" 17 #include "media/mojo/services/media_interface_provider.h"
17 #include "services/service_manager/public/cpp/connector.h" 18 #include "services/service_manager/public/cpp/connector.h"
18 19
19 #if defined(ENABLE_MOJO_CDM) 20 #if BUILDFLAG(ENABLE_MOJO_CDM)
20 #include "content/public/browser/browser_context.h" 21 #include "content/public/browser/browser_context.h"
21 #include "content/public/browser/provision_fetcher_impl.h" 22 #include "content/public/browser/provision_fetcher_impl.h"
22 #include "content/public/browser/render_process_host.h" 23 #include "content/public/browser/render_process_host.h"
23 #include "content/public/browser/storage_partition.h" 24 #include "content/public/browser/storage_partition.h"
24 #include "net/url_request/url_request_context_getter.h" 25 #include "net/url_request/url_request_context_getter.h"
25 #endif 26 #endif
26 27
27 namespace content { 28 namespace content {
28 29
29 MediaInterfaceProxy::MediaInterfaceProxy( 30 MediaInterfaceProxy::MediaInterfaceProxy(
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
97 DVLOG(1) << __FUNCTION__; 98 DVLOG(1) << __FUNCTION__;
98 DCHECK(thread_checker_.CalledOnValidThread()); 99 DCHECK(thread_checker_.CalledOnValidThread());
99 DCHECK(!interface_factory_ptr_); 100 DCHECK(!interface_factory_ptr_);
100 101
101 // Register frame services. 102 // Register frame services.
102 service_manager::mojom::InterfaceProviderPtr interfaces; 103 service_manager::mojom::InterfaceProviderPtr interfaces;
103 // TODO(xhwang): Replace this InterfaceProvider with a dedicated media host 104 // TODO(xhwang): Replace this InterfaceProvider with a dedicated media host
104 // interface. See http://crbug.com/660573 105 // interface. See http://crbug.com/660573
105 auto provider = base::MakeUnique<media::MediaInterfaceProvider>( 106 auto provider = base::MakeUnique<media::MediaInterfaceProvider>(
106 mojo::MakeRequest(&interfaces)); 107 mojo::MakeRequest(&interfaces));
107 #if defined(ENABLE_MOJO_CDM) 108 #if BUILDFLAG(ENABLE_MOJO_CDM)
108 // TODO(slan): Wrap these into a RenderFrame specific ProvisionFetcher impl. 109 // TODO(slan): Wrap these into a RenderFrame specific ProvisionFetcher impl.
109 net::URLRequestContextGetter* context_getter = 110 net::URLRequestContextGetter* context_getter =
110 BrowserContext::GetDefaultStoragePartition( 111 BrowserContext::GetDefaultStoragePartition(
111 render_frame_host_->GetProcess()->GetBrowserContext()) 112 render_frame_host_->GetProcess()->GetBrowserContext())
112 ->GetURLRequestContext(); 113 ->GetURLRequestContext();
113 provider->registry()->AddInterface( 114 provider->registry()->AddInterface(
114 base::Bind(&ProvisionFetcherImpl::Create, context_getter)); 115 base::Bind(&ProvisionFetcherImpl::Create, context_getter));
115 #endif // defined(ENABLE_MOJO_CDM) 116 #endif // BUILDFLAG(ENABLE_MOJO_CDM)
116 GetContentClient()->browser()->ExposeInterfacesToMediaService( 117 GetContentClient()->browser()->ExposeInterfacesToMediaService(
117 provider->registry(), render_frame_host_); 118 provider->registry(), render_frame_host_);
118 119
119 media_registries_.push_back(std::move(provider)); 120 media_registries_.push_back(std::move(provider));
120 121
121 // TODO(slan): Use the BrowserContext Connector instead. See crbug.com/638950. 122 // TODO(slan): Use the BrowserContext Connector instead. See crbug.com/638950.
122 media::mojom::MediaServicePtr media_service; 123 media::mojom::MediaServicePtr media_service;
123 service_manager::Connector* connector = 124 service_manager::Connector* connector =
124 ServiceManagerConnection::GetForProcess()->GetConnector(); 125 ServiceManagerConnection::GetForProcess()->GetConnector();
125 connector->BindInterface("media", &media_service); 126 connector->BindInterface("media", &media_service);
126 media_service->CreateInterfaceFactory(MakeRequest(&interface_factory_ptr_), 127 media_service->CreateInterfaceFactory(MakeRequest(&interface_factory_ptr_),
127 std::move(interfaces)); 128 std::move(interfaces));
128 interface_factory_ptr_.set_connection_error_handler(base::Bind( 129 interface_factory_ptr_.set_connection_error_handler(base::Bind(
129 &MediaInterfaceProxy::OnConnectionError, base::Unretained(this))); 130 &MediaInterfaceProxy::OnConnectionError, base::Unretained(this)));
130 } 131 }
131 132
132 } // namespace content 133 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/media/encrypted_media_browsertest.cc ('k') | content/browser/renderer_host/render_process_host_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698