| 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 19 matching lines...) Expand all Loading... |
| 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" |
| 36 #include "webkit/tools/test_shell/test_shell.h" | 36 #include "webkit/tools/test_shell/test_shell.h" |
| 37 | 37 |
| 38 using WebKit::WebCursorInfo; | 38 using WebKit::WebCursorInfo; |
| 39 using WebKit::WebNavigationPolicy; | 39 using WebKit::WebNavigationPolicy; |
| 40 using WebKit::WebPopupMenuInfo; |
| 40 using WebKit::WebRect; | 41 using WebKit::WebRect; |
| 42 using WebKit::WebWidget; |
| 41 | 43 |
| 42 // WebViewDelegate ------------------------------------------------------------ | 44 // WebViewClient -------------------------------------------------------------- |
| 43 | 45 |
| 44 void TestWebViewDelegate::ShowJavaScriptAlert(const std::wstring& message) { | 46 WebWidget* TestWebViewDelegate::createPopupMenu( |
| 45 MessageBox(NULL, message.c_str(), L"JavaScript Alert", MB_OK); | 47 const WebPopupMenuInfo& info) { |
| 48 NOTREACHED(); |
| 49 return NULL; |
| 46 } | 50 } |
| 47 | 51 |
| 48 // WebWidgetClient ------------------------------------------------------------ | 52 // WebWidgetClient ------------------------------------------------------------ |
| 49 | 53 |
| 50 void TestWebViewDelegate::show(WebNavigationPolicy) { | 54 void TestWebViewDelegate::show(WebNavigationPolicy) { |
| 51 if (WebWidgetHost* host = GetWidgetHost()) { | 55 if (WebWidgetHost* host = GetWidgetHost()) { |
| 52 HWND root = GetAncestor(host->view_handle(), GA_ROOT); | 56 HWND root = GetAncestor(host->view_handle(), GA_ROOT); |
| 53 ShowWindow(root, SW_SHOW); | 57 ShowWindow(root, SW_SHOW); |
| 54 UpdateWindow(root); | 58 UpdateWindow(root); |
| 55 } | 59 } |
| (...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 190 } | 194 } |
| 191 | 195 |
| 192 // Public methods ------------------------------------------------------------- | 196 // Public methods ------------------------------------------------------------- |
| 193 | 197 |
| 194 void TestWebViewDelegate::UpdateSelectionClipboard(bool is_empty_selection) { | 198 void TestWebViewDelegate::UpdateSelectionClipboard(bool is_empty_selection) { |
| 195 // No selection clipboard on windows, do nothing. | 199 // No selection clipboard on windows, do nothing. |
| 196 } | 200 } |
| 197 | 201 |
| 198 // Private methods ------------------------------------------------------------ | 202 // Private methods ------------------------------------------------------------ |
| 199 | 203 |
| 204 void TestWebViewDelegate::ShowJavaScriptAlert(const std::wstring& message) { |
| 205 MessageBox(NULL, message.c_str(), L"JavaScript Alert", MB_OK); |
| 206 } |
| 207 |
| 200 void TestWebViewDelegate::SetPageTitle(const std::wstring& title) { | 208 void TestWebViewDelegate::SetPageTitle(const std::wstring& title) { |
| 201 // The Windows test shell, pre-refactoring, ignored this. *shrug* | 209 // The Windows test shell, pre-refactoring, ignored this. *shrug* |
| 202 } | 210 } |
| 203 | 211 |
| 204 void TestWebViewDelegate::SetAddressBarURL(const GURL& url) { | 212 void TestWebViewDelegate::SetAddressBarURL(const GURL& url) { |
| 205 std::wstring url_string = UTF8ToWide(url.spec()); | 213 std::wstring url_string = UTF8ToWide(url.spec()); |
| 206 SendMessage(shell_->editWnd(), WM_SETTEXT, 0, | 214 SendMessage(shell_->editWnd(), WM_SETTEXT, 0, |
| 207 reinterpret_cast<LPARAM>(url_string.c_str())); | 215 reinterpret_cast<LPARAM>(url_string.c_str())); |
| 208 } | 216 } |
| OLD | NEW |