| 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 "base/strings/utf_string_conversions.h" | 14 #include "base/strings/utf_string_conversions.h" |
| 15 #include "chromecast/base/cast_paths.h" | 15 #include "chromecast/base/cast_paths.h" |
| 16 #include "chromecast/base/chromecast_switches.h" | 16 #include "chromecast/base/chromecast_switches.h" |
| 17 #include "chromecast/browser/cast_browser_context.h" | 17 #include "chromecast/browser/cast_browser_context.h" |
| 18 #include "chromecast/browser/cast_browser_main_parts.h" | 18 #include "chromecast/browser/cast_browser_main_parts.h" |
| 19 #include "chromecast/browser/cast_browser_process.h" | 19 #include "chromecast/browser/cast_browser_process.h" |
| 20 #include "chromecast/browser/cast_network_delegate.h" | 20 #include "chromecast/browser/cast_network_delegate.h" |
| 21 #include "chromecast/browser/cast_quota_permission_context.h" | 21 #include "chromecast/browser/cast_quota_permission_context.h" |
| 22 #include "chromecast/browser/cast_resource_dispatcher_host_delegate.h" | 22 #include "chromecast/browser/cast_resource_dispatcher_host_delegate.h" |
| 23 #include "chromecast/browser/geolocation/cast_access_token_store.h" | 23 #include "chromecast/browser/geolocation/cast_access_token_store.h" |
| 24 #include "chromecast/browser/media/cma_message_filter_host.h" | 24 #include "chromecast/browser/media/cma_message_filter_host.h" |
| 25 #include "chromecast/browser/service/cast_service_simple.h" |
| 25 #include "chromecast/browser/url_request_context_factory.h" | 26 #include "chromecast/browser/url_request_context_factory.h" |
| 26 #include "chromecast/common/global_descriptors.h" | 27 #include "chromecast/common/global_descriptors.h" |
| 27 #include "chromecast/media/base/media_message_loop.h" | 28 #include "chromecast/media/base/media_message_loop.h" |
| 28 #include "chromecast/public/cast_media_shlib.h" | 29 #include "chromecast/public/cast_media_shlib.h" |
| 29 #include "chromecast/public/media/media_pipeline_backend.h" | 30 #include "chromecast/public/media/media_pipeline_backend.h" |
| 30 #include "components/crash/app/breakpad_linux.h" | 31 #include "components/crash/app/breakpad_linux.h" |
| 31 #include "components/crash/browser/crash_handler_host_linux.h" | 32 #include "components/crash/browser/crash_handler_host_linux.h" |
| 32 #include "components/network_hints/browser/network_hints_message_filter.h" | 33 #include "components/network_hints/browser/network_hints_message_filter.h" |
| 33 #include "content/public/browser/browser_thread.h" | 34 #include "content/public/browser/browser_thread.h" |
| 34 #include "content/public/browser/certificate_request_result_type.h" | 35 #include "content/public/browser/certificate_request_result_type.h" |
| (...skipping 26 matching lines...) Expand all Loading... |
| 61 content::BrowserThread::DeleteSoon( | 62 content::BrowserThread::DeleteSoon( |
| 62 content::BrowserThread::IO, | 63 content::BrowserThread::IO, |
| 63 FROM_HERE, | 64 FROM_HERE, |
| 64 url_request_context_factory_.release()); | 65 url_request_context_factory_.release()); |
| 65 } | 66 } |
| 66 | 67 |
| 67 void CastContentBrowserClient::AppendExtraCommandLineSwitches( | 68 void CastContentBrowserClient::AppendExtraCommandLineSwitches( |
| 68 base::CommandLine* command_line) { | 69 base::CommandLine* command_line) { |
| 69 } | 70 } |
| 70 | 71 |
| 71 std::vector<scoped_refptr<content::BrowserMessageFilter>> | 72 scoped_ptr<CastService> CastContentBrowserClient::CreateCastService( |
| 72 CastContentBrowserClient::GetBrowserMessageFilters() { | 73 content::BrowserContext* browser_context, |
| 73 return std::vector<scoped_refptr<content::BrowserMessageFilter>>(); | 74 PrefService* pref_service, |
| 75 net::URLRequestContextGetter* request_context_getter) { |
| 76 return make_scoped_ptr(new CastServiceSimple(browser_context, pref_service)); |
| 74 } | 77 } |
| 75 | 78 |
| 76 scoped_ptr<::media::AudioManagerFactory> | 79 scoped_ptr<::media::AudioManagerFactory> |
| 77 CastContentBrowserClient::CreateAudioManagerFactory() { | 80 CastContentBrowserClient::CreateAudioManagerFactory() { |
| 78 // Return nullptr. The factory will not be set, and the statically linked | 81 // Return nullptr. The factory will not be set, and the statically linked |
| 79 // implementation of AudioManager will be used. | 82 // implementation of AudioManager will be used. |
| 80 return scoped_ptr<::media::AudioManagerFactory>(); | 83 return scoped_ptr<::media::AudioManagerFactory>(); |
| 81 } | 84 } |
| 82 | 85 |
| 83 #if !defined(OS_ANDROID) | 86 #if !defined(OS_ANDROID) |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 126 | 129 |
| 127 // Forcibly trigger I/O-thread URLRequestContext initialization before | 130 // Forcibly trigger I/O-thread URLRequestContext initialization before |
| 128 // getting HostResolver. | 131 // getting HostResolver. |
| 129 content::BrowserThread::PostTaskAndReplyWithResult( | 132 content::BrowserThread::PostTaskAndReplyWithResult( |
| 130 content::BrowserThread::IO, FROM_HERE, | 133 content::BrowserThread::IO, FROM_HERE, |
| 131 base::Bind(&net::URLRequestContextGetter::GetURLRequestContext, | 134 base::Bind(&net::URLRequestContextGetter::GetURLRequestContext, |
| 132 base::Unretained( | 135 base::Unretained( |
| 133 url_request_context_factory_->GetSystemGetter())), | 136 url_request_context_factory_->GetSystemGetter())), |
| 134 base::Bind(&CastContentBrowserClient::AddNetworkHintsMessageFilter, | 137 base::Bind(&CastContentBrowserClient::AddNetworkHintsMessageFilter, |
| 135 base::Unretained(this), host->GetID())); | 138 base::Unretained(this), host->GetID())); |
| 136 | |
| 137 auto extra_filters = GetBrowserMessageFilters(); | |
| 138 for (auto const& filter : extra_filters) { | |
| 139 host->AddFilter(filter.get()); | |
| 140 } | |
| 141 } | 139 } |
| 142 | 140 |
| 143 void CastContentBrowserClient::AddNetworkHintsMessageFilter( | 141 void CastContentBrowserClient::AddNetworkHintsMessageFilter( |
| 144 int render_process_id, net::URLRequestContext* context) { | 142 int render_process_id, net::URLRequestContext* context) { |
| 145 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); | 143 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); |
| 146 | 144 |
| 147 content::RenderProcessHost* host = | 145 content::RenderProcessHost* host = |
| 148 content::RenderProcessHost::FromID(render_process_id); | 146 content::RenderProcessHost::FromID(render_process_id); |
| 149 if (!host) | 147 if (!host) |
| 150 return; | 148 return; |
| (...skipping 289 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 440 process_type, dumps_path, false /* upload */); | 438 process_type, dumps_path, false /* upload */); |
| 441 // StartUploaderThread() even though upload is diferred. | 439 // StartUploaderThread() even though upload is diferred. |
| 442 // Breakpad-related memory is freed in the uploader thread. | 440 // Breakpad-related memory is freed in the uploader thread. |
| 443 crash_handler->StartUploaderThread(); | 441 crash_handler->StartUploaderThread(); |
| 444 return crash_handler; | 442 return crash_handler; |
| 445 } | 443 } |
| 446 #endif // !defined(OS_ANDROID) | 444 #endif // !defined(OS_ANDROID) |
| 447 | 445 |
| 448 } // namespace shell | 446 } // namespace shell |
| 449 } // namespace chromecast | 447 } // namespace chromecast |
| OLD | NEW |