| 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_browser_main_parts.h" | 5 #include "chromecast/browser/cast_browser_main_parts.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 #include <string.h> | 8 #include <string.h> |
| 9 | 9 |
| 10 #include <string> | 10 #include <string> |
| (...skipping 14 matching lines...) Expand all Loading... |
| 25 #include "chromecast/base/cast_sys_info_util.h" | 25 #include "chromecast/base/cast_sys_info_util.h" |
| 26 #include "chromecast/base/chromecast_switches.h" | 26 #include "chromecast/base/chromecast_switches.h" |
| 27 #include "chromecast/base/metrics/cast_metrics_helper.h" | 27 #include "chromecast/base/metrics/cast_metrics_helper.h" |
| 28 #include "chromecast/base/metrics/grouped_histogram.h" | 28 #include "chromecast/base/metrics/grouped_histogram.h" |
| 29 #include "chromecast/browser/cast_browser_context.h" | 29 #include "chromecast/browser/cast_browser_context.h" |
| 30 #include "chromecast/browser/cast_browser_process.h" | 30 #include "chromecast/browser/cast_browser_process.h" |
| 31 #include "chromecast/browser/cast_content_browser_client.h" | 31 #include "chromecast/browser/cast_content_browser_client.h" |
| 32 #include "chromecast/browser/cast_memory_pressure_monitor.h" | 32 #include "chromecast/browser/cast_memory_pressure_monitor.h" |
| 33 #include "chromecast/browser/cast_net_log.h" | 33 #include "chromecast/browser/cast_net_log.h" |
| 34 #include "chromecast/browser/devtools/remote_debugging_server.h" | 34 #include "chromecast/browser/devtools/remote_debugging_server.h" |
| 35 #include "chromecast/browser/geolocation/cast_access_token_store.h" |
| 35 #include "chromecast/browser/metrics/cast_metrics_prefs.h" | 36 #include "chromecast/browser/metrics/cast_metrics_prefs.h" |
| 36 #include "chromecast/browser/metrics/cast_metrics_service_client.h" | 37 #include "chromecast/browser/metrics/cast_metrics_service_client.h" |
| 37 #include "chromecast/browser/pref_service_helper.h" | 38 #include "chromecast/browser/pref_service_helper.h" |
| 38 #include "chromecast/browser/url_request_context_factory.h" | 39 #include "chromecast/browser/url_request_context_factory.h" |
| 39 #include "chromecast/chromecast_features.h" | 40 #include "chromecast/chromecast_features.h" |
| 40 #include "chromecast/common/platform_client_auth.h" | 41 #include "chromecast/common/platform_client_auth.h" |
| 41 #include "chromecast/media/base/key_systems_common.h" | 42 #include "chromecast/media/base/key_systems_common.h" |
| 42 #include "chromecast/media/base/media_resource_tracker.h" | 43 #include "chromecast/media/base/media_resource_tracker.h" |
| 43 #include "chromecast/media/base/video_plane_controller.h" | 44 #include "chromecast/media/base/video_plane_controller.h" |
| 44 #include "chromecast/media/cma/backend/media_pipeline_backend_manager.h" | 45 #include "chromecast/media/cma/backend/media_pipeline_backend_manager.h" |
| 45 #include "chromecast/net/connectivity_checker.h" | 46 #include "chromecast/net/connectivity_checker.h" |
| 46 #include "chromecast/public/cast_media_shlib.h" | 47 #include "chromecast/public/cast_media_shlib.h" |
| 47 #include "chromecast/public/cast_sys_info.h" | 48 #include "chromecast/public/cast_sys_info.h" |
| 48 #include "chromecast/service/cast_service.h" | 49 #include "chromecast/service/cast_service.h" |
| 49 #include "components/prefs/pref_registry_simple.h" | 50 #include "components/prefs/pref_registry_simple.h" |
| 50 #include "content/public/browser/browser_thread.h" | 51 #include "content/public/browser/browser_thread.h" |
| 51 #include "content/public/browser/child_process_security_policy.h" | 52 #include "content/public/browser/child_process_security_policy.h" |
| 53 #include "content/public/browser/geolocation_delegate.h" |
| 54 #include "content/public/browser/geolocation_provider.h" |
| 52 #include "content/public/browser/gpu_data_manager.h" | 55 #include "content/public/browser/gpu_data_manager.h" |
| 53 #include "content/public/browser/storage_partition.h" | 56 #include "content/public/browser/storage_partition.h" |
| 54 #include "content/public/common/content_switches.h" | 57 #include "content/public/common/content_switches.h" |
| 55 #include "gpu/command_buffer/service/gpu_switches.h" | 58 #include "gpu/command_buffer/service/gpu_switches.h" |
| 56 #include "media/base/media.h" | 59 #include "media/base/media.h" |
| 57 #include "ui/compositor/compositor_switches.h" | 60 #include "ui/compositor/compositor_switches.h" |
| 58 | 61 |
| 59 #if !defined(OS_ANDROID) | 62 #if !defined(OS_ANDROID) |
| 60 #include <signal.h> | 63 #include <signal.h> |
| 61 #include <sys/prctl.h> | 64 #include <sys/prctl.h> |
| (...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 177 | 180 |
| 178 #endif // !defined(OS_ANDROID) | 181 #endif // !defined(OS_ANDROID) |
| 179 | 182 |
| 180 } // namespace | 183 } // namespace |
| 181 | 184 |
| 182 namespace chromecast { | 185 namespace chromecast { |
| 183 namespace shell { | 186 namespace shell { |
| 184 | 187 |
| 185 namespace { | 188 namespace { |
| 186 | 189 |
| 190 // A provider of services for Geolocation. |
| 191 class CastGeolocationDelegate : public content::GeolocationDelegate { |
| 192 public: |
| 193 explicit CastGeolocationDelegate(CastBrowserContext* context) |
| 194 : context_(context) {} |
| 195 |
| 196 scoped_refptr<content::AccessTokenStore> CreateAccessTokenStore() override { |
| 197 return new CastAccessTokenStore(context_); |
| 198 } |
| 199 |
| 200 private: |
| 201 CastBrowserContext* context_; |
| 202 |
| 203 DISALLOW_COPY_AND_ASSIGN(CastGeolocationDelegate); |
| 204 }; |
| 205 |
| 187 struct DefaultCommandLineSwitch { | 206 struct DefaultCommandLineSwitch { |
| 188 const char* const switch_name; | 207 const char* const switch_name; |
| 189 const char* const switch_value; | 208 const char* const switch_value; |
| 190 }; | 209 }; |
| 191 | 210 |
| 192 DefaultCommandLineSwitch g_default_switches[] = { | 211 DefaultCommandLineSwitch g_default_switches[] = { |
| 193 #if defined(OS_ANDROID) | 212 #if defined(OS_ANDROID) |
| 194 // Disables Chromecast-specific WiFi-related features on ATV for now. | 213 // Disables Chromecast-specific WiFi-related features on ATV for now. |
| 195 { switches::kNoWifi, "" }, | 214 { switches::kNoWifi, "" }, |
| 196 { switches::kDisableGestureRequirementForMediaPlayback, ""}, | 215 { switches::kDisableGestureRequirementForMediaPlayback, ""}, |
| (...skipping 247 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 444 cast_browser_process_->pref_service(), | 463 cast_browser_process_->pref_service(), |
| 445 url_request_context_factory_->GetSystemGetter(), | 464 url_request_context_factory_->GetSystemGetter(), |
| 446 video_plane_controller_.get())); | 465 video_plane_controller_.get())); |
| 447 cast_browser_process_->cast_service()->Initialize(); | 466 cast_browser_process_->cast_service()->Initialize(); |
| 448 | 467 |
| 449 #if !defined(OS_ANDROID) | 468 #if !defined(OS_ANDROID) |
| 450 media_resource_tracker()->InitializeMediaLib(); | 469 media_resource_tracker()->InitializeMediaLib(); |
| 451 #endif | 470 #endif |
| 452 ::media::InitializeMediaLibrary(); | 471 ::media::InitializeMediaLibrary(); |
| 453 | 472 |
| 473 content::GeolocationProvider::SetGeolocationDelegate( |
| 474 new CastGeolocationDelegate(cast_browser_process_->browser_context())); |
| 475 |
| 454 // Initializing metrics service and network delegates must happen after cast | 476 // Initializing metrics service and network delegates must happen after cast |
| 455 // service is intialized because CastMetricsServiceClient and | 477 // service is intialized because CastMetricsServiceClient and |
| 456 // CastNetworkDelegate may use components initialized by cast service. | 478 // CastNetworkDelegate may use components initialized by cast service. |
| 457 cast_browser_process_->metrics_service_client() | 479 cast_browser_process_->metrics_service_client() |
| 458 ->Initialize(cast_browser_process_->cast_service()); | 480 ->Initialize(cast_browser_process_->cast_service()); |
| 459 url_request_context_factory_->InitializeNetworkDelegates(); | 481 url_request_context_factory_->InitializeNetworkDelegates(); |
| 460 | 482 |
| 461 cast_browser_process_->cast_service()->Start(); | 483 cast_browser_process_->cast_service()->Start(); |
| 462 } | 484 } |
| 463 | 485 |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 506 | 528 |
| 507 void CastBrowserMainParts::PostDestroyThreads() { | 529 void CastBrowserMainParts::PostDestroyThreads() { |
| 508 #if !defined(OS_ANDROID) | 530 #if !defined(OS_ANDROID) |
| 509 media_resource_tracker_->FinalizeAndDestroy(); | 531 media_resource_tracker_->FinalizeAndDestroy(); |
| 510 media_resource_tracker_ = nullptr; | 532 media_resource_tracker_ = nullptr; |
| 511 #endif | 533 #endif |
| 512 } | 534 } |
| 513 | 535 |
| 514 } // namespace shell | 536 } // namespace shell |
| 515 } // namespace chromecast | 537 } // namespace chromecast |
| OLD | NEW |