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

Unified Diff: content/shell/browser/shell_views.cc

Issue 71243002: Support headless content_shell for linux/aura. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix the crash seen with earlier patch in popup tests! Created 7 years, 1 month 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 | « content/shell/browser/shell.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/shell/browser/shell_views.cc
diff --git a/content/shell/browser/shell_views.cc b/content/shell/browser/shell_views.cc
index eb364f7fc8ffb3b4211997e22662c57a3124b0d4..6f77bcd8c9049c3e0f80081571c0c7e2af034b9a 100644
--- a/content/shell/browser/shell_views.cc
+++ b/content/shell/browser/shell_views.cc
@@ -6,6 +6,7 @@
#include "base/command_line.h"
#include "base/strings/utf_string_conversions.h"
+#include "content/public/browser/render_widget_host_view.h"
#include "content/public/browser/web_contents.h"
#include "content/public/browser/web_contents_view.h"
#include "ui/aura/env.h"
@@ -336,6 +337,9 @@ void Shell::PlatformCleanUp() {
}
void Shell::PlatformEnableUIControl(UIControl control, bool is_enabled) {
+ if (headless_)
+ return;
+
ShellWindowDelegateView* delegate_view =
static_cast<ShellWindowDelegateView*>(window_widget_->widget_delegate());
if (control == BACK_BUTTON) {
@@ -351,6 +355,9 @@ void Shell::PlatformEnableUIControl(UIControl control, bool is_enabled) {
}
void Shell::PlatformSetAddressBarURL(const GURL& url) {
+ if (headless_)
+ return;
+
ShellWindowDelegateView* delegate_view =
static_cast<ShellWindowDelegateView*>(window_widget_->widget_delegate());
delegate_view->SetAddressBarURL(url);
@@ -366,6 +373,12 @@ void Shell::PlatformCreateWindow(int width, int height) {
wm_test_helper_->GetDefaultParent(NULL, NULL, gfx::Rect()),
gfx::Rect(0, 0, width, height));
#else
+ if (headless_) {
+ content_width_ = width;
+ content_height_ = height;
+ return;
+ }
+
window_widget_ = views::Widget::CreateWindowWithBounds(
new ShellWindowDelegateView(this), gfx::Rect(0, 0, width, height));
#endif
@@ -380,6 +393,16 @@ void Shell::PlatformCreateWindow(int width, int height) {
}
void Shell::PlatformSetContents() {
+ if (headless_) {
+ if (web_contents_) {
+ RenderWidgetHostView* rwhv =
+ web_contents_->GetRenderWidgetHostView();
+ if (rwhv)
+ rwhv->SetSize(gfx::Size(content_width_, content_height_));
+ }
+ return;
+ }
+
ShellWindowDelegateView* delegate_view =
static_cast<ShellWindowDelegateView*>(window_widget_->widget_delegate());
delegate_view->SetWebContents(web_contents_.get(), content_size_);
@@ -389,10 +412,18 @@ void Shell::PlatformResizeSubViews() {
}
void Shell::Close() {
+ if (headless_) {
+ delete this;
+ return;
+ }
+
window_widget_->CloseNow();
}
void Shell::PlatformSetTitle(const string16& title) {
+ if (headless_)
+ return;
+
ShellWindowDelegateView* delegate_view =
static_cast<ShellWindowDelegateView*>(window_widget_->widget_delegate());
delegate_view->SetWindowTitle(title);
« no previous file with comments | « content/shell/browser/shell.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698