| 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 10 matching lines...) Expand all Loading... |
| 21 #include "build/build_config.h" | 21 #include "build/build_config.h" |
| 22 #include "chromecast/base/cast_constants.h" | 22 #include "chromecast/base/cast_constants.h" |
| 23 #include "chromecast/base/cast_paths.h" | 23 #include "chromecast/base/cast_paths.h" |
| 24 #include "chromecast/base/chromecast_switches.h" | 24 #include "chromecast/base/chromecast_switches.h" |
| 25 #include "chromecast/browser/cast_browser_context.h" | 25 #include "chromecast/browser/cast_browser_context.h" |
| 26 #include "chromecast/browser/cast_browser_main_parts.h" | 26 #include "chromecast/browser/cast_browser_main_parts.h" |
| 27 #include "chromecast/browser/cast_browser_process.h" | 27 #include "chromecast/browser/cast_browser_process.h" |
| 28 #include "chromecast/browser/cast_network_delegate.h" | 28 #include "chromecast/browser/cast_network_delegate.h" |
| 29 #include "chromecast/browser/cast_quota_permission_context.h" | 29 #include "chromecast/browser/cast_quota_permission_context.h" |
| 30 #include "chromecast/browser/cast_resource_dispatcher_host_delegate.h" | 30 #include "chromecast/browser/cast_resource_dispatcher_host_delegate.h" |
| 31 #include "chromecast/browser/geolocation/cast_access_token_store.h" | |
| 32 #include "chromecast/browser/media/cma_message_filter_host.h" | 31 #include "chromecast/browser/media/cma_message_filter_host.h" |
| 33 #include "chromecast/browser/service/cast_service_simple.h" | 32 #include "chromecast/browser/service/cast_service_simple.h" |
| 34 #include "chromecast/browser/url_request_context_factory.h" | 33 #include "chromecast/browser/url_request_context_factory.h" |
| 35 #include "chromecast/common/global_descriptors.h" | 34 #include "chromecast/common/global_descriptors.h" |
| 36 #include "chromecast/media/audio/cast_audio_manager.h" | 35 #include "chromecast/media/audio/cast_audio_manager.h" |
| 37 #include "chromecast/media/cma/backend/media_pipeline_backend_manager.h" | 36 #include "chromecast/media/cma/backend/media_pipeline_backend_manager.h" |
| 38 #include "chromecast/public/media/media_pipeline_backend.h" | 37 #include "chromecast/public/media/media_pipeline_backend.h" |
| 39 #include "components/crash/content/app/breakpad_linux.h" | 38 #include "components/crash/content/app/breakpad_linux.h" |
| 40 #include "components/crash/content/browser/crash_handler_host_linux.h" | 39 #include "components/crash/content/browser/crash_handler_host_linux.h" |
| 41 #include "components/network_hints/browser/network_hints_impl.h" | 40 #include "components/network_hints/browser/network_hints_impl.h" |
| 42 #include "content/public/browser/browser_thread.h" | 41 #include "content/public/browser/browser_thread.h" |
| 43 #include "content/public/browser/certificate_request_result_type.h" | 42 #include "content/public/browser/certificate_request_result_type.h" |
| 44 #include "content/public/browser/client_certificate_delegate.h" | 43 #include "content/public/browser/client_certificate_delegate.h" |
| 45 #include "content/public/browser/geolocation_delegate.h" | |
| 46 #include "content/public/browser/render_process_host.h" | 44 #include "content/public/browser/render_process_host.h" |
| 47 #include "content/public/browser/resource_dispatcher_host.h" | 45 #include "content/public/browser/resource_dispatcher_host.h" |
| 48 #include "content/public/browser/web_contents.h" | 46 #include "content/public/browser/web_contents.h" |
| 49 #include "content/public/common/content_descriptors.h" | 47 #include "content/public/common/content_descriptors.h" |
| 50 #include "content/public/common/content_switches.h" | 48 #include "content/public/common/content_switches.h" |
| 51 #include "content/public/common/url_constants.h" | 49 #include "content/public/common/url_constants.h" |
| 52 #include "content/public/common/web_preferences.h" | 50 #include "content/public/common/web_preferences.h" |
| 53 #include "net/ssl/ssl_cert_request_info.h" | 51 #include "net/ssl/ssl_cert_request_info.h" |
| 54 #include "net/url_request/url_request_context_getter.h" | 52 #include "net/url_request/url_request_context_getter.h" |
| 55 #include "services/shell/public/cpp/interface_registry.h" | 53 #include "services/shell/public/cpp/interface_registry.h" |
| (...skipping 26 matching lines...) Expand all Loading... |
| 82 base::Bind(&CastContentBrowserClient::CreateMediaPipelineBackend, | 80 base::Bind(&CastContentBrowserClient::CreateMediaPipelineBackend, |
| 83 base::Unretained(browser_client)), | 81 base::Unretained(browser_client)), |
| 84 base::Bind(&CastContentBrowserClient::CreateCdmFactory, | 82 base::Bind(&CastContentBrowserClient::CreateCdmFactory, |
| 85 base::Unretained(browser_client)))); | 83 base::Unretained(browser_client)))); |
| 86 return std::unique_ptr<::shell::Service>( | 84 return std::unique_ptr<::shell::Service>( |
| 87 new ::media::MojoMediaApplication(std::move(mojo_media_client), | 85 new ::media::MojoMediaApplication(std::move(mojo_media_client), |
| 88 quit_closure)); | 86 quit_closure)); |
| 89 } | 87 } |
| 90 #endif // defined(ENABLE_MOJO_MEDIA_IN_BROWSER_PROCESS) | 88 #endif // defined(ENABLE_MOJO_MEDIA_IN_BROWSER_PROCESS) |
| 91 | 89 |
| 92 // A provider of services for Geolocation. | |
| 93 class CastGeolocationDelegate : public content::GeolocationDelegate { | |
| 94 public: | |
| 95 explicit CastGeolocationDelegate(CastBrowserContext* context) | |
| 96 : context_(context) {} | |
| 97 | |
| 98 scoped_refptr<content::AccessTokenStore> CreateAccessTokenStore() override { | |
| 99 return new CastAccessTokenStore(context_); | |
| 100 } | |
| 101 | |
| 102 private: | |
| 103 CastBrowserContext* context_; | |
| 104 | |
| 105 DISALLOW_COPY_AND_ASSIGN(CastGeolocationDelegate); | |
| 106 }; | |
| 107 | |
| 108 } // namespace | 90 } // namespace |
| 109 | 91 |
| 110 CastContentBrowserClient::CastContentBrowserClient() | 92 CastContentBrowserClient::CastContentBrowserClient() |
| 111 : cast_browser_main_parts_(nullptr), | 93 : cast_browser_main_parts_(nullptr), |
| 112 url_request_context_factory_(new URLRequestContextFactory()) {} | 94 url_request_context_factory_(new URLRequestContextFactory()) {} |
| 113 | 95 |
| 114 CastContentBrowserClient::~CastContentBrowserClient() { | 96 CastContentBrowserClient::~CastContentBrowserClient() { |
| 115 content::BrowserThread::DeleteSoon( | 97 content::BrowserThread::DeleteSoon( |
| 116 content::BrowserThread::IO, | 98 content::BrowserThread::IO, |
| 117 FROM_HERE, | 99 FROM_HERE, |
| (...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 296 // GLES2 contexts can be lost to a power-save mode, which breaks GPU canvas | 278 // GLES2 contexts can be lost to a power-save mode, which breaks GPU canvas |
| 297 // apps. | 279 // apps. |
| 298 if (process_type == switches::kGpuProcess) { | 280 if (process_type == switches::kGpuProcess) { |
| 299 command_line->AppendSwitch(switches::kGpuNoContextLost); | 281 command_line->AppendSwitch(switches::kGpuNoContextLost); |
| 300 } | 282 } |
| 301 #endif | 283 #endif |
| 302 | 284 |
| 303 AppendExtraCommandLineSwitches(command_line); | 285 AppendExtraCommandLineSwitches(command_line); |
| 304 } | 286 } |
| 305 | 287 |
| 306 content::GeolocationDelegate* | |
| 307 CastContentBrowserClient::CreateGeolocationDelegate() { | |
| 308 return new CastGeolocationDelegate( | |
| 309 CastBrowserProcess::GetInstance()->browser_context()); | |
| 310 } | |
| 311 | |
| 312 void CastContentBrowserClient::OverrideWebkitPrefs( | 288 void CastContentBrowserClient::OverrideWebkitPrefs( |
| 313 content::RenderViewHost* render_view_host, | 289 content::RenderViewHost* render_view_host, |
| 314 content::WebPreferences* prefs) { | 290 content::WebPreferences* prefs) { |
| 315 prefs->allow_scripts_to_close_windows = true; | 291 prefs->allow_scripts_to_close_windows = true; |
| 316 // TODO(lcwu): http://crbug.com/391089. This pref is set to true by default | 292 // TODO(lcwu): http://crbug.com/391089. This pref is set to true by default |
| 317 // because some content providers such as YouTube use plain http requests | 293 // because some content providers such as YouTube use plain http requests |
| 318 // to retrieve media data chunks while running in a https page. This pref | 294 // to retrieve media data chunks while running in a https page. This pref |
| 319 // should be disabled once all the content providers are no longer doing that. | 295 // should be disabled once all the content providers are no longer doing that. |
| 320 prefs->allow_running_insecure_content = true; | 296 prefs->allow_running_insecure_content = true; |
| 321 | 297 |
| (...skipping 239 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 561 process_type, dumps_path, false /* upload */); | 537 process_type, dumps_path, false /* upload */); |
| 562 // StartUploaderThread() even though upload is diferred. | 538 // StartUploaderThread() even though upload is diferred. |
| 563 // Breakpad-related memory is freed in the uploader thread. | 539 // Breakpad-related memory is freed in the uploader thread. |
| 564 crash_handler->StartUploaderThread(); | 540 crash_handler->StartUploaderThread(); |
| 565 return crash_handler; | 541 return crash_handler; |
| 566 } | 542 } |
| 567 #endif // !defined(OS_ANDROID) | 543 #endif // !defined(OS_ANDROID) |
| 568 | 544 |
| 569 } // namespace shell | 545 } // namespace shell |
| 570 } // namespace chromecast | 546 } // namespace chromecast |
| OLD | NEW |