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" |
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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_glue::WebPluginDelegate* TestWebViewDelegate::CreatePluginDelegate( | 171 webkit_glue::WebPluginDelegate* TestWebViewDelegate::CreatePluginDelegate( |
172 const GURL& url, | 172 const FilePath& path, |
173 const std::string& mime_type, | 173 const std::string& mime_type) { |
174 std::string* actual_mime_type) { | |
175 WebWidgetHost *host = GetWidgetHost(); | 174 WebWidgetHost *host = GetWidgetHost(); |
176 if (!host) | 175 if (!host) |
177 return NULL; | 176 return NULL; |
| 177 |
178 gfx::PluginWindowHandle containing_view = NULL; | 178 gfx::PluginWindowHandle containing_view = NULL; |
179 | 179 return WebPluginDelegateImpl::Create(path, mime_type, containing_view); |
180 bool allow_wildcard = true; | |
181 WebPluginInfo info; | |
182 if (!NPAPI::PluginList::Singleton()->GetPluginInfo( | |
183 url, mime_type, allow_wildcard, &info, actual_mime_type)) { | |
184 return NULL; | |
185 } | |
186 | |
187 if (actual_mime_type && !actual_mime_type->empty()) | |
188 return WebPluginDelegateImpl::Create(info.path, *actual_mime_type, | |
189 containing_view); | |
190 else | |
191 return WebPluginDelegateImpl::Create(info.path, mime_type, | |
192 containing_view); | |
193 } | 180 } |
194 | 181 |
195 void TestWebViewDelegate::CreatedPluginWindow( | 182 void TestWebViewDelegate::CreatedPluginWindow( |
196 gfx::PluginWindowHandle handle) { | 183 gfx::PluginWindowHandle handle) { |
197 } | 184 } |
198 | 185 |
199 void TestWebViewDelegate::WillDestroyPluginWindow( | 186 void TestWebViewDelegate::WillDestroyPluginWindow( |
200 gfx::PluginWindowHandle handle) { | 187 gfx::PluginWindowHandle handle) { |
201 } | 188 } |
202 | 189 |
(...skipping 24 matching lines...) Expand all Loading... |
227 void TestWebViewDelegate::SetPageTitle(const std::wstring& title) { | 214 void TestWebViewDelegate::SetPageTitle(const std::wstring& title) { |
228 [[shell_->webViewHost()->view_handle() window] | 215 [[shell_->webViewHost()->view_handle() window] |
229 setTitle:[NSString stringWithUTF8String:WideToUTF8(title).c_str()]]; | 216 setTitle:[NSString stringWithUTF8String:WideToUTF8(title).c_str()]]; |
230 } | 217 } |
231 | 218 |
232 void TestWebViewDelegate::SetAddressBarURL(const GURL& url) { | 219 void TestWebViewDelegate::SetAddressBarURL(const GURL& url) { |
233 const char* frameURL = url.spec().c_str(); | 220 const char* frameURL = url.spec().c_str(); |
234 NSString *address = [NSString stringWithUTF8String:frameURL]; | 221 NSString *address = [NSString stringWithUTF8String:frameURL]; |
235 [shell_->editWnd() setStringValue:address]; | 222 [shell_->editWnd() setStringValue:address]; |
236 } | 223 } |
OLD | NEW |