OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/plugins/ppapi/ppapi_webplugin_impl.h" | 5 #include "webkit/plugins/ppapi/ppapi_webplugin_impl.h" |
6 | 6 |
7 #include <cmath> | 7 #include <cmath> |
8 | 8 |
9 #include "base/debug/crash_logging.h" | 9 #include "base/debug/crash_logging.h" |
10 #include "base/message_loop.h" | 10 #include "base/message_loop.h" |
11 #include "googleurl/src/gurl.h" | 11 #include "googleurl/src/gurl.h" |
12 #include "ppapi/shared_impl/ppapi_globals.h" | 12 #include "ppapi/shared_impl/ppapi_globals.h" |
13 #include "ppapi/shared_impl/var_tracker.h" | 13 #include "ppapi/shared_impl/var_tracker.h" |
14 #include "third_party/WebKit/Source/Platform/chromium/public/WebPoint.h" | 14 #include "third_party/WebKit/Source/Platform/chromium/public/WebPoint.h" |
15 #include "third_party/WebKit/Source/Platform/chromium/public/WebRect.h" | 15 #include "third_party/WebKit/Source/Platform/chromium/public/WebRect.h" |
16 #include "third_party/WebKit/Source/Platform/chromium/public/WebSize.h" | 16 #include "third_party/WebKit/Source/Platform/chromium/public/WebSize.h" |
| 17 #include "third_party/WebKit/Source/Platform/chromium/public/WebURLLoaderClient.
h" |
17 #include "third_party/WebKit/Source/WebKit/chromium/public/WebBindings.h" | 18 #include "third_party/WebKit/Source/WebKit/chromium/public/WebBindings.h" |
18 #include "third_party/WebKit/Source/WebKit/chromium/public/WebDocument.h" | 19 #include "third_party/WebKit/Source/WebKit/chromium/public/WebDocument.h" |
19 #include "third_party/WebKit/Source/WebKit/chromium/public/WebElement.h" | 20 #include "third_party/WebKit/Source/WebKit/chromium/public/WebElement.h" |
20 #include "third_party/WebKit/Source/WebKit/chromium/public/WebFrame.h" | 21 #include "third_party/WebKit/Source/WebKit/chromium/public/WebFrame.h" |
21 #include "third_party/WebKit/Source/WebKit/chromium/public/WebPluginContainer.h" | 22 #include "third_party/WebKit/Source/WebKit/chromium/public/WebPluginContainer.h" |
22 #include "third_party/WebKit/Source/WebKit/chromium/public/WebPluginParams.h" | 23 #include "third_party/WebKit/Source/WebKit/chromium/public/WebPluginParams.h" |
23 #include "third_party/WebKit/Source/WebKit/chromium/public/WebPrintParams.h" | 24 #include "third_party/WebKit/Source/WebKit/chromium/public/WebPrintParams.h" |
24 #include "third_party/WebKit/Source/WebKit/chromium/public/WebPrintScalingOption
.h" | 25 #include "third_party/WebKit/Source/WebKit/chromium/public/WebPrintScalingOption
.h" |
25 #include "third_party/WebKit/Source/WebKit/chromium/public/WebView.h" | 26 #include "third_party/WebKit/Source/WebKit/chromium/public/WebView.h" |
26 #include "webkit/plugins/ppapi/message_channel.h" | 27 #include "webkit/plugins/ppapi/message_channel.h" |
27 #include "webkit/plugins/ppapi/npobject_var.h" | 28 #include "webkit/plugins/ppapi/npobject_var.h" |
28 #include "webkit/plugins/ppapi/plugin_module.h" | 29 #include "webkit/plugins/ppapi/plugin_module.h" |
29 #include "webkit/plugins/ppapi/ppapi_plugin_instance.h" | 30 #include "webkit/plugins/ppapi/ppapi_plugin_instance.h" |
30 #include "webkit/plugins/ppapi/ppb_url_loader_impl.h" | |
31 | 31 |
32 using ppapi::NPObjectVar; | 32 using ppapi::NPObjectVar; |
33 using WebKit::WebCanvas; | 33 using WebKit::WebCanvas; |
34 using WebKit::WebPlugin; | 34 using WebKit::WebPlugin; |
35 using WebKit::WebPluginContainer; | 35 using WebKit::WebPluginContainer; |
36 using WebKit::WebPluginParams; | 36 using WebKit::WebPluginParams; |
37 using WebKit::WebPoint; | 37 using WebKit::WebPoint; |
38 using WebKit::WebPrintParams; | 38 using WebKit::WebPrintParams; |
39 using WebKit::WebRect; | 39 using WebKit::WebRect; |
40 using WebKit::WebSize; | 40 using WebKit::WebSize; |
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
184 | 184 |
185 bool WebPluginImpl::handleInputEvent(const WebKit::WebInputEvent& event, | 185 bool WebPluginImpl::handleInputEvent(const WebKit::WebInputEvent& event, |
186 WebKit::WebCursorInfo& cursor_info) { | 186 WebKit::WebCursorInfo& cursor_info) { |
187 if (instance_->FlashIsFullscreenOrPending()) | 187 if (instance_->FlashIsFullscreenOrPending()) |
188 return false; | 188 return false; |
189 return instance_->HandleInputEvent(event, &cursor_info); | 189 return instance_->HandleInputEvent(event, &cursor_info); |
190 } | 190 } |
191 | 191 |
192 void WebPluginImpl::didReceiveResponse( | 192 void WebPluginImpl::didReceiveResponse( |
193 const WebKit::WebURLResponse& response) { | 193 const WebKit::WebURLResponse& response) { |
194 DCHECK(!document_loader_); | 194 DCHECK(!instance_->document_loader()); |
195 | 195 instance_->HandleDocumentLoad(response); |
196 if (instance_->module()->is_crashed()) { | |
197 // Don't create a resource for a crashed plugin. | |
198 instance_->container()->element().document().frame()->stopLoading(); | |
199 return; | |
200 } | |
201 | |
202 document_loader_ = new PPB_URLLoader_Impl(instance_->pp_instance(), true); | |
203 document_loader_->didReceiveResponse(NULL, response); | |
204 | |
205 if (!instance_->HandleDocumentLoad(document_loader_)) | |
206 document_loader_ = NULL; | |
207 } | 196 } |
208 | 197 |
209 void WebPluginImpl::didReceiveData(const char* data, int data_length) { | 198 void WebPluginImpl::didReceiveData(const char* data, int data_length) { |
210 if (document_loader_) | 199 WebKit::WebURLLoaderClient* document_loader = instance_->document_loader(); |
211 document_loader_->didReceiveData(NULL, data, data_length, data_length); | 200 if (document_loader) |
| 201 document_loader->didReceiveData(NULL, data, data_length, 0); |
212 } | 202 } |
213 | 203 |
214 void WebPluginImpl::didFinishLoading() { | 204 void WebPluginImpl::didFinishLoading() { |
215 if (document_loader_) { | 205 WebKit::WebURLLoaderClient* document_loader = instance_->document_loader(); |
216 document_loader_->didFinishLoading(NULL, 0); | 206 if (document_loader) |
217 document_loader_ = NULL; | 207 document_loader->didFinishLoading(NULL, 0.0); |
218 } | |
219 } | 208 } |
220 | 209 |
221 void WebPluginImpl::didFailLoading(const WebKit::WebURLError& error) { | 210 void WebPluginImpl::didFailLoading(const WebKit::WebURLError& error) { |
222 if (document_loader_) { | 211 WebKit::WebURLLoaderClient* document_loader = instance_->document_loader(); |
223 document_loader_->didFail(NULL, error); | 212 if (document_loader) |
224 document_loader_ = NULL; | 213 document_loader->didFail(NULL, error); |
225 } | |
226 } | 214 } |
227 | 215 |
228 void WebPluginImpl::didFinishLoadingFrameRequest(const WebKit::WebURL& url, | 216 void WebPluginImpl::didFinishLoadingFrameRequest(const WebKit::WebURL& url, |
229 void* notify_data) { | 217 void* notify_data) { |
230 } | 218 } |
231 | 219 |
232 void WebPluginImpl::didFailLoadingFrameRequest( | 220 void WebPluginImpl::didFailLoadingFrameRequest( |
233 const WebKit::WebURL& url, | 221 const WebKit::WebURL& url, |
234 void* notify_data, | 222 void* notify_data, |
235 const WebKit::WebURLError& error) { | 223 const WebKit::WebURLError& error) { |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
297 void WebPluginImpl::rotateView(RotationType type) { | 285 void WebPluginImpl::rotateView(RotationType type) { |
298 instance_->RotateView(type); | 286 instance_->RotateView(type); |
299 } | 287 } |
300 | 288 |
301 bool WebPluginImpl::isPlaceholder() { | 289 bool WebPluginImpl::isPlaceholder() { |
302 return false; | 290 return false; |
303 } | 291 } |
304 | 292 |
305 } // namespace ppapi | 293 } // namespace ppapi |
306 } // namespace webkit | 294 } // namespace webkit |
OLD | NEW |