| 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_media_pipeline_client.h" |
| 23 #include "chromecast/browser/media/cma_message_filter_host.h" | 24 #include "chromecast/browser/media/cma_message_filter_host.h" |
| 24 #include "chromecast/browser/url_request_context_factory.h" | 25 #include "chromecast/browser/url_request_context_factory.h" |
| 25 #include "chromecast/common/global_descriptors.h" | 26 #include "chromecast/common/global_descriptors.h" |
| 26 #include "chromecast/media/base/media_message_loop.h" | 27 #include "chromecast/media/base/media_message_loop.h" |
| 27 #include "chromecast/public/cast_media_shlib.h" | 28 #include "chromecast/public/cast_media_shlib.h" |
| 28 #include "chromecast/public/media/media_pipeline_backend.h" | 29 #include "chromecast/public/media/media_pipeline_backend.h" |
| 29 #include "components/crash/app/breakpad_linux.h" | 30 #include "components/crash/app/breakpad_linux.h" |
| 30 #include "components/crash/browser/crash_handler_host_linux.h" | 31 #include "components/crash/browser/crash_handler_host_linux.h" |
| 31 #include "components/network_hints/browser/network_hints_message_filter.h" | 32 #include "components/network_hints/browser/network_hints_message_filter.h" |
| 32 #include "content/public/browser/browser_thread.h" | 33 #include "content/public/browser/browser_thread.h" |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 73 } | 74 } |
| 74 | 75 |
| 75 scoped_ptr<::media::AudioManagerFactory> | 76 scoped_ptr<::media::AudioManagerFactory> |
| 76 CastContentBrowserClient::CreateAudioManagerFactory() { | 77 CastContentBrowserClient::CreateAudioManagerFactory() { |
| 77 // Return nullptr. The factory will not be set, and the statically linked | 78 // Return nullptr. The factory will not be set, and the statically linked |
| 78 // implementation of AudioManager will be used. | 79 // implementation of AudioManager will be used. |
| 79 return scoped_ptr<::media::AudioManagerFactory>(); | 80 return scoped_ptr<::media::AudioManagerFactory>(); |
| 80 } | 81 } |
| 81 | 82 |
| 82 #if !defined(OS_ANDROID) | 83 #if !defined(OS_ANDROID) |
| 83 scoped_ptr<media::MediaPipelineBackend> | 84 scoped_refptr<media::CmaMediaPipelineClient> |
| 84 CastContentBrowserClient::CreateMediaPipelineBackend( | 85 CastContentBrowserClient::CreateCmaMediaPipelineClient() { |
| 85 const media::MediaPipelineDeviceParams& params) { | 86 return make_scoped_refptr(new media::CmaMediaPipelineClient()); |
| 86 return make_scoped_ptr( | |
| 87 media::CastMediaShlib::CreateMediaPipelineBackend(params)); | |
| 88 } | 87 } |
| 89 #endif | 88 #endif |
| 90 | 89 |
| 91 void CastContentBrowserClient::ProcessExiting() { | 90 void CastContentBrowserClient::ProcessExiting() { |
| 92 // Finalize CastMediaShlib on media thread to ensure it's not accessed | 91 // Finalize CastMediaShlib on media thread to ensure it's not accessed |
| 93 // after Finalize. | 92 // after Finalize. |
| 94 media::MediaMessageLoop::GetTaskRunner()->PostTask( | 93 media::MediaMessageLoop::GetTaskRunner()->PostTask( |
| 95 FROM_HERE, base::Bind(&media::CastMediaShlib::Finalize)); | 94 FROM_HERE, base::Bind(&media::CastMediaShlib::Finalize)); |
| 96 } | 95 } |
| 97 | 96 |
| (...skipping 11 matching lines...) Expand all Loading... |
| 109 parameters, url_request_context_factory_.get(), | 108 parameters, url_request_context_factory_.get(), |
| 110 CreateAudioManagerFactory()); | 109 CreateAudioManagerFactory()); |
| 111 CastBrowserProcess::GetInstance()->SetCastContentBrowserClient(this); | 110 CastBrowserProcess::GetInstance()->SetCastContentBrowserClient(this); |
| 112 return parts; | 111 return parts; |
| 113 } | 112 } |
| 114 | 113 |
| 115 void CastContentBrowserClient::RenderProcessWillLaunch( | 114 void CastContentBrowserClient::RenderProcessWillLaunch( |
| 116 content::RenderProcessHost* host) { | 115 content::RenderProcessHost* host) { |
| 117 #if !defined(OS_ANDROID) | 116 #if !defined(OS_ANDROID) |
| 118 scoped_refptr<media::CmaMessageFilterHost> cma_message_filter( | 117 scoped_refptr<media::CmaMessageFilterHost> cma_message_filter( |
| 119 new media::CmaMessageFilterHost( | 118 new media::CmaMessageFilterHost(host->GetID(), |
| 120 host->GetID(), | 119 CreateCmaMediaPipelineClient())); |
| 121 base::Bind(&CastContentBrowserClient::CreateMediaPipelineBackend, | |
| 122 base::Unretained(this)))); | |
| 123 host->AddFilter(cma_message_filter.get()); | 120 host->AddFilter(cma_message_filter.get()); |
| 124 #endif // !defined(OS_ANDROID) | 121 #endif // !defined(OS_ANDROID) |
| 125 | 122 |
| 126 // Forcibly trigger I/O-thread URLRequestContext initialization before | 123 // Forcibly trigger I/O-thread URLRequestContext initialization before |
| 127 // getting HostResolver. | 124 // getting HostResolver. |
| 128 content::BrowserThread::PostTaskAndReplyWithResult( | 125 content::BrowserThread::PostTaskAndReplyWithResult( |
| 129 content::BrowserThread::IO, FROM_HERE, | 126 content::BrowserThread::IO, FROM_HERE, |
| 130 base::Bind(&net::URLRequestContextGetter::GetURLRequestContext, | 127 base::Bind(&net::URLRequestContextGetter::GetURLRequestContext, |
| 131 base::Unretained( | 128 base::Unretained( |
| 132 url_request_context_factory_->GetSystemGetter())), | 129 url_request_context_factory_->GetSystemGetter())), |
| (...skipping 305 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 438 process_type, dumps_path, false /* upload */); | 435 process_type, dumps_path, false /* upload */); |
| 439 // StartUploaderThread() even though upload is diferred. | 436 // StartUploaderThread() even though upload is diferred. |
| 440 // Breakpad-related memory is freed in the uploader thread. | 437 // Breakpad-related memory is freed in the uploader thread. |
| 441 crash_handler->StartUploaderThread(); | 438 crash_handler->StartUploaderThread(); |
| 442 return crash_handler; | 439 return crash_handler; |
| 443 } | 440 } |
| 444 #endif // !defined(OS_ANDROID) | 441 #endif // !defined(OS_ANDROID) |
| 445 | 442 |
| 446 } // namespace shell | 443 } // namespace shell |
| 447 } // namespace chromecast | 444 } // namespace chromecast |
| OLD | NEW |