| 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 #include "config.h" | 5 #include "config.h" |
| 6 #include "webkit/glue/webplugin_impl.h" | 6 #include "webkit/glue/webplugin_impl.h" |
| 7 | 7 |
| 8 #include "Cursor.h" | 8 #include "Cursor.h" |
| 9 #include "Document.h" | 9 #include "Document.h" |
| 10 #include "DocumentLoader.h" | 10 #include "DocumentLoader.h" |
| (...skipping 217 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 228 } | 228 } |
| 229 | 229 |
| 230 // We override this function so that if the plugin is windowed, we can call | 230 // We override this function so that if the plugin is windowed, we can call |
| 231 // NPP_SetWindow at the first possible moment. This ensures that NPP_SetWindow | 231 // NPP_SetWindow at the first possible moment. This ensures that NPP_SetWindow |
| 232 // is called before the manual load data is sent to a plugin. If this order is | 232 // is called before the manual load data is sent to a plugin. If this order is |
| 233 // reversed, Flash won't load videos. | 233 // reversed, Flash won't load videos. |
| 234 void WebPluginContainer::setParent(WebCore::ScrollView* view) { | 234 void WebPluginContainer::setParent(WebCore::ScrollView* view) { |
| 235 WebCore::Widget::setParent(view); | 235 WebCore::Widget::setParent(view); |
| 236 if (view) { | 236 if (view) { |
| 237 impl_->setFrameRect(frameRect()); | 237 impl_->setFrameRect(frameRect()); |
| 238 impl_->delegate_->FlushGeometryUpdates(); | |
| 239 } | 238 } |
| 240 } | 239 } |
| 241 | 240 |
| 242 void WebPluginContainer::windowCutoutRects(const WebCore::IntRect& bounds, | 241 void WebPluginContainer::windowCutoutRects(const WebCore::IntRect& bounds, |
| 243 WTF::Vector<WebCore::IntRect>* | 242 WTF::Vector<WebCore::IntRect>* |
| 244 cutouts) const { | 243 cutouts) const { |
| 245 impl_->windowCutoutRects(bounds, cutouts); | 244 impl_->windowCutoutRects(bounds, cutouts); |
| 246 } | 245 } |
| 247 | 246 |
| 248 void WebPluginContainer::didReceiveResponse( | 247 void WebPluginContainer::didReceiveResponse( |
| (...skipping 426 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 675 move.visible = widget_->isVisible(); | 674 move.visible = widget_->isVisible(); |
| 676 | 675 |
| 677 webview->delegate()->DidMove(webview, move); | 676 webview->delegate()->DidMove(webview, move); |
| 678 } | 677 } |
| 679 | 678 |
| 680 // Notify the plugin that its parameters have changed. | 679 // Notify the plugin that its parameters have changed. |
| 681 delegate_->UpdateGeometry(webkit_glue::FromIntRect(window_rect), | 680 delegate_->UpdateGeometry(webkit_glue::FromIntRect(window_rect), |
| 682 webkit_glue::FromIntRect(clip_rect)); | 681 webkit_glue::FromIntRect(clip_rect)); |
| 683 | 682 |
| 684 // Initiate a download on the plugin url. This should be done for the | 683 // Initiate a download on the plugin url. This should be done for the |
| 685 // first update geometry sequence. | 684 // first update geometry sequence. We need to ensure that the plugin |
| 685 // receives the geometry update before it starts receiving data. |
| 686 if (first_geometry_update_) { | 686 if (first_geometry_update_) { |
| 687 first_geometry_update_ = false; | 687 first_geometry_update_ = false; |
| 688 // An empty url corresponds to an EMBED tag with no src attribute. | 688 // An empty url corresponds to an EMBED tag with no src attribute. |
| 689 if (!load_manually_ && plugin_url_.is_valid()) { | 689 if (!load_manually_ && plugin_url_.is_valid()) { |
| 690 HandleURLRequestInternal("GET", false, NULL, 0, NULL, false, false, | 690 HandleURLRequestInternal("GET", false, NULL, 0, NULL, false, false, |
| 691 plugin_url_.spec().c_str(), NULL, false, | 691 plugin_url_.spec().c_str(), NULL, false, |
| 692 false); | 692 false); |
| 693 } | 693 } |
| 694 } | 694 } |
| 695 } | 695 } |
| (...skipping 591 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1287 widget_ = NULL; | 1287 widget_ = NULL; |
| 1288 // TODO(iyengar) Should we delete the current plugin instance here? | 1288 // TODO(iyengar) Should we delete the current plugin instance here? |
| 1289 return false; | 1289 return false; |
| 1290 } | 1290 } |
| 1291 | 1291 |
| 1292 mime_type_ = actual_mime_type; | 1292 mime_type_ = actual_mime_type; |
| 1293 delegate_ = plugin_delegate; | 1293 delegate_ = plugin_delegate; |
| 1294 // Force a geometry update to occur to ensure that the plugin becomes | 1294 // Force a geometry update to occur to ensure that the plugin becomes |
| 1295 // visible. | 1295 // visible. |
| 1296 widget_->frameRectsChanged(); | 1296 widget_->frameRectsChanged(); |
| 1297 delegate_->FlushGeometryUpdates(); | |
| 1298 // The plugin move sequences accumulated via DidMove are sent to the browser | 1297 // The plugin move sequences accumulated via DidMove are sent to the browser |
| 1299 // whenever the renderer paints. Force a paint here to ensure that changes | 1298 // whenever the renderer paints. Force a paint here to ensure that changes |
| 1300 // to the plugin window are propagated to the browser. | 1299 // to the plugin window are propagated to the browser. |
| 1301 widget_->invalidateRect(widget_->frameRect()); | 1300 widget_->invalidateRect(widget_->frameRect()); |
| 1302 return true; | 1301 return true; |
| 1303 } | 1302 } |
| 1304 | 1303 |
| 1305 void WebPluginImpl::ArrayToVector(int total_values, char** values, | 1304 void WebPluginImpl::ArrayToVector(int total_values, char** values, |
| 1306 std::vector<std::string>* value_vector) { | 1305 std::vector<std::string>* value_vector) { |
| 1307 DCHECK(value_vector != NULL); | 1306 DCHECK(value_vector != NULL); |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1345 client_index = clients_.erase(client_index); | 1344 client_index = clients_.erase(client_index); |
| 1346 if (resource_client) | 1345 if (resource_client) |
| 1347 resource_client->DidFail(); | 1346 resource_client->DidFail(); |
| 1348 } | 1347 } |
| 1349 | 1348 |
| 1350 // This needs to be called now and not in the destructor since the | 1349 // This needs to be called now and not in the destructor since the |
| 1351 // webframe_ might not be valid anymore. | 1350 // webframe_ might not be valid anymore. |
| 1352 webframe_->set_plugin_delegate(NULL); | 1351 webframe_->set_plugin_delegate(NULL); |
| 1353 webframe_ = NULL; | 1352 webframe_ = NULL; |
| 1354 } | 1353 } |
| OLD | NEW |