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 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
58 actual_mime_type)) | 58 actual_mime_type)) |
59 return NULL; | 59 return NULL; |
60 | 60 |
61 if (actual_mime_type && !actual_mime_type->empty()) | 61 if (actual_mime_type && !actual_mime_type->empty()) |
62 return WebPluginDelegateImpl::Create(info.path, *actual_mime_type, hwnd); | 62 return WebPluginDelegateImpl::Create(info.path, *actual_mime_type, hwnd); |
63 else | 63 else |
64 return WebPluginDelegateImpl::Create(info.path, mime_type, hwnd); | 64 return WebPluginDelegateImpl::Create(info.path, mime_type, hwnd); |
65 } | 65 } |
66 | 66 |
67 void TestWebViewDelegate::DidMovePlugin(const WebPluginGeometry& move) { | 67 void TestWebViewDelegate::DidMovePlugin(const WebPluginGeometry& move) { |
68 HRGN hrgn = ::CreateRectRgn(move.clip_rect.x(), | 68 unsigned long flags = 0; |
69 move.clip_rect.y(), | |
70 move.clip_rect.right(), | |
71 move.clip_rect.bottom()); | |
72 gfx::SubtractRectanglesFromRegion(hrgn, move.cutout_rects); | |
73 | 69 |
74 // Note: System will own the hrgn after we call SetWindowRgn, | 70 if (move.rects_valid) { |
75 // so we don't need to call DeleteObject(hrgn) | 71 HRGN hrgn = ::CreateRectRgn(move.clip_rect.x(), |
76 ::SetWindowRgn(move.window, hrgn, FALSE); | 72 move.clip_rect.y(), |
77 unsigned long flags = 0; | 73 move.clip_rect.right(), |
| 74 move.clip_rect.bottom()); |
| 75 gfx::SubtractRectanglesFromRegion(hrgn, move.cutout_rects); |
| 76 |
| 77 // Note: System will own the hrgn after we call SetWindowRgn, |
| 78 // so we don't need to call DeleteObject(hrgn) |
| 79 ::SetWindowRgn(move.window, hrgn, FALSE); |
| 80 } else { |
| 81 flags |= (SWP_NOSIZE | SWP_NOMOVE); |
| 82 } |
| 83 |
78 if (move.visible) | 84 if (move.visible) |
79 flags |= SWP_SHOWWINDOW; | 85 flags |= SWP_SHOWWINDOW; |
80 else | 86 else |
81 flags |= SWP_HIDEWINDOW; | 87 flags |= SWP_HIDEWINDOW; |
82 | 88 |
83 ::SetWindowPos(move.window, | 89 ::SetWindowPos(move.window, |
84 NULL, | 90 NULL, |
85 move.window_rect.x(), | 91 move.window_rect.x(), |
86 move.window_rect.y(), | 92 move.window_rect.y(), |
87 move.window_rect.width(), | 93 move.window_rect.width(), |
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
178 | 184 |
179 void TestWebViewDelegate::SetPageTitle(const std::wstring& title) { | 185 void TestWebViewDelegate::SetPageTitle(const std::wstring& title) { |
180 // The Windows test shell, pre-refactoring, ignored this. *shrug* | 186 // The Windows test shell, pre-refactoring, ignored this. *shrug* |
181 } | 187 } |
182 | 188 |
183 void TestWebViewDelegate::SetAddressBarURL(const GURL& url) { | 189 void TestWebViewDelegate::SetAddressBarURL(const GURL& url) { |
184 std::wstring url_string = UTF8ToWide(url.spec()); | 190 std::wstring url_string = UTF8ToWide(url.spec()); |
185 SendMessage(shell_->editWnd(), WM_SETTEXT, 0, | 191 SendMessage(shell_->editWnd(), WM_SETTEXT, 0, |
186 reinterpret_cast<LPARAM>(url_string.c_str())); | 192 reinterpret_cast<LPARAM>(url_string.c_str())); |
187 } | 193 } |
OLD | NEW |