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

Unified Diff: webkit/tools/test_shell/test_webview_delegate_win.cc

Issue 149620: Use WebWidget from the WebKit API. This change also makes... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 11 years, 5 months 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 | « webkit/tools/test_shell/test_webview_delegate_gtk.cc ('k') | webkit/tools/test_shell/webview_host_gtk.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webkit/tools/test_shell/test_webview_delegate_win.cc
===================================================================
--- webkit/tools/test_shell/test_webview_delegate_win.cc (revision 20851)
+++ webkit/tools/test_shell/test_webview_delegate_win.cc (working copy)
@@ -36,6 +36,7 @@
#include "webkit/tools/test_shell/test_shell.h"
using WebKit::WebCursorInfo;
+using WebKit::WebNavigationPolicy;
using WebKit::WebRect;
// WebViewDelegate -----------------------------------------------------------
@@ -67,101 +68,99 @@
return WebPluginDelegateImpl::Create(info.path, mime_type, hwnd);
}
+void TestWebViewDelegate::DidMovePlugin(const WebPluginGeometry& move) {
+ HRGN hrgn = ::CreateRectRgn(move.clip_rect.x(),
+ move.clip_rect.y(),
+ move.clip_rect.right(),
+ move.clip_rect.bottom());
+ gfx::SubtractRectanglesFromRegion(hrgn, move.cutout_rects);
+
+ // Note: System will own the hrgn after we call SetWindowRgn,
+ // so we don't need to call DeleteObject(hrgn)
+ ::SetWindowRgn(move.window, hrgn, FALSE);
+ unsigned long flags = 0;
+ if (move.visible)
+ flags |= SWP_SHOWWINDOW;
+ else
+ flags |= SWP_HIDEWINDOW;
+
+ ::SetWindowPos(move.window,
+ NULL,
+ move.window_rect.x(),
+ move.window_rect.y(),
+ move.window_rect.width(),
+ move.window_rect.height(),
+ flags);
+}
+
void TestWebViewDelegate::ShowJavaScriptAlert(const std::wstring& message) {
MessageBox(NULL, message.c_str(), L"JavaScript Alert", MB_OK);
}
-void TestWebViewDelegate::Show(WebWidget* webwidget, WindowOpenDisposition) {
- if (webwidget == shell_->webView()) {
- ShowWindow(shell_->mainWnd(), SW_SHOW);
- UpdateWindow(shell_->mainWnd());
- } else if (webwidget == shell_->popup()) {
- ShowWindow(shell_->popupWnd(), SW_SHOW);
- UpdateWindow(shell_->popupWnd());
+void TestWebViewDelegate::show(WebNavigationPolicy) {
+ if (WebWidgetHost* host = GetWidgetHost()) {
+ HWND root = GetAncestor(host->view_handle(), GA_ROOT);
+ ShowWindow(root, SW_SHOW);
+ UpdateWindow(root);
}
}
-void TestWebViewDelegate::CloseWidgetSoon(WebWidget* webwidget) {
- if (webwidget == shell_->webView()) {
+void TestWebViewDelegate::closeWidgetSoon() {
+ if (this == shell_->delegate()) {
PostMessage(shell_->mainWnd(), WM_CLOSE, 0, 0);
- } else if (webwidget == shell_->popup()) {
+ } else if (this == shell_->popup_delegate()) {
shell_->ClosePopup();
}
}
-void TestWebViewDelegate::SetCursor(WebWidget* webwidget,
- const WebCursorInfo& cursor_info) {
- if (WebWidgetHost* host = GetHostForWidget(webwidget)) {
+void TestWebViewDelegate::didChangeCursor(const WebCursorInfo& cursor_info) {
+ if (WebWidgetHost* host = GetWidgetHost()) {
current_cursor_.InitFromCursorInfo(cursor_info);
HINSTANCE mod_handle = GetModuleHandle(NULL);
host->SetCursor(current_cursor_.GetCursor(mod_handle));
}
}
-void TestWebViewDelegate::GetWindowRect(WebWidget* webwidget,
- WebRect* out_rect) {
- if (WebWidgetHost* host = GetHostForWidget(webwidget)) {
+WebRect TestWebViewDelegate::windowRect() {
+ if (WebWidgetHost* host = GetWidgetHost()) {
RECT rect;
::GetWindowRect(host->view_handle(), &rect);
- *out_rect = gfx::Rect(rect);
+ return gfx::Rect(rect);
}
+ return WebRect();
}
-void TestWebViewDelegate::SetWindowRect(WebWidget* webwidget,
- const WebRect& rect) {
- if (webwidget == shell_->webView()) {
+void TestWebViewDelegate::setWindowRect(const WebRect& rect) {
+ if (this == shell_->delegate()) {
// ignored
- } else if (webwidget == shell_->popup()) {
+ } else if (this == shell_->popup_delegate()) {
MoveWindow(shell_->popupWnd(),
rect.x, rect.y, rect.width, rect.height, FALSE);
}
}
-void TestWebViewDelegate::GetRootWindowRect(WebWidget* webwidget,
- WebRect* out_rect) {
- if (WebWidgetHost* host = GetHostForWidget(webwidget)) {
+WebRect TestWebViewDelegate::rootWindowRect() {
+ if (WebWidgetHost* host = GetWidgetHost()) {
RECT rect;
HWND root_window = ::GetAncestor(host->view_handle(), GA_ROOT);
::GetWindowRect(root_window, &rect);
- *out_rect = gfx::Rect(rect);
+ return gfx::Rect(rect);
}
+ return WebRect();
}
-void TestWebViewDelegate::GetRootWindowResizerRect(WebWidget* webwidget,
- WebRect* out_rect) {
+WebRect TestWebViewDelegate::windowResizerRect() {
// Not necessary on Windows.
- *out_rect = gfx::Rect();
+ return WebRect();
}
-void TestWebViewDelegate::DidMove(WebWidget* webwidget,
- const WebPluginGeometry& move) {
- HRGN hrgn = ::CreateRectRgn(move.clip_rect.x(),
- move.clip_rect.y(),
- move.clip_rect.right(),
- move.clip_rect.bottom());
- gfx::SubtractRectanglesFromRegion(hrgn, move.cutout_rects);
+void TestWebViewDelegate::runModal() {
+ WebWidgetHost* host = GetWidgetHost();
+ if (!host)
+ return;
- // Note: System will own the hrgn after we call SetWindowRgn,
- // so we don't need to call DeleteObject(hrgn)
- ::SetWindowRgn(move.window, hrgn, FALSE);
- unsigned long flags = 0;
- if (move.visible)
- flags |= SWP_SHOWWINDOW;
- else
- flags |= SWP_HIDEWINDOW;
+ show(WebNavigationPolicy() /*XXX NEW_WINDOW*/);
- ::SetWindowPos(move.window,
- NULL,
- move.window_rect.x(),
- move.window_rect.y(),
- move.window_rect.width(),
- move.window_rect.height(),
- flags);
-}
-
-void TestWebViewDelegate::RunModal(WebWidget* webwidget) {
- Show(webwidget, NEW_WINDOW);
-
WindowList* wl = TestShell::windowList();
for (WindowList::const_iterator i = wl->begin(); i != wl->end(); ++i) {
if (*i != shell_->mainWnd())
« no previous file with comments | « webkit/tools/test_shell/test_webview_delegate_gtk.cc ('k') | webkit/tools/test_shell/webview_host_gtk.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698