| 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 11 matching lines...) Expand all Loading... |
| 22 #include "webkit/glue/weburlrequest.h" | 22 #include "webkit/glue/weburlrequest.h" |
| 23 #include "webkit/glue/webkit_glue.h" | 23 #include "webkit/glue/webkit_glue.h" |
| 24 #include "webkit/glue/webview.h" | 24 #include "webkit/glue/webview.h" |
| 25 #include "webkit/glue/plugins/plugin_list.h" | 25 #include "webkit/glue/plugins/plugin_list.h" |
| 26 #include "webkit/glue/window_open_disposition.h" | 26 #include "webkit/glue/window_open_disposition.h" |
| 27 #include "webkit/tools/test_shell/test_navigation_controller.h" | 27 #include "webkit/tools/test_shell/test_navigation_controller.h" |
| 28 #include "webkit/tools/test_shell/test_shell.h" | 28 #include "webkit/tools/test_shell/test_shell.h" |
| 29 | 29 |
| 30 #if defined(OS_WIN) | 30 #if defined(OS_WIN) |
| 31 // TODO(port): make these files work everywhere. | 31 // TODO(port): make these files work everywhere. |
| 32 #include "base/gfx/gdi_util.h" |
| 32 #include "webkit/glue/plugins/webplugin_delegate_impl.h" | 33 #include "webkit/glue/plugins/webplugin_delegate_impl.h" |
| 33 #include "webkit/tools/test_shell/drag_delegate.h" | 34 #include "webkit/tools/test_shell/drag_delegate.h" |
| 34 #include "webkit/tools/test_shell/drop_delegate.h" | 35 #include "webkit/tools/test_shell/drop_delegate.h" |
| 35 #endif | 36 #endif |
| 36 | 37 |
| 37 namespace { | 38 namespace { |
| 38 | 39 |
| 39 // WebNavigationType debugging strings taken from PolicyDelegate.mm. | 40 // WebNavigationType debugging strings taken from PolicyDelegate.mm. |
| 40 const char* kLinkClickedString = "link clicked"; | 41 const char* kLinkClickedString = "link clicked"; |
| 41 const char* kFormSubmittedString = "form submitted"; | 42 const char* kFormSubmittedString = "form submitted"; |
| (...skipping 647 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 689 | 690 |
| 690 void TestWebViewDelegate::Blur(WebWidget* webwidget) { | 691 void TestWebViewDelegate::Blur(WebWidget* webwidget) { |
| 691 if (WebWidgetHost* host = GetHostForWidget(webwidget)) | 692 if (WebWidgetHost* host = GetHostForWidget(webwidget)) |
| 692 shell_->SetFocus(host, false); | 693 shell_->SetFocus(host, false); |
| 693 } | 694 } |
| 694 | 695 |
| 695 | 696 |
| 696 void TestWebViewDelegate::DidMove(WebWidget* webwidget, | 697 void TestWebViewDelegate::DidMove(WebWidget* webwidget, |
| 697 const WebPluginGeometry& move) { | 698 const WebPluginGeometry& move) { |
| 698 #if defined(OS_WIN) | 699 #if defined(OS_WIN) |
| 700 HRGN hrgn = ::CreateRectRgn(move.clip_rect.x(), |
| 701 move.clip_rect.y(), |
| 702 move.clip_rect.right(), |
| 703 move.clip_rect.bottom()); |
| 704 gfx::SubtractRectanglesFromRegion(hrgn, move.cutout_rects); |
| 705 |
| 706 // Note: System will own the hrgn after we call SetWindowRgn, |
| 707 // so we don't need to call DeleteObject(hrgn) |
| 708 ::SetWindowRgn(move.window, hrgn, FALSE); |
| 709 |
| 710 unsigned long flags = 0; |
| 711 if (move.visible) |
| 712 flags |= SWP_SHOWWINDOW; |
| 713 else |
| 714 flags |= SWP_HIDEWINDOW; |
| 715 |
| 716 ::SetWindowPos(move.window, |
| 717 NULL, |
| 718 move.window_rect.x(), |
| 719 move.window_rect.y(), |
| 720 move.window_rect.width(), |
| 721 move.window_rect.height(), |
| 722 flags); |
| 723 |
| 724 #endif |
| 699 // TODO(port): add me once plugins work. | 725 // TODO(port): add me once plugins work. |
| 700 WebPluginDelegateImpl::MoveWindow( | |
| 701 move.window, move.window_rect, move.clip_rect, move.cutout_rects, | |
| 702 move.visible); | |
| 703 #endif | |
| 704 } | 726 } |
| 705 | 727 |
| 706 bool TestWebViewDelegate::IsHidden() { | 728 bool TestWebViewDelegate::IsHidden() { |
| 707 return false; | 729 return false; |
| 708 } | 730 } |
| 709 | 731 |
| 710 void TestWebViewDelegate::RegisterDragDrop() { | 732 void TestWebViewDelegate::RegisterDragDrop() { |
| 711 #if defined(OS_WIN) | 733 #if defined(OS_WIN) |
| 712 // TODO(port): add me once drag and drop works. | 734 // TODO(port): add me once drag and drop works. |
| 713 DCHECK(!drop_delegate_); | 735 DCHECK(!drop_delegate_); |
| (...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 825 else | 847 else |
| 826 return L"main frame"; | 848 return L"main frame"; |
| 827 } else { | 849 } else { |
| 828 if (name.length()) | 850 if (name.length()) |
| 829 return L"frame \"" + name + L"\""; | 851 return L"frame \"" + name + L"\""; |
| 830 else | 852 else |
| 831 return L"frame (anonymous)"; | 853 return L"frame (anonymous)"; |
| 832 } | 854 } |
| 833 } | 855 } |
| 834 | 856 |
| OLD | NEW |