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

Unified Diff: chromecast/browser/cast_content_window.cc

Issue 1972433002: [Chromecast] Handle device scale factor correctly (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Set device scale factor correctly Created 4 years, 7 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
Index: chromecast/browser/cast_content_window.cc
diff --git a/chromecast/browser/cast_content_window.cc b/chromecast/browser/cast_content_window.cc
index 3223d83335f9a555c0409a06c7fa5a1c2944276d..d40dc7a997fe043c2a51679ff1879fa38155597b 100644
--- a/chromecast/browser/cast_content_window.cc
+++ b/chromecast/browser/cast_content_window.cc
@@ -68,21 +68,15 @@ CastContentWindow::~CastContentWindow() {
#endif
}
-void CastContentWindow::CreateWindowTree(
- const gfx::Size& initial_size,
- content::WebContents* web_contents) {
+void CastContentWindow::CreateWindowTree(content::WebContents* web_contents) {
#if defined(USE_AURA)
// Aura initialization
- CastScreen* cast_screen =
- shell::CastBrowserProcess::GetInstance()->cast_screen();
- if (!display::Screen::GetScreen())
- display::Screen::SetScreenInstance(cast_screen);
- if (cast_screen->GetPrimaryDisplay().size() != initial_size)
- cast_screen->UpdateDisplaySize(initial_size);
-
+ CHECK(display::Screen::GetScreen());
alokp 2016/05/12 21:35:16 Can this be a DCHECK?
halliwell 2016/05/13 23:48:03 sure, done.
+ gfx::Size display_size =
+ display::Screen::GetScreen()->GetPrimaryDisplay().GetSizeInPixel();
CHECK(aura::Env::GetInstance());
window_tree_host_.reset(
- aura::WindowTreeHost::Create(gfx::Rect(initial_size)));
+ aura::WindowTreeHost::Create(gfx::Rect(display_size)));
window_tree_host_->InitHost();
window_tree_host_->window()->SetLayoutManager(
new CastFillLayout(window_tree_host_->window()));
@@ -106,11 +100,14 @@ void CastContentWindow::CreateWindowTree(
}
std::unique_ptr<content::WebContents> CastContentWindow::CreateWebContents(
- const gfx::Size& initial_size,
content::BrowserContext* browser_context) {
+ CHECK(display::Screen::GetScreen());
+ gfx::Size display_size =
+ display::Screen::GetScreen()->GetPrimaryDisplay().size();
+
content::WebContents::CreateParams create_params(browser_context, NULL);
create_params.routing_id = MSG_ROUTING_NONE;
- create_params.initial_size = initial_size;
+ create_params.initial_size = display_size;
content::WebContents* web_contents = content::WebContents::Create(
create_params);
content::WebContentsObserver::Observe(web_contents);

Powered by Google App Engine
This is Rietveld 408576698