OLD | NEW |
1 // Copyright (c) 2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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 #include "webkit/tools/test_shell/test_webview_delegate.h" | 5 #include "webkit/tools/test_shell/test_webview_delegate.h" |
6 | 6 |
7 #import <Cocoa/Cocoa.h> | 7 #import <Cocoa/Cocoa.h> |
8 #include "base/string_util.h" | 8 #include "base/string_util.h" |
9 #include "base/sys_string_conversions.h" | 9 #include "base/sys_string_conversions.h" |
| 10 #include "webkit/api/public/WebCursorInfo.h" |
10 #include "webkit/api/public/WebRect.h" | 11 #include "webkit/api/public/WebRect.h" |
11 #include "webkit/glue/webcursor.h" | 12 #include "webkit/glue/webcursor.h" |
12 #include "webkit/glue/webview.h" | 13 #include "webkit/glue/webview.h" |
13 #include "webkit/glue/plugins/plugin_list.h" | 14 #include "webkit/glue/plugins/plugin_list.h" |
14 #include "webkit/glue/plugins/webplugin_delegate_impl.h" | 15 #include "webkit/glue/plugins/webplugin_delegate_impl.h" |
15 #include "webkit/glue/webmenurunner_mac.h" | 16 #include "webkit/glue/webmenurunner_mac.h" |
16 #include "webkit/tools/test_shell/test_shell.h" | 17 #include "webkit/tools/test_shell/test_shell.h" |
17 | 18 |
| 19 using WebKit::WebCursorInfo; |
18 using WebKit::WebRect; | 20 using WebKit::WebRect; |
19 | 21 |
20 // WebViewDelegate ----------------------------------------------------------- | 22 // WebViewDelegate ----------------------------------------------------------- |
21 | 23 |
22 TestWebViewDelegate::~TestWebViewDelegate() { | 24 TestWebViewDelegate::~TestWebViewDelegate() { |
23 } | 25 } |
24 | 26 |
25 WebPluginDelegate* TestWebViewDelegate::CreatePluginDelegate( | 27 WebPluginDelegate* TestWebViewDelegate::CreatePluginDelegate( |
26 WebView* webview, | 28 WebView* webview, |
27 const GURL& url, | 29 const GURL& url, |
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
116 // period of time after this call returns (cleanup is done after going back | 118 // period of time after this call returns (cleanup is done after going back |
117 // to the event loop), so we should make sure we don't leave it dangling. | 119 // to the event loop), so we should make sure we don't leave it dangling. |
118 [win performClose:nil]; | 120 [win performClose:nil]; |
119 shell_ = NULL; | 121 shell_ = NULL; |
120 } else if (webwidget == shell_->popup()) { | 122 } else if (webwidget == shell_->popup()) { |
121 shell_->ClosePopup(); | 123 shell_->ClosePopup(); |
122 } | 124 } |
123 } | 125 } |
124 | 126 |
125 void TestWebViewDelegate::SetCursor(WebWidget* webwidget, | 127 void TestWebViewDelegate::SetCursor(WebWidget* webwidget, |
126 const WebCursor& cursor) { | 128 const WebCursorInfo& cursor_info) { |
127 NSCursor* ns_cursor = cursor.GetCursor(); | 129 NSCursor* ns_cursor = WebCursor(cursor_info).GetCursor(); |
128 [ns_cursor set]; | 130 [ns_cursor set]; |
129 } | 131 } |
130 | 132 |
131 void TestWebViewDelegate::GetWindowRect(WebWidget* webwidget, | 133 void TestWebViewDelegate::GetWindowRect(WebWidget* webwidget, |
132 WebRect* out_rect) { | 134 WebRect* out_rect) { |
133 DCHECK(out_rect); | 135 DCHECK(out_rect); |
134 if (WebWidgetHost* host = GetHostForWidget(webwidget)) { | 136 if (WebWidgetHost* host = GetHostForWidget(webwidget)) { |
135 NSView *view = host->view_handle(); | 137 NSView *view = host->view_handle(); |
136 NSRect rect = [view frame]; | 138 NSRect rect = [view frame]; |
137 *out_rect = gfx::Rect(NSRectToCGRect(rect)); | 139 *out_rect = gfx::Rect(NSRectToCGRect(rect)); |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
204 void TestWebViewDelegate::SetPageTitle(const std::wstring& title) { | 206 void TestWebViewDelegate::SetPageTitle(const std::wstring& title) { |
205 [[shell_->webViewHost()->view_handle() window] | 207 [[shell_->webViewHost()->view_handle() window] |
206 setTitle:[NSString stringWithUTF8String:WideToUTF8(title).c_str()]]; | 208 setTitle:[NSString stringWithUTF8String:WideToUTF8(title).c_str()]]; |
207 } | 209 } |
208 | 210 |
209 void TestWebViewDelegate::SetAddressBarURL(const GURL& url) { | 211 void TestWebViewDelegate::SetAddressBarURL(const GURL& url) { |
210 const char* frameURL = url.spec().c_str(); | 212 const char* frameURL = url.spec().c_str(); |
211 NSString *address = [NSString stringWithUTF8String:frameURL]; | 213 NSString *address = [NSString stringWithUTF8String:frameURL]; |
212 [shell_->editWnd() setStringValue:address]; | 214 [shell_->editWnd() setStringValue:address]; |
213 } | 215 } |
OLD | NEW |