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