| 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 "config.h" | 9 #include "config.h" |
| 10 | 10 |
| 11 #include "webkit/tools/test_shell/test_webview_delegate.h" | 11 #include "webkit/tools/test_shell/test_webview_delegate.h" |
| 12 | 12 |
| 13 #include "base/file_util.h" | 13 #include "base/file_util.h" |
| 14 #include "base/gfx/point.h" | 14 #include "base/gfx/point.h" |
| 15 #include "base/gfx/native_widget_types.h" | 15 #include "base/gfx/native_widget_types.h" |
| 16 #include "base/message_loop.h" | 16 #include "base/message_loop.h" |
| 17 #include "base/string_util.h" | 17 #include "base/string_util.h" |
| 18 #include "base/trace_event.h" | 18 #include "base/trace_event.h" |
| 19 #include "net/base/net_errors.h" | 19 #include "net/base/net_errors.h" |
| 20 #include "third_party/WebKit/WebKit/chromium/public/WebKit.h" | 20 #include "third_party/WebKit/WebKit/chromium/public/WebKit.h" |
| 21 #include "third_party/WebKit/WebKit/chromium/public/WebScreenInfo.h" |
| 21 #include "webkit/glue/webdatasource.h" | 22 #include "webkit/glue/webdatasource.h" |
| 22 #include "webkit/glue/webdropdata.h" | 23 #include "webkit/glue/webdropdata.h" |
| 23 #include "webkit/glue/weberror.h" | 24 #include "webkit/glue/weberror.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/weburlrequest.h" | 27 #include "webkit/glue/weburlrequest.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/test_navigation_controller.h" | 33 #include "webkit/tools/test_shell/test_navigation_controller.h" |
| 33 #include "webkit/tools/test_shell/test_shell.h" | 34 #include "webkit/tools/test_shell/test_shell.h" |
| 34 #include "webkit/tools/test_shell/test_webworker_helper.h" | 35 #include "webkit/tools/test_shell/test_webworker_helper.h" |
| 35 | 36 |
| 36 #if defined(OS_WIN) | 37 #if defined(OS_WIN) |
| 37 // TODO(port): make these files work everywhere. | 38 // TODO(port): make these files work everywhere. |
| 38 #include "webkit/tools/test_shell/drag_delegate.h" | 39 #include "webkit/tools/test_shell/drag_delegate.h" |
| 39 #include "webkit/tools/test_shell/drop_delegate.h" | 40 #include "webkit/tools/test_shell/drop_delegate.h" |
| 40 #endif | 41 #endif |
| 41 | 42 |
| 43 using WebKit::WebScreenInfo; |
| 44 |
| 42 namespace { | 45 namespace { |
| 43 | 46 |
| 44 // WebNavigationType debugging strings taken from PolicyDelegate.mm. | 47 // WebNavigationType debugging strings taken from PolicyDelegate.mm. |
| 45 const char* kLinkClickedString = "link clicked"; | 48 const char* kLinkClickedString = "link clicked"; |
| 46 const char* kFormSubmittedString = "form submitted"; | 49 const char* kFormSubmittedString = "form submitted"; |
| 47 const char* kBackForwardString = "back/forward"; | 50 const char* kBackForwardString = "back/forward"; |
| 48 const char* kReloadString = "reload"; | 51 const char* kReloadString = "reload"; |
| 49 const char* kFormResubmittedString = "form resubmitted"; | 52 const char* kFormResubmittedString = "form resubmitted"; |
| 50 const char* kOtherString = "other"; | 53 const char* kOtherString = "other"; |
| 51 const char* kIllegalString = "illegal value"; | 54 const char* kIllegalString = "illegal value"; |
| (...skipping 665 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 717 void TestWebViewDelegate::Focus(WebWidget* webwidget) { | 720 void TestWebViewDelegate::Focus(WebWidget* webwidget) { |
| 718 if (WebWidgetHost* host = GetHostForWidget(webwidget)) | 721 if (WebWidgetHost* host = GetHostForWidget(webwidget)) |
| 719 shell_->SetFocus(host, true); | 722 shell_->SetFocus(host, true); |
| 720 } | 723 } |
| 721 | 724 |
| 722 void TestWebViewDelegate::Blur(WebWidget* webwidget) { | 725 void TestWebViewDelegate::Blur(WebWidget* webwidget) { |
| 723 if (WebWidgetHost* host = GetHostForWidget(webwidget)) | 726 if (WebWidgetHost* host = GetHostForWidget(webwidget)) |
| 724 shell_->SetFocus(host, false); | 727 shell_->SetFocus(host, false); |
| 725 } | 728 } |
| 726 | 729 |
| 727 bool TestWebViewDelegate::IsHidden() { | 730 bool TestWebViewDelegate::IsHidden(WebWidget* webwidget) { |
| 728 return false; | 731 return false; |
| 729 } | 732 } |
| 730 | 733 |
| 734 WebScreenInfo TestWebViewDelegate::GetScreenInfo(WebWidget* webwidget) { |
| 735 if (WebWidgetHost* host = GetHostForWidget(webwidget)) |
| 736 return host->GetScreenInfo(); |
| 737 |
| 738 return WebScreenInfo(); |
| 739 } |
| 740 |
| 731 void TestWebViewDelegate::RegisterDragDrop() { | 741 void TestWebViewDelegate::RegisterDragDrop() { |
| 732 #if defined(OS_WIN) | 742 #if defined(OS_WIN) |
| 733 // TODO(port): add me once drag and drop works. | 743 // TODO(port): add me once drag and drop works. |
| 734 DCHECK(!drop_delegate_); | 744 DCHECK(!drop_delegate_); |
| 735 drop_delegate_ = new TestDropDelegate(shell_->webViewWnd(), | 745 drop_delegate_ = new TestDropDelegate(shell_->webViewWnd(), |
| 736 shell_->webView()); | 746 shell_->webView()); |
| 737 #endif | 747 #endif |
| 738 } | 748 } |
| 739 | 749 |
| 740 // Private methods ----------------------------------------------------------- | 750 // Private methods ----------------------------------------------------------- |
| (...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 853 } | 863 } |
| 854 } | 864 } |
| 855 | 865 |
| 856 WebWorker* TestWebViewDelegate::CreateWebWorker(WebWorkerClient* client) { | 866 WebWorker* TestWebViewDelegate::CreateWebWorker(WebWorkerClient* client) { |
| 857 #if ENABLE(WORKERS) | 867 #if ENABLE(WORKERS) |
| 858 return TestWebWorkerHelper::CreateWebWorker(client); | 868 return TestWebWorkerHelper::CreateWebWorker(client); |
| 859 #else | 869 #else |
| 860 return NULL; | 870 return NULL; |
| 861 #endif | 871 #endif |
| 862 } | 872 } |
| OLD | NEW |