OLD | NEW |
---|---|
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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 // This file contains the implementation of TestWebViewDelegate, which serves | 5 // This file contains the implementation of TestWebViewDelegate, which serves |
6 // as the WebViewDelegate for the TestShellWebHost. The host is expected to | 6 // as the WebViewDelegate for the TestShellWebHost. The host is expected to |
7 // have initialized a MessageLoop before these methods are called. | 7 // have initialized a MessageLoop before these methods are called. |
8 | 8 |
9 #include "webkit/tools/test_shell/test_webview_delegate.h" | 9 #include "webkit/tools/test_shell/test_webview_delegate.h" |
10 | 10 |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
79 if (WebWidgetHost* host = GetWidgetHost()) { | 79 if (WebWidgetHost* host = GetWidgetHost()) { |
80 RECT rect; | 80 RECT rect; |
81 ::GetWindowRect(host->view_handle(), &rect); | 81 ::GetWindowRect(host->view_handle(), &rect); |
82 return gfx::Rect(rect); | 82 return gfx::Rect(rect); |
83 } | 83 } |
84 return WebRect(); | 84 return WebRect(); |
85 } | 85 } |
86 | 86 |
87 void TestWebViewDelegate::setWindowRect(const WebRect& rect) { | 87 void TestWebViewDelegate::setWindowRect(const WebRect& rect) { |
88 if (this == shell_->delegate()) { | 88 if (this == shell_->delegate()) { |
89 // ignored | 89 setFakeWindowRect(rect); |
90 } else if (this == shell_->popup_delegate()) { | 90 } else if (this == shell_->popup_delegate()) { |
91 MoveWindow(shell_->popupWnd(), | 91 MoveWindow(shell_->popupWnd(), |
92 rect.x, rect.y, rect.width, rect.height, FALSE); | 92 rect.x, rect.y, rect.width, rect.height, FALSE); |
93 } | 93 } |
94 } | 94 } |
95 | 95 |
96 WebRect TestWebViewDelegate::rootWindowRect() { | 96 WebRect TestWebViewDelegate::rootWindowRect() { |
97 if (WebWidgetHost* host = GetWidgetHost()) { | 97 if (using_fake_rect_) { |
98 return getFakeWindowRect(); | |
99 } else if (WebWidgetHost* host = GetWidgetHost()) { | |
dglazkov
2009/09/23 18:17:14
Ditto on early return.
| |
98 RECT rect; | 100 RECT rect; |
99 HWND root_window = ::GetAncestor(host->view_handle(), GA_ROOT); | 101 HWND root_window = ::GetAncestor(host->view_handle(), GA_ROOT); |
100 ::GetWindowRect(root_window, &rect); | 102 ::GetWindowRect(root_window, &rect); |
101 return gfx::Rect(rect); | 103 return gfx::Rect(rect); |
102 } | 104 } |
103 return WebRect(); | 105 return WebRect(); |
104 } | 106 } |
105 | 107 |
106 WebRect TestWebViewDelegate::windowResizerRect() { | 108 WebRect TestWebViewDelegate::windowResizerRect() { |
107 // Not necessary on Windows. | 109 // Not necessary on Windows. |
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
207 | 209 |
208 void TestWebViewDelegate::SetPageTitle(const std::wstring& title) { | 210 void TestWebViewDelegate::SetPageTitle(const std::wstring& title) { |
209 // The Windows test shell, pre-refactoring, ignored this. *shrug* | 211 // The Windows test shell, pre-refactoring, ignored this. *shrug* |
210 } | 212 } |
211 | 213 |
212 void TestWebViewDelegate::SetAddressBarURL(const GURL& url) { | 214 void TestWebViewDelegate::SetAddressBarURL(const GURL& url) { |
213 std::wstring url_string = UTF8ToWide(url.spec()); | 215 std::wstring url_string = UTF8ToWide(url.spec()); |
214 SendMessage(shell_->editWnd(), WM_SETTEXT, 0, | 216 SendMessage(shell_->editWnd(), WM_SETTEXT, 0, |
215 reinterpret_cast<LPARAM>(url_string.c_str())); | 217 reinterpret_cast<LPARAM>(url_string.c_str())); |
216 } | 218 } |
OLD | NEW |