Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1573)

Unified Diff: chromecast/browser/cast_browser_main_parts.cc

Issue 1021483005: Create gfx::Screen at startup for cast_shell (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add explanatory comment Created 5 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chromecast/browser/cast_browser_main_parts.cc
diff --git a/chromecast/browser/cast_browser_main_parts.cc b/chromecast/browser/cast_browser_main_parts.cc
index f1dfbe33e4f0fa87bdf4b5e849af9bada29fd72f..5f0bd93f01ca8fa52155d3c937ba791e29b440bf 100644
--- a/chromecast/browser/cast_browser_main_parts.cc
+++ b/chromecast/browser/cast_browser_main_parts.cc
@@ -40,6 +40,11 @@
#include "net/android/network_change_notifier_factory_android.h"
#endif
+#if defined(USE_AURA)
+#include "ui/aura/test/test_screen.h"
+#include "ui/gfx/screen.h"
+#endif
+
namespace {
#if !defined(OS_ANDROID)
@@ -194,6 +199,16 @@ int CastBrowserMainParts::PreCreateThreads() {
if (!base::CreateDirectory(home_dir))
return 1;
#endif
+
+#if defined(USE_AURA)
+ // Screen can (and should) exist even with no displays connected. Its presence
+ // is assumed as an interface to access display information, e.g. from metrics
+ // code. See CastContentWindow::CreateWindowTree for update when resolution
+ // is available.
+ DCHECK(!gfx::Screen::GetScreenByType(gfx::SCREEN_TYPE_NATIVE));
+ gfx::Screen::SetScreenInstance(gfx::SCREEN_TYPE_NATIVE,
+ aura::TestScreen::Create(gfx::Size(0, 0)));
oshima 2015/03/25 22:39:55 Hmm, production code should not depend on test cod
halliwell 2015/03/26 00:28:24 Yes, sure. I filed https://code.google.com/p/chro
+#endif
return 0;
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698