OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "content/shell/shell.h" | 5 #include "content/shell/shell.h" |
6 | 6 |
7 #include <commctrl.h> | 7 #include <commctrl.h> |
8 #include <fcntl.h> | 8 #include <fcntl.h> |
9 #include <io.h> | 9 #include <io.h> |
10 #include <windows.h> | 10 #include <windows.h> |
11 | 11 |
12 #include "base/command_line.h" | |
13 #include "base/utf_string_conversions.h" | 12 #include "base/utf_string_conversions.h" |
14 #include "base/win/wrapped_window_proc.h" | 13 #include "base/win/wrapped_window_proc.h" |
15 #include "content/public/browser/web_contents.h" | 14 #include "content/public/browser/web_contents.h" |
16 #include "content/public/browser/web_contents_view.h" | 15 #include "content/public/browser/web_contents_view.h" |
17 #include "content/shell/resource.h" | 16 #include "content/shell/resource.h" |
18 #include "content/shell/shell_switches.h" | |
19 #include "ui/base/win/hwnd_util.h" | 17 #include "ui/base/win/hwnd_util.h" |
20 | 18 |
21 namespace { | 19 namespace { |
22 | 20 |
23 const wchar_t kWindowTitle[] = L"Content Shell"; | 21 const wchar_t kWindowTitle[] = L"Content Shell"; |
24 const wchar_t kWindowClass[] = L"CONTENT_SHELL"; | 22 const wchar_t kWindowClass[] = L"CONTENT_SHELL"; |
25 | 23 |
26 const int kButtonWidth = 72; | 24 const int kButtonWidth = 72; |
27 const int kURLBarHeight = 24; | 25 const int kURLBarHeight = 24; |
28 | 26 |
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
148 int window_width = rw.right - rw.left; | 146 int window_width = rw.right - rw.left; |
149 window_width = (window_width - client_width) + width; | 147 window_width = (window_width - client_width) + width; |
150 | 148 |
151 int client_height = rc.bottom - rc.top; | 149 int client_height = rc.bottom - rc.top; |
152 int window_height = rw.bottom - rw.top; | 150 int window_height = rw.bottom - rw.top; |
153 window_height = (window_height - client_height) + height; | 151 window_height = (window_height - client_height) + height; |
154 | 152 |
155 // Add space for the url bar. | 153 // Add space for the url bar. |
156 window_height += kURLBarHeight; | 154 window_height += kURLBarHeight; |
157 | 155 |
158 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kDumpRenderTree)) { | 156 SetWindowPos(window_, NULL, 0, 0, window_width, window_height, |
159 SetWindowPos(window_, NULL, -window_width, -window_height, | 157 SWP_NOMOVE | SWP_NOZORDER); |
160 window_width, window_height, SWP_NOZORDER); | |
161 } else { | |
162 SetWindowPos(window_, NULL, 0, 0, window_width, window_height, | |
163 SWP_NOMOVE | SWP_NOZORDER); | |
164 } | |
165 } | 158 } |
166 | 159 |
167 void Shell::PlatformResizeSubViews() { | 160 void Shell::PlatformResizeSubViews() { |
168 RECT rc; | 161 RECT rc; |
169 GetClientRect(window_, &rc); | 162 GetClientRect(window_, &rc); |
170 | 163 |
171 int x = kButtonWidth * 4; | 164 int x = kButtonWidth * 4; |
172 MoveWindow(url_edit_view_, x, 0, rc.right - x, kURLBarHeight, TRUE); | 165 MoveWindow(url_edit_view_, x, 0, rc.right - x, kURLBarHeight, TRUE); |
173 | 166 |
174 MoveWindow(GetContentView(), 0, kURLBarHeight, rc.right, | 167 MoveWindow(GetContentView(), 0, kURLBarHeight, rc.right, |
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
283 | 276 |
284 return CallWindowProc(shell->default_edit_wnd_proc_, hwnd, message, wParam, | 277 return CallWindowProc(shell->default_edit_wnd_proc_, hwnd, message, wParam, |
285 lParam); | 278 lParam); |
286 } | 279 } |
287 | 280 |
288 void Shell::PlatformSetTitle(const string16& text) { | 281 void Shell::PlatformSetTitle(const string16& text) { |
289 ::SetWindowText(window_, text.c_str()); | 282 ::SetWindowText(window_, text.c_str()); |
290 } | 283 } |
291 | 284 |
292 } // namespace content | 285 } // namespace content |
OLD | NEW |