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/Source/WebKit/chromium/public/WebCursorInfo.h" | 10 #include "third_party/WebKit/Source/WebKit/chromium/public/WebCursorInfo.h" |
11 #include "third_party/WebKit/Source/WebKit/chromium/public/WebPopupMenu.h" | 11 #include "third_party/WebKit/Source/WebKit/chromium/public/WebPopupMenu.h" |
12 #include "third_party/WebKit/Source/WebKit/chromium/public/WebView.h" | 12 #include "third_party/WebKit/Source/WebKit/chromium/public/WebView.h" |
13 #include "webkit/glue/webcursor.h" | 13 #include "webkit/glue/webcursor.h" |
14 #include "webkit/glue/webmenurunner_mac.h" | 14 #include "webkit/glue/webmenurunner_mac.h" |
15 #include "webkit/plugins/npapi/plugin_list.h" | 15 #include "webkit/plugins/npapi/plugin_list.h" |
16 #include "webkit/plugins/npapi/webplugin_delegate_impl.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::npapi::WebPluginDelegateImpl; |
19 using WebKit::WebCursorInfo; | 20 using WebKit::WebCursorInfo; |
20 using WebKit::WebNavigationPolicy; | 21 using WebKit::WebNavigationPolicy; |
21 using WebKit::WebPopupMenu; | 22 using WebKit::WebPopupMenu; |
22 using WebKit::WebPopupMenuInfo; | 23 using WebKit::WebPopupMenuInfo; |
23 using WebKit::WebRect; | 24 using WebKit::WebRect; |
24 using WebKit::WebWidget; | 25 using WebKit::WebWidget; |
25 | 26 |
26 // WebViewClient -------------------------------------------------------------- | 27 // WebViewClient -------------------------------------------------------------- |
27 | 28 |
28 WebWidget* TestWebViewDelegate::createPopupMenu( | 29 WebWidget* TestWebViewDelegate::createPopupMenu( |
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
169 // WebPluginPageDelegate ------------------------------------------------------ | 170 // WebPluginPageDelegate ------------------------------------------------------ |
170 | 171 |
171 webkit::npapi::WebPluginDelegate* TestWebViewDelegate::CreatePluginDelegate( | 172 webkit::npapi::WebPluginDelegate* TestWebViewDelegate::CreatePluginDelegate( |
172 const FilePath& path, | 173 const FilePath& path, |
173 const std::string& mime_type) { | 174 const std::string& mime_type) { |
174 WebWidgetHost *host = GetWidgetHost(); | 175 WebWidgetHost *host = GetWidgetHost(); |
175 if (!host) | 176 if (!host) |
176 return NULL; | 177 return NULL; |
177 | 178 |
178 gfx::PluginWindowHandle containing_view = NULL; | 179 gfx::PluginWindowHandle containing_view = NULL; |
179 return webkit::npapi::WebPluginDelegateImpl::Create( | 180 WebPluginDelegateImpl* delegate = |
180 path, mime_type, containing_view); | 181 WebPluginDelegateImpl::Create(path, mime_type, containing_view); |
| 182 if (delegate) |
| 183 delegate->SetNoBufferContext(); |
| 184 return delegate; |
181 } | 185 } |
182 | 186 |
183 void TestWebViewDelegate::CreatedPluginWindow( | 187 void TestWebViewDelegate::CreatedPluginWindow( |
184 gfx::PluginWindowHandle handle) { | 188 gfx::PluginWindowHandle handle) { |
185 } | 189 } |
186 | 190 |
187 void TestWebViewDelegate::WillDestroyPluginWindow( | 191 void TestWebViewDelegate::WillDestroyPluginWindow( |
188 gfx::PluginWindowHandle handle) { | 192 gfx::PluginWindowHandle handle) { |
189 } | 193 } |
190 | 194 |
(...skipping 24 matching lines...) Expand all Loading... |
215 void TestWebViewDelegate::SetPageTitle(const std::wstring& title) { | 219 void TestWebViewDelegate::SetPageTitle(const std::wstring& title) { |
216 [[shell_->webViewHost()->view_handle() window] | 220 [[shell_->webViewHost()->view_handle() window] |
217 setTitle:[NSString stringWithUTF8String:WideToUTF8(title).c_str()]]; | 221 setTitle:[NSString stringWithUTF8String:WideToUTF8(title).c_str()]]; |
218 } | 222 } |
219 | 223 |
220 void TestWebViewDelegate::SetAddressBarURL(const GURL& url) { | 224 void TestWebViewDelegate::SetAddressBarURL(const GURL& url) { |
221 const char* frameURL = url.spec().c_str(); | 225 const char* frameURL = url.spec().c_str(); |
222 NSString *address = [NSString stringWithUTF8String:frameURL]; | 226 NSString *address = [NSString stringWithUTF8String:frameURL]; |
223 [shell_->editWnd() setStringValue:address]; | 227 [shell_->editWnd() setStringValue:address]; |
224 } | 228 } |
OLD | NEW |