summaryrefslogtreecommitdiffstats
path: root/content/shell
diff options
context:
space:
mode:
authorscottmg@chromium.org <scottmg@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-06-11 07:05:32 +0000
committerscottmg@chromium.org <scottmg@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-06-11 07:05:32 +0000
commit55b64fac78c99e1672f88e08b11a97e40eedf4c5 (patch)
tree9f65b299bc3648341e2b1d6c4c36a72c725124f3 /content/shell
parent9a7f6e1115d8ba492fb8cd29173fe0e12f6014ff (diff)
downloadchromium_src-55b64fac78c99e1672f88e08b11a97e40eedf4c5.zip
chromium_src-55b64fac78c99e1672f88e08b11a97e40eedf4c5.tar.gz
chromium_src-55b64fac78c99e1672f88e08b11a97e40eedf4c5.tar.bz2
headless windows content_shell
Early out on the various Shell::Platform functions to avoid creating hwnds. R=jamesr@chromium.org BUG=243601 Review URL: https://chromiumcodereview.appspot.com/16280003 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@205443 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'content/shell')
-rw-r--r--content/shell/shell_win.cc20
1 files changed, 20 insertions, 0 deletions
diff --git a/content/shell/shell_win.cc b/content/shell/shell_win.cc
index d6d9497..3c22cf9 100644
--- a/content/shell/shell_win.cc
+++ b/content/shell/shell_win.cc
@@ -57,6 +57,8 @@ void Shell::PlatformCleanUp() {
}
void Shell::PlatformEnableUIControl(UIControl control, bool is_enabled) {
+ if (headless_)
+ return;
int id;
switch (control) {
case BACK_BUTTON:
@@ -76,6 +78,8 @@ void Shell::PlatformEnableUIControl(UIControl control, bool is_enabled) {
}
void Shell::PlatformSetAddressBarURL(const GURL& url) {
+ if (headless_)
+ return;
std::wstring url_string = UTF8ToWide(url.spec());
SendMessage(url_edit_view_, WM_SETTEXT, 0,
reinterpret_cast<LPARAM>(url_string.c_str()));
@@ -85,6 +89,8 @@ void Shell::PlatformSetIsLoading(bool loading) {
}
void Shell::PlatformCreateWindow(int width, int height) {
+ if (headless_)
+ return;
window_ = CreateWindow(kWindowClass, kWindowTitle,
WS_OVERLAPPEDWINDOW | WS_CLIPCHILDREN,
CW_USEDEFAULT, 0, CW_USEDEFAULT, 0,
@@ -134,10 +140,14 @@ void Shell::PlatformCreateWindow(int width, int height) {
}
void Shell::PlatformSetContents() {
+ if (headless_)
+ return;
SetParent(web_contents_->GetView()->GetNativeView(), window_);
}
void Shell::SizeTo(int width, int height) {
+ if (headless_)
+ return;
RECT rc, rw;
GetClientRect(window_, &rc);
GetWindowRect(window_, &rw);
@@ -158,6 +168,8 @@ void Shell::SizeTo(int width, int height) {
}
void Shell::PlatformResizeSubViews() {
+ if (headless_)
+ return;
RECT rc;
GetClientRect(window_, &rc);
@@ -169,6 +181,10 @@ void Shell::PlatformResizeSubViews() {
}
void Shell::Close() {
+ if (headless_) {
+ delete this;
+ return;
+ }
DestroyWindow(window_);
}
@@ -199,6 +215,8 @@ LRESULT CALLBACK Shell::WndProc(HWND hwnd, UINT message, WPARAM wParam,
int id = LOWORD(wParam);
switch (id) {
case IDM_NEW_WINDOW:
+ if (shell->headless_)
+ return 0;
CreateNewWindow(
shell->web_contents()->GetBrowserContext(),
GURL(), NULL, MSG_ROUTING_NONE, gfx::Size());
@@ -279,6 +297,8 @@ LRESULT CALLBACK Shell::EditWndProc(HWND hwnd, UINT message,
}
void Shell::PlatformSetTitle(const string16& text) {
+ if (headless_)
+ return;
::SetWindowText(window_, text.c_str());
}