| OLD | NEW |
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-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 // This file contains the implementation of TestWebViewDelegate, which serves | 5 // This file contains the implementation of TestWebViewDelegate, which serves |
| 6 // as the WebViewDelegate for the TestShellWebHost. The host is expected to | 6 // as the WebViewDelegate for the TestShellWebHost. The host is expected to |
| 7 // have initialized a MessageLoop before these methods are called. | 7 // have initialized a MessageLoop before these methods are called. |
| 8 | 8 |
| 9 #include "webkit/tools/test_shell/test_webview_delegate.h" | 9 #include "webkit/tools/test_shell/test_webview_delegate.h" |
| 10 | 10 |
| (...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 122 | 122 |
| 123 for (WindowList::const_iterator i = wl->begin(); i != wl->end(); ++i) | 123 for (WindowList::const_iterator i = wl->begin(); i != wl->end(); ++i) |
| 124 EnableWindow(*i, TRUE); | 124 EnableWindow(*i, TRUE); |
| 125 } | 125 } |
| 126 | 126 |
| 127 // WebPluginPageDelegate ------------------------------------------------------ | 127 // WebPluginPageDelegate ------------------------------------------------------ |
| 128 | 128 |
| 129 webkit_glue::WebPluginDelegate* TestWebViewDelegate::CreatePluginDelegate( | 129 webkit_glue::WebPluginDelegate* TestWebViewDelegate::CreatePluginDelegate( |
| 130 const GURL& url, | 130 const GURL& url, |
| 131 const std::string& mime_type, | 131 const std::string& mime_type, |
| 132 const std::string& clsid, | |
| 133 std::string* actual_mime_type) { | 132 std::string* actual_mime_type) { |
| 134 HWND hwnd = shell_->webViewHost()->view_handle(); | 133 HWND hwnd = shell_->webViewHost()->view_handle(); |
| 135 if (!hwnd) | 134 if (!hwnd) |
| 136 return NULL; | 135 return NULL; |
| 137 | 136 |
| 138 bool allow_wildcard = true; | 137 bool allow_wildcard = true; |
| 139 WebPluginInfo info; | 138 WebPluginInfo info; |
| 140 if (!NPAPI::PluginList::Singleton()->GetPluginInfo(url, mime_type, clsid, | 139 if (!NPAPI::PluginList::Singleton()->GetPluginInfo( |
| 141 allow_wildcard, &info, | 140 url, mime_type, allow_wildcard, &info, actual_mime_type)) { |
| 142 actual_mime_type)) | |
| 143 return NULL; | 141 return NULL; |
| 142 } |
| 144 | 143 |
| 145 if (actual_mime_type && !actual_mime_type->empty()) | 144 if (actual_mime_type && !actual_mime_type->empty()) |
| 146 return WebPluginDelegateImpl::Create(info.path, *actual_mime_type, hwnd); | 145 return WebPluginDelegateImpl::Create(info.path, *actual_mime_type, hwnd); |
| 147 else | 146 else |
| 148 return WebPluginDelegateImpl::Create(info.path, mime_type, hwnd); | 147 return WebPluginDelegateImpl::Create(info.path, mime_type, hwnd); |
| 149 } | 148 } |
| 150 | 149 |
| 151 void TestWebViewDelegate::CreatedPluginWindow( | 150 void TestWebViewDelegate::CreatedPluginWindow( |
| 152 gfx::PluginWindowHandle handle) { | 151 gfx::PluginWindowHandle handle) { |
| 153 // ignored | 152 // ignored |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 200 | 199 |
| 201 void TestWebViewDelegate::SetPageTitle(const std::wstring& title) { | 200 void TestWebViewDelegate::SetPageTitle(const std::wstring& title) { |
| 202 // The Windows test shell, pre-refactoring, ignored this. *shrug* | 201 // The Windows test shell, pre-refactoring, ignored this. *shrug* |
| 203 } | 202 } |
| 204 | 203 |
| 205 void TestWebViewDelegate::SetAddressBarURL(const GURL& url) { | 204 void TestWebViewDelegate::SetAddressBarURL(const GURL& url) { |
| 206 std::wstring url_string = UTF8ToWide(url.spec()); | 205 std::wstring url_string = UTF8ToWide(url.spec()); |
| 207 SendMessage(shell_->editWnd(), WM_SETTEXT, 0, | 206 SendMessage(shell_->editWnd(), WM_SETTEXT, 0, |
| 208 reinterpret_cast<LPARAM>(url_string.c_str())); | 207 reinterpret_cast<LPARAM>(url_string.c_str())); |
| 209 } | 208 } |
| OLD | NEW |