| Index: headless/lib/browser/headless_browser_impl_aura.cc
|
| diff --git a/headless/lib/browser/headless_browser_impl_aura.cc b/headless/lib/browser/headless_browser_impl_aura.cc
|
| index 57a0f77c7918b6bcfd7df9277934a221dc564897..33b028a41fe64a7c7ec3e3277444770cac5f2243 100644
|
| --- a/headless/lib/browser/headless_browser_impl_aura.cc
|
| +++ b/headless/lib/browser/headless_browser_impl_aura.cc
|
| @@ -7,7 +7,9 @@
|
| #include "content/public/browser/render_widget_host_view.h"
|
| #include "content/public/browser/web_contents.h"
|
| #include "headless/lib/browser/headless_clipboard.h"
|
| +#include "headless/lib/browser/headless_focus_client.h"
|
| #include "headless/lib/browser/headless_screen.h"
|
| +#include "ui/aura/client/focus_client.h"
|
| #include "ui/aura/env.h"
|
| #include "ui/aura/window.h"
|
| #include "ui/base/clipboard/clipboard.h"
|
| @@ -21,8 +23,6 @@
|
| HeadlessScreen* screen = HeadlessScreen::Create(options()->window_size);
|
| display::Screen::SetScreenInstance(screen);
|
|
|
| - // TODO(eseckler): We shouldn't share clipboard contents across WebContents
|
| - // (or at least BrowserContexts).
|
| ui::Clipboard::SetClipboardForCurrentThread(
|
| base::MakeUnique<HeadlessClipboard>());
|
| }
|
| @@ -30,29 +30,30 @@
|
| void HeadlessBrowserImpl::PlatformCreateWindow() {
|
| DCHECK(aura::Env::GetInstance());
|
| ui::DeviceDataManager::CreateInstance();
|
| +
|
| + window_tree_host_.reset(
|
| + new HeadlessWindowTreeHost(gfx::Rect(options()->window_size)));
|
| + window_tree_host_->InitHost();
|
| + window_tree_host_->window()->Show();
|
| + window_tree_host_->SetParentWindow(window_tree_host_->window());
|
| +
|
| + focus_client_.reset(new HeadlessFocusClient());
|
| + aura::client::SetFocusClient(window_tree_host_->window(),
|
| + focus_client_.get());
|
| }
|
|
|
| void HeadlessBrowserImpl::PlatformInitializeWebContents(
|
| const gfx::Size& initial_size,
|
| - HeadlessWebContentsImpl* web_contents) {
|
| - gfx::Rect initial_rect(initial_size);
|
| -
|
| - auto window_tree_host =
|
| - base::MakeUnique<HeadlessWindowTreeHost>(initial_rect);
|
| - window_tree_host->InitHost();
|
| - gfx::NativeWindow parent_window = window_tree_host->window();
|
| - parent_window->Show();
|
| - window_tree_host->SetParentWindow(parent_window);
|
| - web_contents->set_window_tree_host(std::move(window_tree_host));
|
| -
|
| - gfx::NativeView contents = web_contents->web_contents()->GetNativeView();
|
| + content::WebContents* web_contents) {
|
| + gfx::NativeView contents = web_contents->GetNativeView();
|
| + gfx::NativeWindow parent_window = window_tree_host_->window();
|
| DCHECK(!parent_window->Contains(contents));
|
| parent_window->AddChild(contents);
|
| contents->Show();
|
| - contents->SetBounds(initial_rect);
|
| + contents->SetBounds(gfx::Rect(initial_size));
|
|
|
| content::RenderWidgetHostView* host_view =
|
| - web_contents->web_contents()->GetRenderWidgetHostView();
|
| + web_contents->GetRenderWidgetHostView();
|
| if (host_view)
|
| host_view->SetSize(initial_size);
|
| }
|
|
|