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

Unified Diff: headless/lib/browser/headless_browser_impl_aura.cc

Issue 2669693002: Minimize headless code that refers to aura. (Closed)
Patch Set: Remove GetTopWindowContainingPoint Created 3 years, 10 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 | « headless/lib/browser/headless_browser_impl.cc ('k') | headless/lib/browser/headless_browser_main_parts.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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
new file mode 100644
index 0000000000000000000000000000000000000000..d1159d18124a734996fe8c2bb70536085323930a
--- /dev/null
+++ b/headless/lib/browser/headless_browser_impl_aura.cc
@@ -0,0 +1,50 @@
+// Copyright 2017 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "headless/lib/browser/headless_browser_impl.h"
+
+#include "content/public/browser/render_widget_host_view.h"
+#include "content/public/browser/web_contents.h"
+#include "headless/lib/browser/headless_screen.h"
+#include "ui/aura/env.h"
+#include "ui/aura/window.h"
+#include "ui/display/screen.h"
+#include "ui/events/devices/device_data_manager.h"
+#include "ui/gfx/geometry/size.h"
+
+namespace headless {
+
+void HeadlessBrowserImpl::PlatformInitialize() {
+ HeadlessScreen* screen = HeadlessScreen::Create(options()->window_size);
+ display::Screen::SetScreenInstance(screen);
+}
+
+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());
+}
+
+void HeadlessBrowserImpl::PlatformSetWebContents(
+ const gfx::Size& initial_size,
+ 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(gfx::Rect(initial_size));
+
+ content::RenderWidgetHostView* host_view =
+ web_contents->GetRenderWidgetHostView();
+ if (host_view)
+ host_view->SetSize(initial_size);
+}
+
+} // namespace headless
« no previous file with comments | « headless/lib/browser/headless_browser_impl.cc ('k') | headless/lib/browser/headless_browser_main_parts.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698