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

Side by Side Diff: chromecast/browser/cast_content_browser_client.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
« no previous file with comments | « chrome/browser/chrome_content_browser_client.cc ('k') | content/browser/BUILD.gn » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "chromecast/browser/cast_content_browser_client.h" 5 #include "chromecast/browser/cast_content_browser_client.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <string> 9 #include <string>
10 #include <utility> 10 #include <utility>
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
49 #include "content/public/browser/render_process_host.h" 49 #include "content/public/browser/render_process_host.h"
50 #include "content/public/browser/resource_dispatcher_host.h" 50 #include "content/public/browser/resource_dispatcher_host.h"
51 #include "content/public/browser/storage_partition.h" 51 #include "content/public/browser/storage_partition.h"
52 #include "content/public/browser/web_contents.h" 52 #include "content/public/browser/web_contents.h"
53 #include "content/public/common/content_descriptors.h" 53 #include "content/public/common/content_descriptors.h"
54 #include "content/public/common/content_switches.h" 54 #include "content/public/common/content_switches.h"
55 #include "content/public/common/service_names.mojom.h" 55 #include "content/public/common/service_names.mojom.h"
56 #include "content/public/common/url_constants.h" 56 #include "content/public/common/url_constants.h"
57 #include "content/public/common/web_preferences.h" 57 #include "content/public/common/web_preferences.h"
58 #include "media/audio/audio_thread_impl.h" 58 #include "media/audio/audio_thread_impl.h"
59 #include "media/mojo/features.h"
59 #include "net/ssl/ssl_cert_request_info.h" 60 #include "net/ssl/ssl_cert_request_info.h"
60 #include "net/url_request/url_request_context_getter.h" 61 #include "net/url_request/url_request_context_getter.h"
61 #include "services/service_manager/public/cpp/bind_source_info.h" 62 #include "services/service_manager/public/cpp/bind_source_info.h"
62 #include "services/service_manager/public/cpp/binder_registry.h" 63 #include "services/service_manager/public/cpp/binder_registry.h"
63 #include "ui/base/resource/resource_bundle.h" 64 #include "ui/base/resource/resource_bundle.h"
64 #include "ui/display/display.h" 65 #include "ui/display/display.h"
65 #include "ui/display/screen.h" 66 #include "ui/display/screen.h"
66 #include "ui/gl/gl_switches.h" 67 #include "ui/gl/gl_switches.h"
67 68
68 #if defined(ENABLE_MOJO_MEDIA_IN_BROWSER_PROCESS) 69 #if BUILDFLAG(ENABLE_MOJO_MEDIA_IN_BROWSER_PROCESS)
69 #include "chromecast/media/service/cast_mojo_media_client.h" 70 #include "chromecast/media/service/cast_mojo_media_client.h"
70 #include "media/mojo/services/media_service.h" // nogncheck 71 #include "media/mojo/services/media_service.h" // nogncheck
71 #endif // ENABLE_MOJO_MEDIA_IN_BROWSER_PROCESS 72 #endif // ENABLE_MOJO_MEDIA_IN_BROWSER_PROCESS
72 73
73 #if defined(OS_ANDROID) 74 #if defined(OS_ANDROID)
74 #include "components/cdm/browser/cdm_message_filter_android.h" 75 #include "components/cdm/browser/cdm_message_filter_android.h"
75 #include "components/crash/content/browser/crash_dump_manager_android.h" 76 #include "components/crash/content/browser/crash_dump_manager_android.h"
76 #endif // defined(OS_ANDROID) 77 #endif // defined(OS_ANDROID)
77 78
78 #if BUILDFLAG(IS_CAST_USING_CMA_BACKEND) 79 #if BUILDFLAG(IS_CAST_USING_CMA_BACKEND)
79 #include "chromecast/media/cdm/cast_cdm_factory.h" 80 #include "chromecast/media/cdm/cast_cdm_factory.h"
80 #endif // BUILDFLAG(IS_CAST_USING_CMA_BACKEND) 81 #endif // BUILDFLAG(IS_CAST_USING_CMA_BACKEND)
81 82
82 namespace chromecast { 83 namespace chromecast {
83 namespace shell { 84 namespace shell {
84 85
85 namespace { 86 namespace {
86 #if defined(ENABLE_MOJO_MEDIA_IN_BROWSER_PROCESS) 87 #if BUILDFLAG(ENABLE_MOJO_MEDIA_IN_BROWSER_PROCESS)
87 static std::unique_ptr<service_manager::Service> CreateMediaService( 88 static std::unique_ptr<service_manager::Service> CreateMediaService(
88 CastContentBrowserClient* browser_client) { 89 CastContentBrowserClient* browser_client) {
89 std::unique_ptr<media::CastMojoMediaClient> mojo_media_client( 90 std::unique_ptr<media::CastMojoMediaClient> mojo_media_client(
90 new media::CastMojoMediaClient( 91 new media::CastMojoMediaClient(
91 browser_client->GetMediaPipelineBackendFactory(), 92 browser_client->GetMediaPipelineBackendFactory(),
92 base::Bind(&CastContentBrowserClient::CreateCdmFactory, 93 base::Bind(&CastContentBrowserClient::CreateCdmFactory,
93 base::Unretained(browser_client)), 94 base::Unretained(browser_client)),
94 browser_client->GetVideoModeSwitcher(), 95 browser_client->GetVideoModeSwitcher(),
95 browser_client->GetVideoResolutionPolicy(), 96 browser_client->GetVideoResolutionPolicy(),
96 browser_client->media_resource_tracker())); 97 browser_client->media_resource_tracker()));
97 return std::unique_ptr<service_manager::Service>( 98 return std::unique_ptr<service_manager::Service>(
98 new ::media::MediaService(std::move(mojo_media_client))); 99 new ::media::MediaService(std::move(mojo_media_client)));
99 } 100 }
100 #endif // defined(ENABLE_MOJO_MEDIA_IN_BROWSER_PROCESS) 101 #endif // BUILDFLAG(ENABLE_MOJO_MEDIA_IN_BROWSER_PROCESS)
101 102
102 } // namespace 103 } // namespace
103 104
104 CastContentBrowserClient::CastContentBrowserClient() 105 CastContentBrowserClient::CastContentBrowserClient()
105 : cast_browser_main_parts_(nullptr), 106 : cast_browser_main_parts_(nullptr),
106 url_request_context_factory_(new URLRequestContextFactory()) {} 107 url_request_context_factory_(new URLRequestContextFactory()) {}
107 108
108 CastContentBrowserClient::~CastContentBrowserClient() { 109 CastContentBrowserClient::~CastContentBrowserClient() {
109 content::BrowserThread::DeleteSoon( 110 content::BrowserThread::DeleteSoon(
110 content::BrowserThread::IO, 111 content::BrowserThread::IO,
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
196 std::unique_ptr<::media::AudioManager> 197 std::unique_ptr<::media::AudioManager>
197 CastContentBrowserClient::CreateAudioManager( 198 CastContentBrowserClient::CreateAudioManager(
198 ::media::AudioLogFactory* audio_log_factory) { 199 ::media::AudioLogFactory* audio_log_factory) {
199 return base::MakeUnique<media::CastAudioManager>( 200 return base::MakeUnique<media::CastAudioManager>(
200 base::MakeUnique<::media::AudioThreadImpl>(), audio_log_factory, 201 base::MakeUnique<::media::AudioThreadImpl>(), audio_log_factory,
201 media_pipeline_backend_manager()); 202 media_pipeline_backend_manager());
202 } 203 }
203 204
204 std::unique_ptr<::media::CdmFactory> 205 std::unique_ptr<::media::CdmFactory>
205 CastContentBrowserClient::CreateCdmFactory() { 206 CastContentBrowserClient::CreateCdmFactory() {
206 #if defined(ENABLE_MOJO_MEDIA_IN_BROWSER_PROCESS) 207 #if BUILDFLAG(ENABLE_MOJO_MEDIA_IN_BROWSER_PROCESS)
207 return base::MakeUnique<media::CastCdmFactory>(GetMediaTaskRunner(), 208 return base::MakeUnique<media::CastCdmFactory>(GetMediaTaskRunner(),
208 media_resource_tracker()); 209 media_resource_tracker());
209 #endif // defined(ENABLE_MOJO_MEDIA_IN_BROWSER_PROCESS) 210 #endif // BUILDFLAG(ENABLE_MOJO_MEDIA_IN_BROWSER_PROCESS)
210 return nullptr; 211 return nullptr;
211 } 212 }
212 #endif // BUILDFLAG(IS_CAST_USING_CMA_BACKEND) 213 #endif // BUILDFLAG(IS_CAST_USING_CMA_BACKEND)
213 214
214 media::MediaCapsImpl* CastContentBrowserClient::media_caps() { 215 media::MediaCapsImpl* CastContentBrowserClient::media_caps() {
215 DCHECK(cast_browser_main_parts_); 216 DCHECK(cast_browser_main_parts_);
216 return cast_browser_main_parts_->media_caps(); 217 return cast_browser_main_parts_->media_caps();
217 } 218 }
218 219
219 void CastContentBrowserClient::SetMetricsClientId( 220 void CastContentBrowserClient::SetMetricsClientId(
(...skipping 256 matching lines...) Expand 10 before | Expand all | Expand 10 after
476 content::AssociatedInterfaceRegistry* associated_registry, 477 content::AssociatedInterfaceRegistry* associated_registry,
477 content::RenderProcessHost* render_process_host) { 478 content::RenderProcessHost* render_process_host) {
478 registry->AddInterface( 479 registry->AddInterface(
479 base::Bind(&media::MediaCapsImpl::AddBinding, 480 base::Bind(&media::MediaCapsImpl::AddBinding,
480 base::Unretained(cast_browser_main_parts_->media_caps())), 481 base::Unretained(cast_browser_main_parts_->media_caps())),
481 base::ThreadTaskRunnerHandle::Get()); 482 base::ThreadTaskRunnerHandle::Get());
482 } 483 }
483 484
484 void CastContentBrowserClient::RegisterInProcessServices( 485 void CastContentBrowserClient::RegisterInProcessServices(
485 StaticServiceMap* services) { 486 StaticServiceMap* services) {
486 #if defined(ENABLE_MOJO_MEDIA_IN_BROWSER_PROCESS) 487 #if BUILDFLAG(ENABLE_MOJO_MEDIA_IN_BROWSER_PROCESS)
487 content::ServiceInfo info; 488 content::ServiceInfo info;
488 info.factory = base::Bind(&CreateMediaService, base::Unretained(this)); 489 info.factory = base::Bind(&CreateMediaService, base::Unretained(this));
489 info.task_runner = GetMediaTaskRunner(); 490 info.task_runner = GetMediaTaskRunner();
490 services->insert(std::make_pair("media", info)); 491 services->insert(std::make_pair("media", info));
491 #endif 492 #endif
492 } 493 }
493 494
494 std::unique_ptr<base::Value> 495 std::unique_ptr<base::Value>
495 CastContentBrowserClient::GetServiceManifestOverlay( 496 CastContentBrowserClient::GetServiceManifestOverlay(
496 base::StringPiece service_name) { 497 base::StringPiece service_name) {
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
571 process_type, dumps_path, false /* upload */); 572 process_type, dumps_path, false /* upload */);
572 // StartUploaderThread() even though upload is diferred. 573 // StartUploaderThread() even though upload is diferred.
573 // Breakpad-related memory is freed in the uploader thread. 574 // Breakpad-related memory is freed in the uploader thread.
574 crash_handler->StartUploaderThread(); 575 crash_handler->StartUploaderThread();
575 return crash_handler; 576 return crash_handler;
576 } 577 }
577 #endif // !defined(OS_ANDROID) 578 #endif // !defined(OS_ANDROID)
578 579
579 } // namespace shell 580 } // namespace shell
580 } // namespace chromecast 581 } // namespace chromecast
OLDNEW
« no previous file with comments | « chrome/browser/chrome_content_browser_client.cc ('k') | content/browser/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698