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 27 matching lines...) Expand all Loading... | |
38 #include "chromecast/browser/url_request_context_factory.h" | 38 #include "chromecast/browser/url_request_context_factory.h" |
39 #include "chromecast/chromecast_features.h" | 39 #include "chromecast/chromecast_features.h" |
40 #include "chromecast/common/platform_client_auth.h" | 40 #include "chromecast/common/platform_client_auth.h" |
41 #include "chromecast/media/base/key_systems_common.h" | 41 #include "chromecast/media/base/key_systems_common.h" |
42 #include "chromecast/media/base/media_resource_tracker.h" | 42 #include "chromecast/media/base/media_resource_tracker.h" |
43 #include "chromecast/media/base/video_plane_controller.h" | 43 #include "chromecast/media/base/video_plane_controller.h" |
44 #include "chromecast/media/cma/backend/media_pipeline_backend_manager.h" | 44 #include "chromecast/media/cma/backend/media_pipeline_backend_manager.h" |
45 #include "chromecast/net/connectivity_checker.h" | 45 #include "chromecast/net/connectivity_checker.h" |
46 #include "chromecast/public/cast_media_shlib.h" | 46 #include "chromecast/public/cast_media_shlib.h" |
47 #include "chromecast/public/cast_sys_info.h" | 47 #include "chromecast/public/cast_sys_info.h" |
48 #include "chromecast/public/graphics_properties_shlib.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" |
52 #include "content/public/browser/gpu_data_manager.h" | 53 #include "content/public/browser/gpu_data_manager.h" |
53 #include "content/public/browser/storage_partition.h" | 54 #include "content/public/browser/storage_partition.h" |
54 #include "content/public/common/content_switches.h" | 55 #include "content/public/common/content_switches.h" |
55 #include "gpu/command_buffer/service/gpu_switches.h" | 56 #include "gpu/command_buffer/service/gpu_switches.h" |
56 #include "media/base/media.h" | 57 #include "media/base/media.h" |
57 #include "ui/compositor/compositor_switches.h" | 58 #include "ui/compositor/compositor_switches.h" |
(...skipping 302 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
360 | 361 |
361 // Set GL strings so GPU config code can make correct feature blacklisting/ | 362 // Set GL strings so GPU config code can make correct feature blacklisting/ |
362 // whitelisting decisions. | 363 // whitelisting decisions. |
363 // Note: SetGLStrings can be called before GpuDataManager::Initialize. | 364 // Note: SetGLStrings can be called before GpuDataManager::Initialize. |
364 std::unique_ptr<CastSysInfo> sys_info = CreateSysInfo(); | 365 std::unique_ptr<CastSysInfo> sys_info = CreateSysInfo(); |
365 content::GpuDataManager::GetInstance()->SetGLStrings( | 366 content::GpuDataManager::GetInstance()->SetGLStrings( |
366 sys_info->GetGlVendor(), sys_info->GetGlRenderer(), | 367 sys_info->GetGlVendor(), sys_info->GetGlRenderer(), |
367 sys_info->GetGlVersion()); | 368 sys_info->GetGlVersion()); |
368 #endif | 369 #endif |
369 | 370 |
370 #if defined(USE_AURA) | 371 #if defined(USE_AURA) |
alokp
2016/05/12 21:35:16
nit: move the logic to determine display size into
halliwell
2016/05/13 23:48:03
Done (also moved it into CastScreen source file).
| |
371 // Screen can (and should) exist even with no displays connected. Its presence | 372 gfx::Size display_size(1280, 720); |
alokp
2016/05/12 21:35:16
nit: make this more explicit by defining a kDefaul
halliwell
2016/05/13 23:48:03
no need now it's in a helper.
| |
372 // is assumed as an interface to access display information, e.g. from metrics | 373 if (GraphicsPropertiesShlib::IsSupported( |
373 // code. See CastContentWindow::CreateWindowTree for update when resolution | 374 GraphicsPropertiesShlib::k1080p, |
374 // is available. | 375 base::CommandLine::ForCurrentProcess()->argv())) |
alokp
2016/05/12 21:35:16
nit: braces for multi-line if blocks
halliwell
2016/05/13 23:48:03
Done.
| |
375 cast_browser_process_->SetCastScreen(base::WrapUnique(new CastScreen)); | 376 display_size = gfx::Size(1920, 1080); |
377 | |
378 cast_browser_process_->SetCastScreen( | |
379 base::WrapUnique(new CastScreen(display_size))); | |
376 DCHECK(!display::Screen::GetScreen()); | 380 DCHECK(!display::Screen::GetScreen()); |
377 display::Screen::SetScreenInstance(cast_browser_process_->cast_screen()); | 381 display::Screen::SetScreenInstance(cast_browser_process_->cast_screen()); |
378 #endif | 382 #endif |
379 | 383 |
380 content::ChildProcessSecurityPolicy::GetInstance()->RegisterWebSafeScheme( | 384 content::ChildProcessSecurityPolicy::GetInstance()->RegisterWebSafeScheme( |
381 kChromeResourceScheme); | 385 kChromeResourceScheme); |
382 return 0; | 386 return 0; |
383 } | 387 } |
384 | 388 |
385 void CastBrowserMainParts::PreMainMessageLoopRun() { | 389 void CastBrowserMainParts::PreMainMessageLoopRun() { |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
417 LOG(ERROR) << "PlatformClientAuth::Initialize failed."; | 421 LOG(ERROR) << "PlatformClientAuth::Initialize failed."; |
418 | 422 |
419 cast_browser_process_->SetRemoteDebuggingServer(base::WrapUnique( | 423 cast_browser_process_->SetRemoteDebuggingServer(base::WrapUnique( |
420 new RemoteDebuggingServer(cast_browser_process_->browser_client() | 424 new RemoteDebuggingServer(cast_browser_process_->browser_client() |
421 ->EnableRemoteDebuggingImmediately()))); | 425 ->EnableRemoteDebuggingImmediately()))); |
422 | 426 |
423 #if defined(USE_AURA) && !BUILDFLAG(DISABLE_DISPLAY) | 427 #if defined(USE_AURA) && !BUILDFLAG(DISABLE_DISPLAY) |
424 // TODO(halliwell) move audio builds to use ozone_platform_cast, then can | 428 // TODO(halliwell) move audio builds to use ozone_platform_cast, then can |
425 // simplify this by removing DISABLE_DISPLAY condition. Should then also | 429 // simplify this by removing DISABLE_DISPLAY condition. Should then also |
426 // assert(ozone_platform_cast) in BUILD.gn where it depends on //ui/ozone. | 430 // assert(ozone_platform_cast) in BUILD.gn where it depends on //ui/ozone. |
427 video_plane_controller_.reset( | 431 gfx::Size display_size = |
428 new media::VideoPlaneController(GetMediaTaskRunner())); | 432 display::Screen::GetScreen()->GetPrimaryDisplay().GetSizeInPixel(); |
429 cast_browser_process_->cast_screen()->SetDisplayResizeCallback( | 433 video_plane_controller_.reset(new media::VideoPlaneController( |
430 base::Bind(&media::VideoPlaneController::SetGraphicsPlaneResolution, | 434 Size(display_size.width(), display_size.height()), GetMediaTaskRunner())); |
431 base::Unretained(video_plane_controller_.get()))); | |
432 ui::OverlayManagerCast::SetOverlayCompositedCallback( | 435 ui::OverlayManagerCast::SetOverlayCompositedCallback( |
433 base::Bind(&media::VideoPlaneController::SetGeometry, | 436 base::Bind(&media::VideoPlaneController::SetGeometry, |
434 base::Unretained(video_plane_controller_.get()))); | 437 base::Unretained(video_plane_controller_.get()))); |
435 #endif | 438 #endif |
436 | 439 |
437 cast_browser_process_->SetCastService( | 440 cast_browser_process_->SetCastService( |
438 cast_browser_process_->browser_client()->CreateCastService( | 441 cast_browser_process_->browser_client()->CreateCastService( |
439 cast_browser_process_->browser_context(), | 442 cast_browser_process_->browser_context(), |
440 cast_browser_process_->pref_service(), | 443 cast_browser_process_->pref_service(), |
441 url_request_context_factory_->GetSystemGetter(), | 444 url_request_context_factory_->GetSystemGetter(), |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
503 void CastBrowserMainParts::PostDestroyThreads() { | 506 void CastBrowserMainParts::PostDestroyThreads() { |
504 #if !defined(OS_ANDROID) | 507 #if !defined(OS_ANDROID) |
505 media_resource_tracker_->FinalizeAndDestroy(); | 508 media_resource_tracker_->FinalizeAndDestroy(); |
506 media_resource_tracker_ = nullptr; | 509 media_resource_tracker_ = nullptr; |
507 media_pipeline_backend_manager_.reset(); | 510 media_pipeline_backend_manager_.reset(); |
508 #endif | 511 #endif |
509 } | 512 } |
510 | 513 |
511 } // namespace shell | 514 } // namespace shell |
512 } // namespace chromecast | 515 } // namespace chromecast |
OLD | NEW |