OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 116 matching lines...) Loading... |
127 shell_->set_is_modal(true); | 127 shell_->set_is_modal(true); |
128 MessageLoop::current()->Run(); | 128 MessageLoop::current()->Run(); |
129 | 129 |
130 for (WindowList::const_iterator i = wl->begin(); i != wl->end(); ++i) | 130 for (WindowList::const_iterator i = wl->begin(); i != wl->end(); ++i) |
131 EnableWindow(*i, TRUE); | 131 EnableWindow(*i, TRUE); |
132 } | 132 } |
133 | 133 |
134 // WebPluginPageDelegate ------------------------------------------------------ | 134 // WebPluginPageDelegate ------------------------------------------------------ |
135 | 135 |
136 webkit_glue::WebPluginDelegate* TestWebViewDelegate::CreatePluginDelegate( | 136 webkit_glue::WebPluginDelegate* TestWebViewDelegate::CreatePluginDelegate( |
137 const GURL& url, | 137 const FilePath& path, |
138 const std::string& mime_type, | 138 const std::string& mime_type) { |
139 std::string* actual_mime_type) { | |
140 HWND hwnd = shell_->webViewHost()->view_handle(); | 139 HWND hwnd = shell_->webViewHost()->view_handle(); |
141 if (!hwnd) | 140 if (!hwnd) |
142 return NULL; | 141 return NULL; |
143 | 142 |
144 bool allow_wildcard = true; | 143 return WebPluginDelegateImpl::Create(path, mime_type, hwnd); |
145 WebPluginInfo info; | |
146 if (!NPAPI::PluginList::Singleton()->GetPluginInfo( | |
147 url, mime_type, allow_wildcard, &info, actual_mime_type)) { | |
148 return NULL; | |
149 } | |
150 | |
151 if (actual_mime_type && !actual_mime_type->empty()) | |
152 return WebPluginDelegateImpl::Create(info.path, *actual_mime_type, hwnd); | |
153 else | |
154 return WebPluginDelegateImpl::Create(info.path, mime_type, hwnd); | |
155 } | 144 } |
156 | 145 |
157 void TestWebViewDelegate::CreatedPluginWindow( | 146 void TestWebViewDelegate::CreatedPluginWindow( |
158 gfx::PluginWindowHandle handle) { | 147 gfx::PluginWindowHandle handle) { |
159 // ignored | 148 // ignored |
160 } | 149 } |
161 | 150 |
162 void TestWebViewDelegate::WillDestroyPluginWindow( | 151 void TestWebViewDelegate::WillDestroyPluginWindow( |
163 gfx::PluginWindowHandle handle) { | 152 gfx::PluginWindowHandle handle) { |
164 // ignored | 153 // ignored |
(...skipping 45 matching lines...) Loading... |
210 | 199 |
211 void TestWebViewDelegate::SetPageTitle(const std::wstring& title) { | 200 void TestWebViewDelegate::SetPageTitle(const std::wstring& title) { |
212 // The Windows test shell, pre-refactoring, ignored this. *shrug* | 201 // The Windows test shell, pre-refactoring, ignored this. *shrug* |
213 } | 202 } |
214 | 203 |
215 void TestWebViewDelegate::SetAddressBarURL(const GURL& url) { | 204 void TestWebViewDelegate::SetAddressBarURL(const GURL& url) { |
216 std::wstring url_string = UTF8ToWide(url.spec()); | 205 std::wstring url_string = UTF8ToWide(url.spec()); |
217 SendMessage(shell_->editWnd(), WM_SETTEXT, 0, | 206 SendMessage(shell_->editWnd(), WM_SETTEXT, 0, |
218 reinterpret_cast<LPARAM>(url_string.c_str())); | 207 reinterpret_cast<LPARAM>(url_string.c_str())); |
219 } | 208 } |
OLD | NEW |