| 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/WebCursorInfo.h" |
| 23 #include "webkit/api/public/WebFrame.h" |
| 23 #include "webkit/api/public/WebRect.h" | 24 #include "webkit/api/public/WebRect.h" |
| 24 #include "webkit/glue/webdropdata.h" | 25 #include "webkit/glue/webdropdata.h" |
| 25 #include "webkit/glue/webframe.h" | |
| 26 #include "webkit/glue/webpreferences.h" | 26 #include "webkit/glue/webpreferences.h" |
| 27 #include "webkit/glue/webplugin.h" | 27 #include "webkit/glue/webplugin.h" |
| 28 #include "webkit/glue/webkit_glue.h" | 28 #include "webkit/glue/webkit_glue.h" |
| 29 #include "webkit/glue/webview.h" | 29 #include "webkit/glue/webview.h" |
| 30 #include "webkit/glue/plugins/plugin_list.h" | 30 #include "webkit/glue/plugins/plugin_list.h" |
| 31 #include "webkit/glue/plugins/webplugin_delegate_impl.h" | 31 #include "webkit/glue/plugins/webplugin_delegate_impl.h" |
| 32 #include "webkit/glue/window_open_disposition.h" | 32 #include "webkit/glue/window_open_disposition.h" |
| 33 #include "webkit/tools/test_shell/drag_delegate.h" | 33 #include "webkit/tools/test_shell/drag_delegate.h" |
| 34 #include "webkit/tools/test_shell/drop_delegate.h" | 34 #include "webkit/tools/test_shell/drop_delegate.h" |
| 35 #include "webkit/tools/test_shell/test_navigation_controller.h" | 35 #include "webkit/tools/test_shell/test_navigation_controller.h" |
| (...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 152 WebRect TestWebViewDelegate::windowResizerRect() { | 152 WebRect TestWebViewDelegate::windowResizerRect() { |
| 153 // Not necessary on Windows. | 153 // Not necessary on Windows. |
| 154 return WebRect(); | 154 return WebRect(); |
| 155 } | 155 } |
| 156 | 156 |
| 157 void TestWebViewDelegate::runModal() { | 157 void TestWebViewDelegate::runModal() { |
| 158 WebWidgetHost* host = GetWidgetHost(); | 158 WebWidgetHost* host = GetWidgetHost(); |
| 159 if (!host) | 159 if (!host) |
| 160 return; | 160 return; |
| 161 | 161 |
| 162 show(WebNavigationPolicy() /*XXX NEW_WINDOW*/); | 162 show(WebKit::WebNavigationPolicyNewWindow); |
| 163 | 163 |
| 164 WindowList* wl = TestShell::windowList(); | 164 WindowList* wl = TestShell::windowList(); |
| 165 for (WindowList::const_iterator i = wl->begin(); i != wl->end(); ++i) { | 165 for (WindowList::const_iterator i = wl->begin(); i != wl->end(); ++i) { |
| 166 if (*i != shell_->mainWnd()) | 166 if (*i != shell_->mainWnd()) |
| 167 EnableWindow(*i, FALSE); | 167 EnableWindow(*i, FALSE); |
| 168 } | 168 } |
| 169 | 169 |
| 170 shell_->set_is_modal(true); | 170 shell_->set_is_modal(true); |
| 171 MessageLoop::current()->Run(); | 171 MessageLoop::current()->Run(); |
| 172 | 172 |
| 173 for (WindowList::const_iterator i = wl->begin(); i != wl->end(); ++i) | 173 for (WindowList::const_iterator i = wl->begin(); i != wl->end(); ++i) |
| 174 EnableWindow(*i, TRUE); | 174 EnableWindow(*i, TRUE); |
| 175 } | 175 } |
| 176 | 176 |
| 177 void TestWebViewDelegate::UpdateSelectionClipboard(bool is_empty_selection) { | 177 void TestWebViewDelegate::UpdateSelectionClipboard(bool is_empty_selection) { |
| 178 // No selection clipboard on windows, do nothing. | 178 // No selection clipboard on windows, do nothing. |
| 179 } | 179 } |
| 180 | 180 |
| 181 // Private methods ----------------------------------------------------------- | 181 // Private methods ----------------------------------------------------------- |
| 182 | 182 |
| 183 void TestWebViewDelegate::SetPageTitle(const std::wstring& title) { | 183 void TestWebViewDelegate::SetPageTitle(const std::wstring& title) { |
| 184 // The Windows test shell, pre-refactoring, ignored this. *shrug* | 184 // The Windows test shell, pre-refactoring, ignored this. *shrug* |
| 185 } | 185 } |
| 186 | 186 |
| 187 void TestWebViewDelegate::SetAddressBarURL(const GURL& url) { | 187 void TestWebViewDelegate::SetAddressBarURL(const GURL& url) { |
| 188 std::wstring url_string = UTF8ToWide(url.spec()); | 188 std::wstring url_string = UTF8ToWide(url.spec()); |
| 189 SendMessage(shell_->editWnd(), WM_SETTEXT, 0, | 189 SendMessage(shell_->editWnd(), WM_SETTEXT, 0, |
| 190 reinterpret_cast<LPARAM>(url_string.c_str())); | 190 reinterpret_cast<LPARAM>(url_string.c_str())); |
| 191 } | 191 } |
| OLD | NEW |