| 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 "third_party/WebKit/WebKit/chromium/public/WebCursorInfo.h" | 10 #include "third_party/WebKit/WebKit/chromium/public/WebCursorInfo.h" |
| (...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 164 | 164 |
| 165 // WebPluginPageDelegate ------------------------------------------------------ | 165 // WebPluginPageDelegate ------------------------------------------------------ |
| 166 | 166 |
| 167 webkit_glue::WebPluginDelegate* TestWebViewDelegate::CreatePluginDelegate( | 167 webkit_glue::WebPluginDelegate* TestWebViewDelegate::CreatePluginDelegate( |
| 168 const GURL& url, | 168 const GURL& url, |
| 169 const std::string& mime_type, | 169 const std::string& mime_type, |
| 170 std::string* actual_mime_type) { | 170 std::string* actual_mime_type) { |
| 171 WebWidgetHost *host = GetWidgetHost(); | 171 WebWidgetHost *host = GetWidgetHost(); |
| 172 if (!host) | 172 if (!host) |
| 173 return NULL; | 173 return NULL; |
| 174 gfx::NativeView view = host->view_handle(); | 174 gfx::PluginWindowHandle containing_view = NULL; |
| 175 | 175 |
| 176 bool allow_wildcard = true; | 176 bool allow_wildcard = true; |
| 177 WebPluginInfo info; | 177 WebPluginInfo info; |
| 178 if (!NPAPI::PluginList::Singleton()->GetPluginInfo( | 178 if (!NPAPI::PluginList::Singleton()->GetPluginInfo( |
| 179 url, mime_type, allow_wildcard, &info, actual_mime_type)) { | 179 url, mime_type, allow_wildcard, &info, actual_mime_type)) { |
| 180 return NULL; | 180 return NULL; |
| 181 } | 181 } |
| 182 | 182 |
| 183 if (actual_mime_type && !actual_mime_type->empty()) | 183 if (actual_mime_type && !actual_mime_type->empty()) |
| 184 return WebPluginDelegateImpl::Create(info.path, *actual_mime_type, view); | 184 return WebPluginDelegateImpl::Create(info.path, *actual_mime_type, |
| 185 containing_view); |
| 185 else | 186 else |
| 186 return WebPluginDelegateImpl::Create(info.path, mime_type, view); | 187 return WebPluginDelegateImpl::Create(info.path, mime_type, |
| 188 containing_view); |
| 187 } | 189 } |
| 188 | 190 |
| 189 void TestWebViewDelegate::CreatedPluginWindow( | 191 void TestWebViewDelegate::CreatedPluginWindow( |
| 190 gfx::PluginWindowHandle handle) { | 192 gfx::PluginWindowHandle handle) { |
| 191 } | 193 } |
| 192 | 194 |
| 193 void TestWebViewDelegate::WillDestroyPluginWindow( | 195 void TestWebViewDelegate::WillDestroyPluginWindow( |
| 194 gfx::PluginWindowHandle handle) { | 196 gfx::PluginWindowHandle handle) { |
| 195 } | 197 } |
| 196 | 198 |
| (...skipping 24 matching lines...) Expand all Loading... |
| 221 void TestWebViewDelegate::SetPageTitle(const std::wstring& title) { | 223 void TestWebViewDelegate::SetPageTitle(const std::wstring& title) { |
| 222 [[shell_->webViewHost()->view_handle() window] | 224 [[shell_->webViewHost()->view_handle() window] |
| 223 setTitle:[NSString stringWithUTF8String:WideToUTF8(title).c_str()]]; | 225 setTitle:[NSString stringWithUTF8String:WideToUTF8(title).c_str()]]; |
| 224 } | 226 } |
| 225 | 227 |
| 226 void TestWebViewDelegate::SetAddressBarURL(const GURL& url) { | 228 void TestWebViewDelegate::SetAddressBarURL(const GURL& url) { |
| 227 const char* frameURL = url.spec().c_str(); | 229 const char* frameURL = url.spec().c_str(); |
| 228 NSString *address = [NSString stringWithUTF8String:frameURL]; | 230 NSString *address = [NSString stringWithUTF8String:frameURL]; |
| 229 [shell_->editWnd() setStringValue:address]; | 231 [shell_->editWnd() setStringValue:address]; |
| 230 } | 232 } |
| OLD | NEW |