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" |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
58 url_request_context_factory_(new URLRequestContextFactory()) { | 58 url_request_context_factory_(new URLRequestContextFactory()) { |
59 } | 59 } |
60 | 60 |
61 CastContentBrowserClient::~CastContentBrowserClient() { | 61 CastContentBrowserClient::~CastContentBrowserClient() { |
62 content::BrowserThread::DeleteSoon( | 62 content::BrowserThread::DeleteSoon( |
63 content::BrowserThread::IO, | 63 content::BrowserThread::IO, |
64 FROM_HERE, | 64 FROM_HERE, |
65 url_request_context_factory_.release()); | 65 url_request_context_factory_.release()); |
66 } | 66 } |
67 | 67 |
| 68 void CastContentBrowserClient::AppendExtraCommandLineSwitches( |
| 69 base::CommandLine* command_line) { |
| 70 } |
| 71 |
| 72 std::vector<scoped_refptr<content::BrowserMessageFilter>> |
| 73 CastContentBrowserClient::GetBrowserMessageFilters() { |
| 74 return std::vector<scoped_refptr<content::BrowserMessageFilter>>(); |
| 75 } |
| 76 |
| 77 scoped_ptr<::media::AudioManagerFactory> |
| 78 CastContentBrowserClient::CreateAudioManagerFactory() { |
| 79 // Return nullptr. The factory will not be set, and the statically linked |
| 80 // implementation of AudioManager will be used. |
| 81 return scoped_ptr<::media::AudioManagerFactory>(); |
| 82 } |
| 83 |
| 84 #if !defined(OS_ANDROID) |
| 85 scoped_ptr<media::MediaPipelineDevice> |
| 86 CastContentBrowserClient::CreateMediaPipelineDevice( |
| 87 const media::MediaPipelineDeviceParams& params) { |
| 88 return media::CreateMediaPipelineDevice(params); |
| 89 } |
| 90 #endif |
| 91 |
68 content::BrowserMainParts* CastContentBrowserClient::CreateBrowserMainParts( | 92 content::BrowserMainParts* CastContentBrowserClient::CreateBrowserMainParts( |
69 const content::MainFunctionParams& parameters) { | 93 const content::MainFunctionParams& parameters) { |
70 return new CastBrowserMainParts(parameters, | 94 return new CastBrowserMainParts(parameters, |
71 url_request_context_factory_.get(), | 95 url_request_context_factory_.get(), |
72 PlatformCreateAudioManagerFactory()); | 96 CreateAudioManagerFactory()); |
73 } | 97 } |
74 | 98 |
75 void CastContentBrowserClient::RenderProcessWillLaunch( | 99 void CastContentBrowserClient::RenderProcessWillLaunch( |
76 content::RenderProcessHost* host) { | 100 content::RenderProcessHost* host) { |
77 #if !defined(OS_ANDROID) | 101 #if !defined(OS_ANDROID) |
78 scoped_refptr<media::CmaMessageFilterHost> cma_message_filter( | 102 scoped_refptr<media::CmaMessageFilterHost> cma_message_filter( |
79 new media::CmaMessageFilterHost( | 103 new media::CmaMessageFilterHost( |
80 host->GetID(), | 104 host->GetID(), |
81 base::Bind( | 105 base::Bind( |
82 &CastContentBrowserClient::PlatformCreateMediaPipelineDevice, | 106 &CastContentBrowserClient::CreateMediaPipelineDevice, |
83 base::Unretained(this)))); | 107 base::Unretained(this)))); |
84 host->AddFilter(cma_message_filter.get()); | 108 host->AddFilter(cma_message_filter.get()); |
85 #endif // !defined(OS_ANDROID) | 109 #endif // !defined(OS_ANDROID) |
86 | 110 |
87 // Forcibly trigger I/O-thread URLRequestContext initialization before | 111 // Forcibly trigger I/O-thread URLRequestContext initialization before |
88 // getting HostResolver. | 112 // getting HostResolver. |
89 content::BrowserThread::PostTaskAndReplyWithResult( | 113 content::BrowserThread::PostTaskAndReplyWithResult( |
90 content::BrowserThread::IO, FROM_HERE, | 114 content::BrowserThread::IO, FROM_HERE, |
91 base::Bind(&net::URLRequestContextGetter::GetURLRequestContext, | 115 base::Bind(&net::URLRequestContextGetter::GetURLRequestContext, |
92 base::Unretained( | 116 base::Unretained( |
93 url_request_context_factory_->GetSystemGetter())), | 117 url_request_context_factory_->GetSystemGetter())), |
94 base::Bind(&CastContentBrowserClient::AddNetworkHintsMessageFilter, | 118 base::Bind(&CastContentBrowserClient::AddNetworkHintsMessageFilter, |
95 base::Unretained(this), host->GetID())); | 119 base::Unretained(this), host->GetID())); |
96 | 120 |
97 auto extra_filters = PlatformGetBrowserMessageFilters(); | 121 auto extra_filters = GetBrowserMessageFilters(); |
98 for (auto const& filter : extra_filters) { | 122 for (auto const& filter : extra_filters) { |
99 host->AddFilter(filter.get()); | 123 host->AddFilter(filter.get()); |
100 } | 124 } |
101 } | 125 } |
102 | 126 |
103 void CastContentBrowserClient::AddNetworkHintsMessageFilter( | 127 void CastContentBrowserClient::AddNetworkHintsMessageFilter( |
104 int render_process_id, net::URLRequestContext* context) { | 128 int render_process_id, net::URLRequestContext* context) { |
105 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); | 129 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); |
106 | 130 |
107 content::RenderProcessHost* host = | 131 content::RenderProcessHost* host = |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
192 | 216 |
193 #if defined(OS_LINUX) | 217 #if defined(OS_LINUX) |
194 // Necessary for accelerated 2d canvas. By default on Linux, Chromium assumes | 218 // Necessary for accelerated 2d canvas. By default on Linux, Chromium assumes |
195 // GLES2 contexts can be lost to a power-save mode, which breaks GPU canvas | 219 // GLES2 contexts can be lost to a power-save mode, which breaks GPU canvas |
196 // apps. | 220 // apps. |
197 if (process_type == switches::kGpuProcess) { | 221 if (process_type == switches::kGpuProcess) { |
198 command_line->AppendSwitch(switches::kGpuNoContextLost); | 222 command_line->AppendSwitch(switches::kGpuNoContextLost); |
199 } | 223 } |
200 #endif | 224 #endif |
201 | 225 |
202 PlatformAppendExtraCommandLineSwitches(command_line); | 226 AppendExtraCommandLineSwitches(command_line); |
203 } | 227 } |
204 | 228 |
205 content::AccessTokenStore* CastContentBrowserClient::CreateAccessTokenStore() { | 229 content::AccessTokenStore* CastContentBrowserClient::CreateAccessTokenStore() { |
206 return new CastAccessTokenStore( | 230 return new CastAccessTokenStore( |
207 CastBrowserProcess::GetInstance()->browser_context()); | 231 CastBrowserProcess::GetInstance()->browser_context()); |
208 } | 232 } |
209 | 233 |
210 void CastContentBrowserClient::OverrideWebkitPrefs( | 234 void CastContentBrowserClient::OverrideWebkitPrefs( |
211 content::RenderViewHost* render_view_host, | 235 content::RenderViewHost* render_view_host, |
212 content::WebPreferences* prefs) { | 236 content::WebPreferences* prefs) { |
(...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
428 process_type, dumps_path, false /* upload */); | 452 process_type, dumps_path, false /* upload */); |
429 // StartUploaderThread() even though upload is diferred. | 453 // StartUploaderThread() even though upload is diferred. |
430 // Breakpad-related memory is freed in the uploader thread. | 454 // Breakpad-related memory is freed in the uploader thread. |
431 crash_handler->StartUploaderThread(); | 455 crash_handler->StartUploaderThread(); |
432 return crash_handler; | 456 return crash_handler; |
433 } | 457 } |
434 #endif // !defined(OS_ANDROID) | 458 #endif // !defined(OS_ANDROID) |
435 | 459 |
436 } // namespace shell | 460 } // namespace shell |
437 } // namespace chromecast | 461 } // namespace chromecast |
OLD | NEW |