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 303 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
314 CHECK(PathService::Get(DIR_CAST_HOME, &home_dir)); | 314 CHECK(PathService::Get(DIR_CAST_HOME, &home_dir)); |
315 if (!base::CreateDirectory(home_dir)) | 315 if (!base::CreateDirectory(home_dir)) |
316 return 1; | 316 return 1; |
317 | 317 |
318 // Hook for internal code | 318 // Hook for internal code |
319 cast_browser_process_->browser_client()->PreCreateThreads(); | 319 cast_browser_process_->browser_client()->PreCreateThreads(); |
320 | 320 |
321 // AudioManager is created immediately after threads are created, requiring | 321 // AudioManager is created immediately after threads are created, requiring |
322 // AudioManagerFactory to be set beforehand. | 322 // AudioManagerFactory to be set beforehand. |
323 ::media::AudioManager::SetFactory(new media::CastAudioManagerFactory()); | 323 ::media::AudioManager::SetFactory(new media::CastAudioManagerFactory()); |
| 324 |
| 325 // Set GL strings so GPU config code can make correct feature blacklisting/ |
| 326 // whitelisting decisions. |
| 327 // Note: SetGLStrings can be called before GpuDataManager::Initialize. |
| 328 scoped_ptr<CastSysInfo> sys_info = CreateSysInfo(); |
| 329 content::GpuDataManager::GetInstance()->SetGLStrings( |
| 330 sys_info->GetGlVendor(), sys_info->GetGlRenderer(), |
| 331 sys_info->GetGlVersion()); |
324 #endif | 332 #endif |
325 | 333 |
326 #if defined(USE_AURA) | 334 #if defined(USE_AURA) |
327 // Screen can (and should) exist even with no displays connected. Its presence | 335 // Screen can (and should) exist even with no displays connected. Its presence |
328 // is assumed as an interface to access display information, e.g. from metrics | 336 // is assumed as an interface to access display information, e.g. from metrics |
329 // code. See CastContentWindow::CreateWindowTree for update when resolution | 337 // code. See CastContentWindow::CreateWindowTree for update when resolution |
330 // is available. | 338 // is available. |
331 cast_browser_process_->SetCastScreen(make_scoped_ptr(new CastScreen)); | 339 cast_browser_process_->SetCastScreen(make_scoped_ptr(new CastScreen)); |
332 DCHECK(!gfx::Screen::GetScreen()); | 340 DCHECK(!gfx::Screen::GetScreen()); |
333 gfx::Screen::SetScreenInstance(cast_browser_process_->cast_screen()); | 341 gfx::Screen::SetScreenInstance(cast_browser_process_->cast_screen()); |
334 #endif | 342 #endif |
335 | 343 |
336 content::ChildProcessSecurityPolicy::GetInstance()->RegisterWebSafeScheme( | 344 content::ChildProcessSecurityPolicy::GetInstance()->RegisterWebSafeScheme( |
337 kChromeResourceScheme); | 345 kChromeResourceScheme); |
338 return 0; | 346 return 0; |
339 } | 347 } |
340 | 348 |
341 void CastBrowserMainParts::PreMainMessageLoopRun() { | 349 void CastBrowserMainParts::PreMainMessageLoopRun() { |
342 #if !defined(OS_ANDROID) | |
343 // Set GL strings so GPU config code can make correct feature blacklisting/ | |
344 // whitelisting decisions. | |
345 // Note: SetGLStrings MUST be called after GpuDataManager::Initialize. | |
346 scoped_ptr<CastSysInfo> sys_info = CreateSysInfo(); | |
347 content::GpuDataManager::GetInstance()->SetGLStrings( | |
348 sys_info->GetGlVendor(), sys_info->GetGlRenderer(), | |
349 sys_info->GetGlVersion()); | |
350 #endif // !defined(OS_ANDROID) | |
351 | |
352 scoped_refptr<PrefRegistrySimple> pref_registry(new PrefRegistrySimple()); | 350 scoped_refptr<PrefRegistrySimple> pref_registry(new PrefRegistrySimple()); |
353 metrics::RegisterPrefs(pref_registry.get()); | 351 metrics::RegisterPrefs(pref_registry.get()); |
354 cast_browser_process_->SetPrefService( | 352 cast_browser_process_->SetPrefService( |
355 PrefServiceHelper::CreatePrefService(pref_registry.get())); | 353 PrefServiceHelper::CreatePrefService(pref_registry.get())); |
356 | 354 |
357 const base::CommandLine* cmd_line = base::CommandLine::ForCurrentProcess(); | 355 const base::CommandLine* cmd_line = base::CommandLine::ForCurrentProcess(); |
358 #if defined(OS_ANDROID) | 356 #if defined(OS_ANDROID) |
359 ::media::SetMediaClientAndroid(new media::CastMediaClientAndroid()); | 357 ::media::SetMediaClientAndroid(new media::CastMediaClientAndroid()); |
360 #endif // defined(OS_ANDROID) | 358 #endif // defined(OS_ANDROID) |
361 | 359 |
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
454 #if defined(USE_AURA) | 452 #if defined(USE_AURA) |
455 aura::Env::DeleteInstance(); | 453 aura::Env::DeleteInstance(); |
456 #endif | 454 #endif |
457 | 455 |
458 DeregisterKillOnAlarm(); | 456 DeregisterKillOnAlarm(); |
459 #endif | 457 #endif |
460 } | 458 } |
461 | 459 |
462 } // namespace shell | 460 } // namespace shell |
463 } // namespace chromecast | 461 } // namespace chromecast |
OLD | NEW |