Chromium Code Reviews| 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_message_filter.h" | 41 #include "components/network_hints/browser/network_hints_impl.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" | |
| 55 #include "ui/display/display.h" | 56 #include "ui/display/display.h" |
| 56 #include "ui/display/screen.h" | 57 #include "ui/display/screen.h" |
| 57 #include "ui/gl/gl_switches.h" | 58 #include "ui/gl/gl_switches.h" |
| 58 | 59 |
| 59 #if defined(ENABLE_MOJO_MEDIA_IN_BROWSER_PROCESS) | 60 #if defined(ENABLE_MOJO_MEDIA_IN_BROWSER_PROCESS) |
| 60 #include "chromecast/browser/media/cast_mojo_media_client.h" | 61 #include "chromecast/browser/media/cast_mojo_media_client.h" |
| 61 #include "media/mojo/services/mojo_media_application.h" // nogncheck | 62 #include "media/mojo/services/mojo_media_application.h" // nogncheck |
| 62 #endif // ENABLE_MOJO_MEDIA_IN_BROWSER_PROCESS | 63 #endif // ENABLE_MOJO_MEDIA_IN_BROWSER_PROCESS |
| 63 | 64 |
| 64 #if defined(OS_ANDROID) | 65 #if defined(OS_ANDROID) |
| (...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 202 base::Bind(&CastContentBrowserClient::CreateMediaPipelineBackend, | 203 base::Bind(&CastContentBrowserClient::CreateMediaPipelineBackend, |
| 203 base::Unretained(this)), | 204 base::Unretained(this)), |
| 204 GetMediaTaskRunner(), media_resource_tracker())); | 205 GetMediaTaskRunner(), media_resource_tracker())); |
| 205 host->AddFilter(cma_message_filter.get()); | 206 host->AddFilter(cma_message_filter.get()); |
| 206 #endif // !defined(OS_ANDROID) | 207 #endif // !defined(OS_ANDROID) |
| 207 | 208 |
| 208 // Forcibly trigger I/O-thread URLRequestContext initialization before | 209 // Forcibly trigger I/O-thread URLRequestContext initialization before |
| 209 // getting HostResolver. | 210 // getting HostResolver. |
| 210 content::BrowserThread::PostTaskAndReplyWithResult( | 211 content::BrowserThread::PostTaskAndReplyWithResult( |
| 211 content::BrowserThread::IO, FROM_HERE, | 212 content::BrowserThread::IO, FROM_HERE, |
| 212 base::Bind(&net::URLRequestContextGetter::GetURLRequestContext, | 213 base::Bind( |
| 213 base::Unretained( | 214 &net::URLRequestContextGetter::GetURLRequestContext, |
| 214 url_request_context_factory_->GetSystemGetter())), | 215 base::Unretained(url_request_context_factory_->GetSystemGetter())), |
| 215 base::Bind(&CastContentBrowserClient::AddNetworkHintsMessageFilter, | 216 base::Bind(&CastContentBrowserClient::AddNetworkHintsImpl, |
| 216 base::Unretained(this), host->GetID())); | 217 base::Unretained(this), host->GetID())); |
| 217 } | 218 } |
| 218 | 219 |
| 219 void CastContentBrowserClient::AddNetworkHintsMessageFilter( | 220 void CastContentBrowserClient::AddNetworkHintsImpl( |
| 220 int render_process_id, net::URLRequestContext* context) { | 221 int render_process_id, |
| 222 net::URLRequestContext* context) { | |
| 221 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); | 223 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); |
| 222 | 224 |
| 223 content::RenderProcessHost* host = | 225 content::RenderProcessHost* host = |
| 224 content::RenderProcessHost::FromID(render_process_id); | 226 content::RenderProcessHost::FromID(render_process_id); |
| 225 if (!host) | 227 if (!host) |
| 226 return; | 228 return; |
| 227 | 229 |
| 228 scoped_refptr<content::BrowserMessageFilter> network_hints_message_filter( | 230 network_hints_.reset(new network_hints::NetworkHintsImpl( |
| 229 new network_hints::NetworkHintsMessageFilter( | 231 url_request_context_factory_->host_resolver())); |
| 230 url_request_context_factory_->host_resolver())); | 232 host->GetInterfaceRegistry()->AddInterface( |
| 231 host->AddFilter(network_hints_message_filter.get()); | 233 base::Bind(&network_hints::NetworkHintsImpl::Bind, |
| 234 base::Unretained(network_hints_.get())), | |
|
dcheng
2016/07/20 13:59:50
This needs to describe why unretained is safe; bet
tibell
2016/07/21 00:12:07
Added a comment.
I don't think we're going to get
dcheng
2016/07/21 02:43:13
Long-term, I think it's still a direction we shoul
tibell
2016/07/21 05:09:45
I think it might be the right direction as well. S
| |
| 235 content::BrowserThread::GetTaskRunnerForThread( | |
| 236 content::BrowserThread::IO)); | |
| 232 } | 237 } |
| 233 | 238 |
| 234 bool CastContentBrowserClient::IsHandledURL(const GURL& url) { | 239 bool CastContentBrowserClient::IsHandledURL(const GURL& url) { |
| 235 if (!url.is_valid()) | 240 if (!url.is_valid()) |
| 236 return false; | 241 return false; |
| 237 | 242 |
| 238 static const char* const kProtocolList[] = { | 243 static const char* const kProtocolList[] = { |
| 239 content::kChromeUIScheme, | 244 content::kChromeUIScheme, |
| 240 content::kChromeDevToolsScheme, | 245 content::kChromeDevToolsScheme, |
| 241 kChromeResourceScheme, | 246 kChromeResourceScheme, |
| (...skipping 312 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 554 process_type, dumps_path, false /* upload */); | 559 process_type, dumps_path, false /* upload */); |
| 555 // StartUploaderThread() even though upload is diferred. | 560 // StartUploaderThread() even though upload is diferred. |
| 556 // Breakpad-related memory is freed in the uploader thread. | 561 // Breakpad-related memory is freed in the uploader thread. |
| 557 crash_handler->StartUploaderThread(); | 562 crash_handler->StartUploaderThread(); |
| 558 return crash_handler; | 563 return crash_handler; |
| 559 } | 564 } |
| 560 #endif // !defined(OS_ANDROID) | 565 #endif // !defined(OS_ANDROID) |
| 561 | 566 |
| 562 } // namespace shell | 567 } // namespace shell |
| 563 } // namespace chromecast | 568 } // namespace chromecast |
| OLD | NEW |