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/sys_string_conversions.h" | 8 #include "base/sys_string_conversions.h" |
9 #include "base/utf_string_conversions.h" | 9 #include "base/utf_string_conversions.h" |
10 #include "third_party/WebKit/WebKit/chromium/public/WebCursorInfo.h" | 10 #include "third_party/WebKit/WebKit/chromium/public/WebCursorInfo.h" |
11 #include "third_party/WebKit/WebKit/chromium/public/WebPopupMenu.h" | 11 #include "third_party/WebKit/WebKit/chromium/public/WebPopupMenu.h" |
12 #include "third_party/WebKit/WebKit/chromium/public/WebView.h" | 12 #include "third_party/WebKit/WebKit/chromium/public/WebView.h" |
13 #include "webkit/glue/webcursor.h" | 13 #include "webkit/glue/webcursor.h" |
| 14 #include "webkit/glue/plugins/plugin_list.h" |
| 15 #include "webkit/glue/plugins/webplugin_delegate_impl.h" |
14 #include "webkit/glue/webmenurunner_mac.h" | 16 #include "webkit/glue/webmenurunner_mac.h" |
15 #include "webkit/plugins/npapi/plugin_list.h" | |
16 #include "webkit/plugins/npapi/webplugin_delegate_impl.h" | |
17 #include "webkit/tools/test_shell/test_shell.h" | 17 #include "webkit/tools/test_shell/test_shell.h" |
18 | 18 |
19 using WebKit::WebCursorInfo; | 19 using WebKit::WebCursorInfo; |
20 using WebKit::WebNavigationPolicy; | 20 using WebKit::WebNavigationPolicy; |
21 using WebKit::WebPopupMenu; | 21 using WebKit::WebPopupMenu; |
22 using WebKit::WebPopupMenuInfo; | 22 using WebKit::WebPopupMenuInfo; |
23 using WebKit::WebRect; | 23 using WebKit::WebRect; |
24 using WebKit::WebWidget; | 24 using WebKit::WebWidget; |
25 | 25 |
26 // WebViewClient -------------------------------------------------------------- | 26 // WebViewClient -------------------------------------------------------------- |
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
161 } | 161 } |
162 return gfx::Rect(NSRectToCGRect(resize_rect)); | 162 return gfx::Rect(NSRectToCGRect(resize_rect)); |
163 } | 163 } |
164 | 164 |
165 void TestWebViewDelegate::runModal() { | 165 void TestWebViewDelegate::runModal() { |
166 NOTIMPLEMENTED(); | 166 NOTIMPLEMENTED(); |
167 } | 167 } |
168 | 168 |
169 // WebPluginPageDelegate ------------------------------------------------------ | 169 // WebPluginPageDelegate ------------------------------------------------------ |
170 | 170 |
171 webkit::npapi::WebPluginDelegate* TestWebViewDelegate::CreatePluginDelegate( | 171 webkit_glue::WebPluginDelegate* TestWebViewDelegate::CreatePluginDelegate( |
172 const FilePath& path, | 172 const FilePath& path, |
173 const std::string& mime_type) { | 173 const std::string& mime_type) { |
174 WebWidgetHost *host = GetWidgetHost(); | 174 WebWidgetHost *host = GetWidgetHost(); |
175 if (!host) | 175 if (!host) |
176 return NULL; | 176 return NULL; |
177 | 177 |
178 gfx::PluginWindowHandle containing_view = NULL; | 178 gfx::PluginWindowHandle containing_view = NULL; |
179 return webkit::npapi::WebPluginDelegateImpl::Create( | 179 return WebPluginDelegateImpl::Create(path, mime_type, containing_view); |
180 path, mime_type, containing_view); | |
181 } | 180 } |
182 | 181 |
183 void TestWebViewDelegate::CreatedPluginWindow( | 182 void TestWebViewDelegate::CreatedPluginWindow( |
184 gfx::PluginWindowHandle handle) { | 183 gfx::PluginWindowHandle handle) { |
185 } | 184 } |
186 | 185 |
187 void TestWebViewDelegate::WillDestroyPluginWindow( | 186 void TestWebViewDelegate::WillDestroyPluginWindow( |
188 gfx::PluginWindowHandle handle) { | 187 gfx::PluginWindowHandle handle) { |
189 } | 188 } |
190 | 189 |
191 void TestWebViewDelegate::DidMovePlugin( | 190 void TestWebViewDelegate::DidMovePlugin( |
192 const webkit::npapi::WebPluginGeometry& move) { | 191 const webkit_glue::WebPluginGeometry& move) { |
193 // TODO(port): add me once plugins work. | 192 // TODO(port): add me once plugins work. |
194 } | 193 } |
195 | 194 |
196 // Public methods ------------------------------------------------------------- | 195 // Public methods ------------------------------------------------------------- |
197 | 196 |
198 void TestWebViewDelegate::UpdateSelectionClipboard(bool is_empty_selection) { | 197 void TestWebViewDelegate::UpdateSelectionClipboard(bool is_empty_selection) { |
199 // No selection clipboard on mac, do nothing. | 198 // No selection clipboard on mac, do nothing. |
200 } | 199 } |
201 | 200 |
202 // Private methods ------------------------------------------------------------ | 201 // Private methods ------------------------------------------------------------ |
(...skipping 12 matching lines...) Expand all Loading... |
215 void TestWebViewDelegate::SetPageTitle(const std::wstring& title) { | 214 void TestWebViewDelegate::SetPageTitle(const std::wstring& title) { |
216 [[shell_->webViewHost()->view_handle() window] | 215 [[shell_->webViewHost()->view_handle() window] |
217 setTitle:[NSString stringWithUTF8String:WideToUTF8(title).c_str()]]; | 216 setTitle:[NSString stringWithUTF8String:WideToUTF8(title).c_str()]]; |
218 } | 217 } |
219 | 218 |
220 void TestWebViewDelegate::SetAddressBarURL(const GURL& url) { | 219 void TestWebViewDelegate::SetAddressBarURL(const GURL& url) { |
221 const char* frameURL = url.spec().c_str(); | 220 const char* frameURL = url.spec().c_str(); |
222 NSString *address = [NSString stringWithUTF8String:frameURL]; | 221 NSString *address = [NSString stringWithUTF8String:frameURL]; |
223 [shell_->editWnd() setStringValue:address]; | 222 [shell_->editWnd() setStringValue:address]; |
224 } | 223 } |
OLD | NEW |