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/browser/cast_browser_context.h" | 14 #include "chromecast/browser/cast_browser_context.h" |
15 #include "chromecast/browser/cast_browser_main_parts.h" | 15 #include "chromecast/browser/cast_browser_main_parts.h" |
16 #include "chromecast/browser/cast_browser_process.h" | 16 #include "chromecast/browser/cast_browser_process.h" |
17 #include "chromecast/browser/cast_network_delegate.h" | 17 #include "chromecast/browser/cast_network_delegate.h" |
| 18 #include "chromecast/browser/cast_resource_dispatcher_host_delegate.h" |
18 #include "chromecast/browser/devtools/cast_dev_tools_delegate.h" | 19 #include "chromecast/browser/devtools/cast_dev_tools_delegate.h" |
19 #include "chromecast/browser/geolocation/cast_access_token_store.h" | 20 #include "chromecast/browser/geolocation/cast_access_token_store.h" |
20 #include "chromecast/browser/media/cma_message_filter_host.h" | 21 #include "chromecast/browser/media/cma_message_filter_host.h" |
21 #include "chromecast/browser/url_request_context_factory.h" | 22 #include "chromecast/browser/url_request_context_factory.h" |
22 #include "chromecast/common/cast_paths.h" | 23 #include "chromecast/common/cast_paths.h" |
23 #include "chromecast/common/chromecast_switches.h" | 24 #include "chromecast/common/chromecast_switches.h" |
24 #include "chromecast/common/global_descriptors.h" | 25 #include "chromecast/common/global_descriptors.h" |
25 #include "components/crash/app/breakpad_linux.h" | 26 #include "components/crash/app/breakpad_linux.h" |
26 #include "components/crash/browser/crash_handler_host_linux.h" | 27 #include "components/crash/browser/crash_handler_host_linux.h" |
27 #include "components/network_hints/browser/network_hints_message_filter.h" | 28 #include "components/network_hints/browser/network_hints_message_filter.h" |
28 #include "content/public/browser/browser_thread.h" | 29 #include "content/public/browser/browser_thread.h" |
29 #include "content/public/browser/certificate_request_result_type.h" | 30 #include "content/public/browser/certificate_request_result_type.h" |
30 #include "content/public/browser/render_process_host.h" | 31 #include "content/public/browser/render_process_host.h" |
| 32 #include "content/public/browser/resource_dispatcher_host.h" |
31 #include "content/public/common/content_descriptors.h" | 33 #include "content/public/common/content_descriptors.h" |
32 #include "content/public/common/content_switches.h" | 34 #include "content/public/common/content_switches.h" |
33 #include "content/public/common/url_constants.h" | 35 #include "content/public/common/url_constants.h" |
34 #include "content/public/common/web_preferences.h" | 36 #include "content/public/common/web_preferences.h" |
35 #include "net/ssl/ssl_cert_request_info.h" | 37 #include "net/ssl/ssl_cert_request_info.h" |
36 | 38 |
37 #if defined(OS_ANDROID) | 39 #if defined(OS_ANDROID) |
38 #include "chromecast/browser/android/external_video_surface_container_impl.h" | 40 #include "chromecast/browser/android/external_video_surface_container_impl.h" |
39 #endif // defined(OS_ANDROID) | 41 #endif // defined(OS_ANDROID) |
40 | 42 |
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
153 content::RenderViewHost* render_view_host, | 155 content::RenderViewHost* render_view_host, |
154 content::WebPreferences* prefs) { | 156 content::WebPreferences* prefs) { |
155 prefs->allow_scripts_to_close_windows = true; | 157 prefs->allow_scripts_to_close_windows = true; |
156 // TODO(lcwu): http://crbug.com/391089. This pref is set to true by default | 158 // TODO(lcwu): http://crbug.com/391089. This pref is set to true by default |
157 // because some content providers such as YouTube use plain http requests | 159 // because some content providers such as YouTube use plain http requests |
158 // to retrieve media data chunks while running in a https page. This pref | 160 // to retrieve media data chunks while running in a https page. This pref |
159 // should be disabled once all the content providers are no longer doing that. | 161 // should be disabled once all the content providers are no longer doing that. |
160 prefs->allow_running_insecure_content = true; | 162 prefs->allow_running_insecure_content = true; |
161 } | 163 } |
162 | 164 |
| 165 void CastContentBrowserClient::ResourceDispatcherHostCreated() { |
| 166 CastBrowserProcess::GetInstance()->SetResourceDispatcherHostDelegate( |
| 167 make_scoped_ptr(new CastResourceDispatcherHostDelegate)); |
| 168 content::ResourceDispatcherHost::Get()->SetDelegate( |
| 169 CastBrowserProcess::GetInstance()->resource_dispatcher_host_delegate()); |
| 170 } |
| 171 |
163 std::string CastContentBrowserClient::GetApplicationLocale() { | 172 std::string CastContentBrowserClient::GetApplicationLocale() { |
164 const std::string locale(base::i18n::GetConfiguredLocale()); | 173 const std::string locale(base::i18n::GetConfiguredLocale()); |
165 return locale.empty() ? "en-US" : locale; | 174 return locale.empty() ? "en-US" : locale; |
166 } | 175 } |
167 | 176 |
168 void CastContentBrowserClient::AllowCertificateError( | 177 void CastContentBrowserClient::AllowCertificateError( |
169 int render_process_id, | 178 int render_process_id, |
170 int render_view_id, | 179 int render_view_id, |
171 int cert_error, | 180 int cert_error, |
172 const net::SSLInfo& ssl_info, | 181 const net::SSLInfo& ssl_info, |
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
338 process_type, dumps_path, false /* upload */); | 347 process_type, dumps_path, false /* upload */); |
339 // StartUploaderThread() even though upload is diferred. | 348 // StartUploaderThread() even though upload is diferred. |
340 // Breakpad-related memory is freed in the uploader thread. | 349 // Breakpad-related memory is freed in the uploader thread. |
341 crash_handler->StartUploaderThread(); | 350 crash_handler->StartUploaderThread(); |
342 return crash_handler; | 351 return crash_handler; |
343 } | 352 } |
344 #endif // !defined(OS_ANDROID) | 353 #endif // !defined(OS_ANDROID) |
345 | 354 |
346 } // namespace shell | 355 } // namespace shell |
347 } // namespace chromecast | 356 } // namespace chromecast |
OLD | NEW |