Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(231)

Side by Side Diff: webkit/tools/test_shell/test_webview_delegate_win.cc

Issue 15088: Add support for custom cursors set by windowless plugins. Windowless plugins... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « webkit/tools/test_shell/test_webview_delegate_gtk.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 18 matching lines...) Expand all
29 #include "webkit/glue/plugins/webplugin_delegate_impl.h" 29 #include "webkit/glue/plugins/webplugin_delegate_impl.h"
30 #include "webkit/glue/window_open_disposition.h" 30 #include "webkit/glue/window_open_disposition.h"
31 #include "webkit/tools/test_shell/drag_delegate.h" 31 #include "webkit/tools/test_shell/drag_delegate.h"
32 #include "webkit/tools/test_shell/drop_delegate.h" 32 #include "webkit/tools/test_shell/drop_delegate.h"
33 #include "webkit/tools/test_shell/test_navigation_controller.h" 33 #include "webkit/tools/test_shell/test_navigation_controller.h"
34 #include "webkit/tools/test_shell/test_shell.h" 34 #include "webkit/tools/test_shell/test_shell.h"
35 35
36 // WebViewDelegate ----------------------------------------------------------- 36 // WebViewDelegate -----------------------------------------------------------
37 37
38 TestWebViewDelegate::~TestWebViewDelegate() { 38 TestWebViewDelegate::~TestWebViewDelegate() {
39 if (custom_cursor_)
40 DestroyIcon(custom_cursor_);
41 RevokeDragDrop(shell_->webViewWnd()); 39 RevokeDragDrop(shell_->webViewWnd());
42 } 40 }
43 41
44 WebPluginDelegate* TestWebViewDelegate::CreatePluginDelegate( 42 WebPluginDelegate* TestWebViewDelegate::CreatePluginDelegate(
45 WebView* webview, 43 WebView* webview,
46 const GURL& url, 44 const GURL& url,
47 const std::string& mime_type, 45 const std::string& mime_type,
48 const std::string& clsid, 46 const std::string& clsid,
49 std::string* actual_mime_type) { 47 std::string* actual_mime_type) {
50 HWND hwnd = GetContainingView(webview); 48 HWND hwnd = GetContainingView(webview);
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
82 if (webwidget == shell_->webView()) { 80 if (webwidget == shell_->webView()) {
83 PostMessage(shell_->mainWnd(), WM_CLOSE, 0, 0); 81 PostMessage(shell_->mainWnd(), WM_CLOSE, 0, 0);
84 } else if (webwidget == shell_->popup()) { 82 } else if (webwidget == shell_->popup()) {
85 shell_->ClosePopup(); 83 shell_->ClosePopup();
86 } 84 }
87 } 85 }
88 86
89 void TestWebViewDelegate::SetCursor(WebWidget* webwidget, 87 void TestWebViewDelegate::SetCursor(WebWidget* webwidget,
90 const WebCursor& cursor) { 88 const WebCursor& cursor) {
91 if (WebWidgetHost* host = GetHostForWidget(webwidget)) { 89 if (WebWidgetHost* host = GetHostForWidget(webwidget)) {
92 if (custom_cursor_) { 90 current_cursor_ = cursor;
93 DestroyIcon(custom_cursor_); 91 HINSTANCE mod_handle = GetModuleHandle(NULL);
94 custom_cursor_ = NULL; 92 host->SetCursor(current_cursor_.GetCursor(mod_handle));
95 }
96 if (cursor.IsCustom()) {
97 custom_cursor_ = cursor.GetCustomCursor();
98 host->SetCursor(custom_cursor_);
99 } else {
100 HINSTANCE mod_handle = GetModuleHandle(NULL);
101 host->SetCursor(cursor.GetCursor(mod_handle));
102 }
103 } 93 }
104 } 94 }
105 95
106 void TestWebViewDelegate::GetWindowRect(WebWidget* webwidget, 96 void TestWebViewDelegate::GetWindowRect(WebWidget* webwidget,
107 gfx::Rect* out_rect) { 97 gfx::Rect* out_rect) {
108 if (WebWidgetHost* host = GetHostForWidget(webwidget)) { 98 if (WebWidgetHost* host = GetHostForWidget(webwidget)) {
109 RECT rect; 99 RECT rect;
110 ::GetWindowRect(host->view_handle(), &rect); 100 ::GetWindowRect(host->view_handle(), &rect);
111 *out_rect = gfx::Rect(rect); 101 *out_rect = gfx::Rect(rect);
112 } 102 }
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
163 void TestWebViewDelegate::SetPageTitle(const std::wstring& title) { 153 void TestWebViewDelegate::SetPageTitle(const std::wstring& title) {
164 // The Windows test shell, pre-refactoring, ignored this. *shrug* 154 // The Windows test shell, pre-refactoring, ignored this. *shrug*
165 } 155 }
166 156
167 void TestWebViewDelegate::SetAddressBarURL(const GURL& url) { 157 void TestWebViewDelegate::SetAddressBarURL(const GURL& url) {
168 std::wstring url_string = UTF8ToWide(url.spec()); 158 std::wstring url_string = UTF8ToWide(url.spec());
169 SendMessage(shell_->editWnd(), WM_SETTEXT, 0, 159 SendMessage(shell_->editWnd(), WM_SETTEXT, 0,
170 reinterpret_cast<LPARAM>(url_string.c_str())); 160 reinterpret_cast<LPARAM>(url_string.c_str()));
171 } 161 }
172 162
OLDNEW
« no previous file with comments | « webkit/tools/test_shell/test_webview_delegate_gtk.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698