| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/debug/trace_event.h" | 15 #include "base/debug/trace_event.h" |
| 16 #include "base/message_loop.h" | 16 #include "base/message_loop.h" |
| 17 #include "base/utf_string_conversions.h" | 17 #include "base/utf_string_conversions.h" |
| 18 #include "gfx/native_widget_types.h" | 18 #include "gfx/native_widget_types.h" |
| 19 #include "gfx/gdi_util.h" | 19 #include "gfx/gdi_util.h" |
| 20 #include "gfx/point.h" | 20 #include "gfx/point.h" |
| 21 #include "net/base/net_errors.h" | 21 #include "net/base/net_errors.h" |
| 22 #include "third_party/WebKit/WebKit/chromium/public/WebCursorInfo.h" | 22 #include "third_party/WebKit/WebKit/chromium/public/WebCursorInfo.h" |
| 23 #include "third_party/WebKit/WebKit/chromium/public/WebFrame.h" | 23 #include "third_party/WebKit/WebKit/chromium/public/WebFrame.h" |
| 24 #include "third_party/WebKit/WebKit/chromium/public/WebRect.h" | 24 #include "third_party/WebKit/WebKit/chromium/public/WebRect.h" |
| 25 #include "third_party/WebKit/WebKit/chromium/public/WebView.h" | 25 #include "third_party/WebKit/WebKit/chromium/public/WebView.h" |
| 26 #include "webkit/glue/plugins/webplugin.h" | |
| 27 #include "webkit/glue/webdropdata.h" | 26 #include "webkit/glue/webdropdata.h" |
| 28 #include "webkit/glue/webpreferences.h" | 27 #include "webkit/glue/webpreferences.h" |
| 29 #include "webkit/glue/webkit_glue.h" | 28 #include "webkit/glue/webkit_glue.h" |
| 30 #include "webkit/glue/plugins/plugin_list.h" | |
| 31 #include "webkit/glue/plugins/webplugin_delegate_impl.h" | |
| 32 #include "webkit/glue/window_open_disposition.h" | 29 #include "webkit/glue/window_open_disposition.h" |
| 30 #include "webkit/plugins/npapi/webplugin.h" |
| 31 #include "webkit/plugins/npapi/plugin_list.h" |
| 32 #include "webkit/plugins/npapi/webplugin_delegate_impl.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::WebPopupMenuInfo; |
| 41 using WebKit::WebRect; | 41 using WebKit::WebRect; |
| 42 using WebKit::WebWidget; | 42 using WebKit::WebWidget; |
| (...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 126 | 126 |
| 127 shell_->set_is_modal(true); | 127 shell_->set_is_modal(true); |
| 128 MessageLoop::current()->Run(); | 128 MessageLoop::current()->Run(); |
| 129 | 129 |
| 130 for (WindowList::const_iterator i = wl->begin(); i != wl->end(); ++i) | 130 for (WindowList::const_iterator i = wl->begin(); i != wl->end(); ++i) |
| 131 EnableWindow(*i, TRUE); | 131 EnableWindow(*i, TRUE); |
| 132 } | 132 } |
| 133 | 133 |
| 134 // WebPluginPageDelegate ------------------------------------------------------ | 134 // WebPluginPageDelegate ------------------------------------------------------ |
| 135 | 135 |
| 136 webkit_glue::WebPluginDelegate* TestWebViewDelegate::CreatePluginDelegate( | 136 webkit::npapi::WebPluginDelegate* TestWebViewDelegate::CreatePluginDelegate( |
| 137 const FilePath& path, | 137 const FilePath& path, |
| 138 const std::string& mime_type) { | 138 const std::string& mime_type) { |
| 139 HWND hwnd = shell_->webViewHost()->view_handle(); | 139 HWND hwnd = shell_->webViewHost()->view_handle(); |
| 140 if (!hwnd) | 140 if (!hwnd) |
| 141 return NULL; | 141 return NULL; |
| 142 | 142 |
| 143 return WebPluginDelegateImpl::Create(path, mime_type, hwnd); | 143 return webkit::npapi::WebPluginDelegateImpl::Create(path, mime_type, hwnd); |
| 144 } | 144 } |
| 145 | 145 |
| 146 void TestWebViewDelegate::CreatedPluginWindow( | 146 void TestWebViewDelegate::CreatedPluginWindow( |
| 147 gfx::PluginWindowHandle handle) { | 147 gfx::PluginWindowHandle handle) { |
| 148 // ignored | 148 // ignored |
| 149 } | 149 } |
| 150 | 150 |
| 151 void TestWebViewDelegate::WillDestroyPluginWindow( | 151 void TestWebViewDelegate::WillDestroyPluginWindow( |
| 152 gfx::PluginWindowHandle handle) { | 152 gfx::PluginWindowHandle handle) { |
| 153 // ignored | 153 // ignored |
| 154 } | 154 } |
| 155 | 155 |
| 156 void TestWebViewDelegate::DidMovePlugin( | 156 void TestWebViewDelegate::DidMovePlugin( |
| 157 const webkit_glue::WebPluginGeometry& move) { | 157 const webkit::npapi::WebPluginGeometry& move) { |
| 158 unsigned long flags = 0; | 158 unsigned long flags = 0; |
| 159 | 159 |
| 160 if (move.rects_valid) { | 160 if (move.rects_valid) { |
| 161 HRGN hrgn = ::CreateRectRgn(move.clip_rect.x(), | 161 HRGN hrgn = ::CreateRectRgn(move.clip_rect.x(), |
| 162 move.clip_rect.y(), | 162 move.clip_rect.y(), |
| 163 move.clip_rect.right(), | 163 move.clip_rect.right(), |
| 164 move.clip_rect.bottom()); | 164 move.clip_rect.bottom()); |
| 165 gfx::SubtractRectanglesFromRegion(hrgn, move.cutout_rects); | 165 gfx::SubtractRectanglesFromRegion(hrgn, move.cutout_rects); |
| 166 | 166 |
| 167 // Note: System will own the hrgn after we call SetWindowRgn, | 167 // Note: System will own the hrgn after we call SetWindowRgn, |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 199 | 199 |
| 200 void TestWebViewDelegate::SetPageTitle(const std::wstring& title) { | 200 void TestWebViewDelegate::SetPageTitle(const std::wstring& title) { |
| 201 // The Windows test shell, pre-refactoring, ignored this. *shrug* | 201 // The Windows test shell, pre-refactoring, ignored this. *shrug* |
| 202 } | 202 } |
| 203 | 203 |
| 204 void TestWebViewDelegate::SetAddressBarURL(const GURL& url) { | 204 void TestWebViewDelegate::SetAddressBarURL(const GURL& url) { |
| 205 std::wstring url_string = UTF8ToWide(url.spec()); | 205 std::wstring url_string = UTF8ToWide(url.spec()); |
| 206 SendMessage(shell_->editWnd(), WM_SETTEXT, 0, | 206 SendMessage(shell_->editWnd(), WM_SETTEXT, 0, |
| 207 reinterpret_cast<LPARAM>(url_string.c_str())); | 207 reinterpret_cast<LPARAM>(url_string.c_str())); |
| 208 } | 208 } |
| OLD | NEW |