Chromium Code Reviews| 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..6a91fe0b99ff9a5cc48ac3fb21c249bf8a76e3cf 100644 |
| --- a/chromecast/browser/cast_content_window.cc |
| +++ b/chromecast/browser/cast_content_window.cc |
| @@ -14,6 +14,7 @@ |
| #include "content/public/browser/render_widget_host_view.h" |
| #include "content/public/browser/web_contents.h" |
| #include "ipc/ipc_message.h" |
| +#include "ui/display/screen.h" |
| #if defined(USE_AURA) |
| #include "chromecast/graphics/cast_screen.h" |
| @@ -68,21 +69,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); |
| - |
| + DCHECK(display::Screen::GetScreen()); |
| + gfx::Size display_size = |
|
alokp
2016/05/14 05:15:32
Ideally we should query this size from WebContents
halliwell
2016/05/16 15:48:48
WebContents is currently not aware of this size.
alokp
2016/05/16 16:26:14
We already pass the size in WebContents::CreatePar
halliwell
2016/05/16 20:42:20
The NativeView's bounds appear to be 0x0 at this p
|
| + 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 +101,14 @@ void CastContentWindow::CreateWindowTree( |
| } |
| std::unique_ptr<content::WebContents> CastContentWindow::CreateWebContents( |
| - const gfx::Size& initial_size, |
| content::BrowserContext* browser_context) { |
| + CHECK(display::Screen::GetScreen()); |
|
alokp
2016/05/14 05:15:32
I wonder why this is a member function for this cl
halliwell
2016/05/16 15:48:48
Good question, I don't know; maybe some historical
|
| + 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); |