OLD | NEW |
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 <string> | 7 #include <string> |
8 | 8 |
9 #include "base/base_switches.h" | 9 #include "base/base_switches.h" |
10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
11 #include "base/files/scoped_file.h" | 11 #include "base/files/scoped_file.h" |
12 #include "base/i18n/rtl.h" | 12 #include "base/i18n/rtl.h" |
13 #include "base/path_service.h" | 13 #include "base/path_service.h" |
14 #include "chromecast/base/cast_paths.h" | 14 #include "chromecast/base/cast_paths.h" |
15 #include "chromecast/base/chromecast_switches.h" | 15 #include "chromecast/base/chromecast_switches.h" |
16 #include "chromecast/browser/cast_browser_context.h" | 16 #include "chromecast/browser/cast_browser_context.h" |
17 #include "chromecast/browser/cast_browser_main_parts.h" | 17 #include "chromecast/browser/cast_browser_main_parts.h" |
18 #include "chromecast/browser/cast_browser_process.h" | 18 #include "chromecast/browser/cast_browser_process.h" |
19 #include "chromecast/browser/cast_network_delegate.h" | 19 #include "chromecast/browser/cast_network_delegate.h" |
20 #include "chromecast/browser/cast_quota_permission_context.h" | 20 #include "chromecast/browser/cast_quota_permission_context.h" |
21 #include "chromecast/browser/cast_resource_dispatcher_host_delegate.h" | 21 #include "chromecast/browser/cast_resource_dispatcher_host_delegate.h" |
22 #include "chromecast/browser/geolocation/cast_access_token_store.h" | 22 #include "chromecast/browser/geolocation/cast_access_token_store.h" |
23 #include "chromecast/browser/media/cma_message_filter_host.h" | 23 #include "chromecast/browser/media/cma_message_filter_host.h" |
24 #include "chromecast/browser/url_request_context_factory.h" | 24 #include "chromecast/browser/url_request_context_factory.h" |
25 #include "chromecast/common/global_descriptors.h" | 25 #include "chromecast/common/global_descriptors.h" |
26 #include "chromecast/media/cma/backend/media_pipeline_device.h" | 26 #include "chromecast/public/cast_media_shlib.h" |
27 #include "chromecast/media/cma/backend/media_pipeline_device_factory.h" | 27 #include "chromecast/public/media/media_pipeline_backend.h" |
28 #include "components/crash/app/breakpad_linux.h" | 28 #include "components/crash/app/breakpad_linux.h" |
29 #include "components/crash/browser/crash_handler_host_linux.h" | 29 #include "components/crash/browser/crash_handler_host_linux.h" |
30 #include "components/network_hints/browser/network_hints_message_filter.h" | 30 #include "components/network_hints/browser/network_hints_message_filter.h" |
31 #include "content/public/browser/browser_thread.h" | 31 #include "content/public/browser/browser_thread.h" |
32 #include "content/public/browser/certificate_request_result_type.h" | 32 #include "content/public/browser/certificate_request_result_type.h" |
33 #include "content/public/browser/client_certificate_delegate.h" | 33 #include "content/public/browser/client_certificate_delegate.h" |
34 #include "content/public/browser/render_process_host.h" | 34 #include "content/public/browser/render_process_host.h" |
35 #include "content/public/browser/resource_dispatcher_host.h" | 35 #include "content/public/browser/resource_dispatcher_host.h" |
36 #include "content/public/browser/web_contents.h" | 36 #include "content/public/browser/web_contents.h" |
37 #include "content/public/common/content_descriptors.h" | 37 #include "content/public/common/content_descriptors.h" |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
72 } | 72 } |
73 | 73 |
74 scoped_ptr<::media::AudioManagerFactory> | 74 scoped_ptr<::media::AudioManagerFactory> |
75 CastContentBrowserClient::CreateAudioManagerFactory() { | 75 CastContentBrowserClient::CreateAudioManagerFactory() { |
76 // Return nullptr. The factory will not be set, and the statically linked | 76 // Return nullptr. The factory will not be set, and the statically linked |
77 // implementation of AudioManager will be used. | 77 // implementation of AudioManager will be used. |
78 return scoped_ptr<::media::AudioManagerFactory>(); | 78 return scoped_ptr<::media::AudioManagerFactory>(); |
79 } | 79 } |
80 | 80 |
81 #if !defined(OS_ANDROID) | 81 #if !defined(OS_ANDROID) |
82 scoped_ptr<media::MediaPipelineDevice> | 82 scoped_ptr<media::MediaPipelineBackend> |
83 CastContentBrowserClient::CreateMediaPipelineDevice( | 83 CastContentBrowserClient::CreateMediaPipelineBackend( |
84 const media::MediaPipelineDeviceParams& params) { | 84 const media::MediaPipelineDeviceParams& params) { |
85 scoped_ptr<media::MediaPipelineDeviceFactory> factory = | 85 return make_scoped_ptr( |
86 GetMediaPipelineDeviceFactory(params); | 86 media::CastMediaShlib::CreateMediaPipelineBackend(params)); |
87 return make_scoped_ptr(new media::MediaPipelineDevice(factory.Pass())); | |
88 } | 87 } |
89 #endif | 88 #endif |
90 | 89 |
91 content::BrowserMainParts* CastContentBrowserClient::CreateBrowserMainParts( | 90 content::BrowserMainParts* CastContentBrowserClient::CreateBrowserMainParts( |
92 const content::MainFunctionParams& parameters) { | 91 const content::MainFunctionParams& parameters) { |
93 return new CastBrowserMainParts(parameters, | 92 return new CastBrowserMainParts(parameters, |
94 url_request_context_factory_.get(), | 93 url_request_context_factory_.get(), |
95 CreateAudioManagerFactory()); | 94 CreateAudioManagerFactory()); |
96 } | 95 } |
97 | 96 |
98 void CastContentBrowserClient::RenderProcessWillLaunch( | 97 void CastContentBrowserClient::RenderProcessWillLaunch( |
99 content::RenderProcessHost* host) { | 98 content::RenderProcessHost* host) { |
100 #if !defined(OS_ANDROID) | 99 #if !defined(OS_ANDROID) |
101 scoped_refptr<media::CmaMessageFilterHost> cma_message_filter( | 100 scoped_refptr<media::CmaMessageFilterHost> cma_message_filter( |
102 new media::CmaMessageFilterHost( | 101 new media::CmaMessageFilterHost( |
103 host->GetID(), | 102 host->GetID(), |
104 base::Bind( | 103 base::Bind(&CastContentBrowserClient::CreateMediaPipelineBackend, |
105 &CastContentBrowserClient::CreateMediaPipelineDevice, | 104 base::Unretained(this)))); |
106 base::Unretained(this)))); | |
107 host->AddFilter(cma_message_filter.get()); | 105 host->AddFilter(cma_message_filter.get()); |
108 #endif // !defined(OS_ANDROID) | 106 #endif // !defined(OS_ANDROID) |
109 | 107 |
110 // Forcibly trigger I/O-thread URLRequestContext initialization before | 108 // Forcibly trigger I/O-thread URLRequestContext initialization before |
111 // getting HostResolver. | 109 // getting HostResolver. |
112 content::BrowserThread::PostTaskAndReplyWithResult( | 110 content::BrowserThread::PostTaskAndReplyWithResult( |
113 content::BrowserThread::IO, FROM_HERE, | 111 content::BrowserThread::IO, FROM_HERE, |
114 base::Bind(&net::URLRequestContextGetter::GetURLRequestContext, | 112 base::Bind(&net::URLRequestContextGetter::GetURLRequestContext, |
115 base::Unretained( | 113 base::Unretained( |
116 url_request_context_factory_->GetSystemGetter())), | 114 url_request_context_factory_->GetSystemGetter())), |
(...skipping 305 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
422 process_type, dumps_path, false /* upload */); | 420 process_type, dumps_path, false /* upload */); |
423 // StartUploaderThread() even though upload is diferred. | 421 // StartUploaderThread() even though upload is diferred. |
424 // Breakpad-related memory is freed in the uploader thread. | 422 // Breakpad-related memory is freed in the uploader thread. |
425 crash_handler->StartUploaderThread(); | 423 crash_handler->StartUploaderThread(); |
426 return crash_handler; | 424 return crash_handler; |
427 } | 425 } |
428 #endif // !defined(OS_ANDROID) | 426 #endif // !defined(OS_ANDROID) |
429 | 427 |
430 } // namespace shell | 428 } // namespace shell |
431 } // namespace chromecast | 429 } // namespace chromecast |
OLD | NEW |