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 <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include <string> | 9 #include <string> |
10 #include <utility> | 10 #include <utility> |
(...skipping 20 matching lines...) Expand all Loading... |
31 #include "chromecast/browser/geolocation/cast_access_token_store.h" | 31 #include "chromecast/browser/geolocation/cast_access_token_store.h" |
32 #include "chromecast/browser/media/cma_message_filter_host.h" | 32 #include "chromecast/browser/media/cma_message_filter_host.h" |
33 #include "chromecast/browser/service/cast_service_simple.h" | 33 #include "chromecast/browser/service/cast_service_simple.h" |
34 #include "chromecast/browser/url_request_context_factory.h" | 34 #include "chromecast/browser/url_request_context_factory.h" |
35 #include "chromecast/common/global_descriptors.h" | 35 #include "chromecast/common/global_descriptors.h" |
36 #include "chromecast/media/audio/cast_audio_manager.h" | 36 #include "chromecast/media/audio/cast_audio_manager.h" |
37 #include "chromecast/media/cma/backend/media_pipeline_backend_manager.h" | 37 #include "chromecast/media/cma/backend/media_pipeline_backend_manager.h" |
38 #include "chromecast/public/media/media_pipeline_backend.h" | 38 #include "chromecast/public/media/media_pipeline_backend.h" |
39 #include "components/crash/content/app/breakpad_linux.h" | 39 #include "components/crash/content/app/breakpad_linux.h" |
40 #include "components/crash/content/browser/crash_handler_host_linux.h" | 40 #include "components/crash/content/browser/crash_handler_host_linux.h" |
41 #include "components/network_hints/browser/network_hints_impl.h" | 41 #include "components/network_hints/browser/network_hints_message_filter.h" |
42 #include "content/public/browser/browser_thread.h" | 42 #include "content/public/browser/browser_thread.h" |
43 #include "content/public/browser/certificate_request_result_type.h" | 43 #include "content/public/browser/certificate_request_result_type.h" |
44 #include "content/public/browser/client_certificate_delegate.h" | 44 #include "content/public/browser/client_certificate_delegate.h" |
45 #include "content/public/browser/geolocation_delegate.h" | 45 #include "content/public/browser/geolocation_delegate.h" |
46 #include "content/public/browser/render_process_host.h" | 46 #include "content/public/browser/render_process_host.h" |
47 #include "content/public/browser/resource_dispatcher_host.h" | 47 #include "content/public/browser/resource_dispatcher_host.h" |
48 #include "content/public/browser/web_contents.h" | 48 #include "content/public/browser/web_contents.h" |
49 #include "content/public/common/content_descriptors.h" | 49 #include "content/public/common/content_descriptors.h" |
50 #include "content/public/common/content_switches.h" | 50 #include "content/public/common/content_switches.h" |
51 #include "content/public/common/url_constants.h" | 51 #include "content/public/common/url_constants.h" |
52 #include "content/public/common/web_preferences.h" | 52 #include "content/public/common/web_preferences.h" |
53 #include "net/ssl/ssl_cert_request_info.h" | 53 #include "net/ssl/ssl_cert_request_info.h" |
54 #include "net/url_request/url_request_context_getter.h" | 54 #include "net/url_request/url_request_context_getter.h" |
55 #include "services/shell/public/cpp/interface_registry.h" | |
56 #include "ui/display/display.h" | 55 #include "ui/display/display.h" |
57 #include "ui/display/screen.h" | 56 #include "ui/display/screen.h" |
58 #include "ui/gl/gl_switches.h" | 57 #include "ui/gl/gl_switches.h" |
59 | 58 |
60 #if defined(ENABLE_MOJO_MEDIA_IN_BROWSER_PROCESS) | 59 #if defined(ENABLE_MOJO_MEDIA_IN_BROWSER_PROCESS) |
61 #include "chromecast/browser/media/cast_mojo_media_client.h" | 60 #include "chromecast/browser/media/cast_mojo_media_client.h" |
62 #include "media/mojo/services/mojo_media_application.h" // nogncheck | 61 #include "media/mojo/services/mojo_media_application.h" // nogncheck |
63 #endif // ENABLE_MOJO_MEDIA_IN_BROWSER_PROCESS | 62 #endif // ENABLE_MOJO_MEDIA_IN_BROWSER_PROCESS |
64 | 63 |
65 #if defined(OS_ANDROID) | 64 #if defined(OS_ANDROID) |
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
203 base::Bind(&CastContentBrowserClient::CreateMediaPipelineBackend, | 202 base::Bind(&CastContentBrowserClient::CreateMediaPipelineBackend, |
204 base::Unretained(this)), | 203 base::Unretained(this)), |
205 GetMediaTaskRunner(), media_resource_tracker())); | 204 GetMediaTaskRunner(), media_resource_tracker())); |
206 host->AddFilter(cma_message_filter.get()); | 205 host->AddFilter(cma_message_filter.get()); |
207 #endif // !defined(OS_ANDROID) | 206 #endif // !defined(OS_ANDROID) |
208 | 207 |
209 // Forcibly trigger I/O-thread URLRequestContext initialization before | 208 // Forcibly trigger I/O-thread URLRequestContext initialization before |
210 // getting HostResolver. | 209 // getting HostResolver. |
211 content::BrowserThread::PostTaskAndReplyWithResult( | 210 content::BrowserThread::PostTaskAndReplyWithResult( |
212 content::BrowserThread::IO, FROM_HERE, | 211 content::BrowserThread::IO, FROM_HERE, |
213 base::Bind( | 212 base::Bind(&net::URLRequestContextGetter::GetURLRequestContext, |
214 &net::URLRequestContextGetter::GetURLRequestContext, | 213 base::Unretained( |
215 base::Unretained(url_request_context_factory_->GetSystemGetter())), | 214 url_request_context_factory_->GetSystemGetter())), |
216 base::Bind(&CastContentBrowserClient::AddNetworkHintsImpl, | 215 base::Bind(&CastContentBrowserClient::AddNetworkHintsMessageFilter, |
217 base::Unretained(this), host->GetID())); | 216 base::Unretained(this), host->GetID())); |
218 } | 217 } |
219 | 218 |
220 void CastContentBrowserClient::AddNetworkHintsImpl( | 219 void CastContentBrowserClient::AddNetworkHintsMessageFilter( |
221 int render_process_id, | 220 int render_process_id, net::URLRequestContext* context) { |
222 net::URLRequestContext* context) { | |
223 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); | 221 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); |
224 | 222 |
225 content::RenderProcessHost* host = | 223 content::RenderProcessHost* host = |
226 content::RenderProcessHost::FromID(render_process_id); | 224 content::RenderProcessHost::FromID(render_process_id); |
227 if (!host) | 225 if (!host) |
228 return; | 226 return; |
229 | 227 |
230 network_hints_.reset(new network_hints::NetworkHintsImpl( | 228 scoped_refptr<content::BrowserMessageFilter> network_hints_message_filter( |
231 url_request_context_factory_->host_resolver())); | 229 new network_hints::NetworkHintsMessageFilter( |
232 // The client outlives the host, which owns the registry, and thus | 230 url_request_context_factory_->host_resolver())); |
233 // |network_hints_| will outlive the registry. | 231 host->AddFilter(network_hints_message_filter.get()); |
234 host->GetInterfaceRegistry()->AddInterface( | |
235 base::Bind(&network_hints::NetworkHintsImpl::Bind, | |
236 base::Unretained(network_hints_.get())), | |
237 content::BrowserThread::GetTaskRunnerForThread( | |
238 content::BrowserThread::IO)); | |
239 } | 232 } |
240 | 233 |
241 bool CastContentBrowserClient::IsHandledURL(const GURL& url) { | 234 bool CastContentBrowserClient::IsHandledURL(const GURL& url) { |
242 if (!url.is_valid()) | 235 if (!url.is_valid()) |
243 return false; | 236 return false; |
244 | 237 |
245 static const char* const kProtocolList[] = { | 238 static const char* const kProtocolList[] = { |
246 content::kChromeUIScheme, | 239 content::kChromeUIScheme, |
247 content::kChromeDevToolsScheme, | 240 content::kChromeDevToolsScheme, |
248 kChromeResourceScheme, | 241 kChromeResourceScheme, |
(...skipping 312 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
561 process_type, dumps_path, false /* upload */); | 554 process_type, dumps_path, false /* upload */); |
562 // StartUploaderThread() even though upload is diferred. | 555 // StartUploaderThread() even though upload is diferred. |
563 // Breakpad-related memory is freed in the uploader thread. | 556 // Breakpad-related memory is freed in the uploader thread. |
564 crash_handler->StartUploaderThread(); | 557 crash_handler->StartUploaderThread(); |
565 return crash_handler; | 558 return crash_handler; |
566 } | 559 } |
567 #endif // !defined(OS_ANDROID) | 560 #endif // !defined(OS_ANDROID) |
568 | 561 |
569 } // namespace shell | 562 } // namespace shell |
570 } // namespace chromecast | 563 } // namespace chromecast |
OLD | NEW |