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 |
11 #include <objidl.h> | 11 #include <objidl.h> |
12 #include <shlobj.h> | 12 #include <shlobj.h> |
13 #include <shlwapi.h> | 13 #include <shlwapi.h> |
14 | 14 |
15 #include "base/gfx/gdi_util.h" | 15 #include "base/gfx/gdi_util.h" |
16 #include "base/gfx/native_widget_types.h" | 16 #include "base/gfx/native_widget_types.h" |
17 #include "base/gfx/point.h" | 17 #include "base/gfx/point.h" |
18 #include "base/message_loop.h" | 18 #include "base/message_loop.h" |
19 #include "base/string_util.h" | 19 #include "base/string_util.h" |
20 #include "base/trace_event.h" | 20 #include "base/trace_event.h" |
21 #include "net/base/net_errors.h" | 21 #include "net/base/net_errors.h" |
| 22 #include "webkit/api/public/WebCursorInfo.h" |
22 #include "webkit/api/public/WebRect.h" | 23 #include "webkit/api/public/WebRect.h" |
23 #include "webkit/glue/webdropdata.h" | 24 #include "webkit/glue/webdropdata.h" |
24 #include "webkit/glue/webframe.h" | 25 #include "webkit/glue/webframe.h" |
25 #include "webkit/glue/webpreferences.h" | 26 #include "webkit/glue/webpreferences.h" |
26 #include "webkit/glue/webplugin.h" | 27 #include "webkit/glue/webplugin.h" |
27 #include "webkit/glue/webkit_glue.h" | 28 #include "webkit/glue/webkit_glue.h" |
28 #include "webkit/glue/webview.h" | 29 #include "webkit/glue/webview.h" |
29 #include "webkit/glue/plugins/plugin_list.h" | 30 #include "webkit/glue/plugins/plugin_list.h" |
30 #include "webkit/glue/plugins/webplugin_delegate_impl.h" | 31 #include "webkit/glue/plugins/webplugin_delegate_impl.h" |
31 #include "webkit/glue/window_open_disposition.h" | 32 #include "webkit/glue/window_open_disposition.h" |
32 #include "webkit/tools/test_shell/drag_delegate.h" | 33 #include "webkit/tools/test_shell/drag_delegate.h" |
33 #include "webkit/tools/test_shell/drop_delegate.h" | 34 #include "webkit/tools/test_shell/drop_delegate.h" |
34 #include "webkit/tools/test_shell/test_navigation_controller.h" | 35 #include "webkit/tools/test_shell/test_navigation_controller.h" |
35 #include "webkit/tools/test_shell/test_shell.h" | 36 #include "webkit/tools/test_shell/test_shell.h" |
36 | 37 |
| 38 using WebKit::WebCursorInfo; |
37 using WebKit::WebRect; | 39 using WebKit::WebRect; |
38 | 40 |
39 // WebViewDelegate ----------------------------------------------------------- | 41 // WebViewDelegate ----------------------------------------------------------- |
40 | 42 |
41 TestWebViewDelegate::~TestWebViewDelegate() { | 43 TestWebViewDelegate::~TestWebViewDelegate() { |
42 RevokeDragDrop(shell_->webViewWnd()); | 44 RevokeDragDrop(shell_->webViewWnd()); |
43 } | 45 } |
44 | 46 |
45 WebPluginDelegate* TestWebViewDelegate::CreatePluginDelegate( | 47 WebPluginDelegate* TestWebViewDelegate::CreatePluginDelegate( |
46 WebView* webview, | 48 WebView* webview, |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
90 | 92 |
91 void TestWebViewDelegate::CloseWidgetSoon(WebWidget* webwidget) { | 93 void TestWebViewDelegate::CloseWidgetSoon(WebWidget* webwidget) { |
92 if (webwidget == shell_->webView()) { | 94 if (webwidget == shell_->webView()) { |
93 PostMessage(shell_->mainWnd(), WM_CLOSE, 0, 0); | 95 PostMessage(shell_->mainWnd(), WM_CLOSE, 0, 0); |
94 } else if (webwidget == shell_->popup()) { | 96 } else if (webwidget == shell_->popup()) { |
95 shell_->ClosePopup(); | 97 shell_->ClosePopup(); |
96 } | 98 } |
97 } | 99 } |
98 | 100 |
99 void TestWebViewDelegate::SetCursor(WebWidget* webwidget, | 101 void TestWebViewDelegate::SetCursor(WebWidget* webwidget, |
100 const WebCursor& cursor) { | 102 const WebCursorInfo& cursor_info) { |
101 if (WebWidgetHost* host = GetHostForWidget(webwidget)) { | 103 if (WebWidgetHost* host = GetHostForWidget(webwidget)) { |
102 current_cursor_ = cursor; | 104 current_cursor_.InitFromCursorInfo(cursor_info); |
103 HINSTANCE mod_handle = GetModuleHandle(NULL); | 105 HINSTANCE mod_handle = GetModuleHandle(NULL); |
104 host->SetCursor(current_cursor_.GetCursor(mod_handle)); | 106 host->SetCursor(current_cursor_.GetCursor(mod_handle)); |
105 } | 107 } |
106 } | 108 } |
107 | 109 |
108 void TestWebViewDelegate::GetWindowRect(WebWidget* webwidget, | 110 void TestWebViewDelegate::GetWindowRect(WebWidget* webwidget, |
109 WebRect* out_rect) { | 111 WebRect* out_rect) { |
110 if (WebWidgetHost* host = GetHostForWidget(webwidget)) { | 112 if (WebWidgetHost* host = GetHostForWidget(webwidget)) { |
111 RECT rect; | 113 RECT rect; |
112 ::GetWindowRect(host->view_handle(), &rect); | 114 ::GetWindowRect(host->view_handle(), &rect); |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
190 | 192 |
191 void TestWebViewDelegate::SetPageTitle(const std::wstring& title) { | 193 void TestWebViewDelegate::SetPageTitle(const std::wstring& title) { |
192 // The Windows test shell, pre-refactoring, ignored this. *shrug* | 194 // The Windows test shell, pre-refactoring, ignored this. *shrug* |
193 } | 195 } |
194 | 196 |
195 void TestWebViewDelegate::SetAddressBarURL(const GURL& url) { | 197 void TestWebViewDelegate::SetAddressBarURL(const GURL& url) { |
196 std::wstring url_string = UTF8ToWide(url.spec()); | 198 std::wstring url_string = UTF8ToWide(url.spec()); |
197 SendMessage(shell_->editWnd(), WM_SETTEXT, 0, | 199 SendMessage(shell_->editWnd(), WM_SETTEXT, 0, |
198 reinterpret_cast<LPARAM>(url_string.c_str())); | 200 reinterpret_cast<LPARAM>(url_string.c_str())); |
199 } | 201 } |
OLD | NEW |