| 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 | 6 |
| 7 #include "Cursor.h" | 7 #include "Cursor.h" |
| 8 #include "Document.h" | 8 #include "Document.h" |
| 9 #include "DocumentLoader.h" | 9 #include "DocumentLoader.h" |
| 10 #include "Event.h" | 10 #include "Event.h" |
| (...skipping 360 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 371 char** arg_values) | 371 char** arg_values) |
| 372 : windowless_(false), | 372 : windowless_(false), |
| 373 window_(NULL), | 373 window_(NULL), |
| 374 element_(element), | 374 element_(element), |
| 375 webframe_(webframe), | 375 webframe_(webframe), |
| 376 delegate_(delegate), | 376 delegate_(delegate), |
| 377 widget_(NULL), | 377 widget_(NULL), |
| 378 plugin_url_(plugin_url), | 378 plugin_url_(plugin_url), |
| 379 load_manually_(load_manually), | 379 load_manually_(load_manually), |
| 380 first_geometry_update_(true), | 380 first_geometry_update_(true), |
| 381 mime_type_(mime_type) { | 381 mime_type_(mime_type), |
| 382 ALLOW_THIS_IN_INITIALIZER_LIST(method_factory_(this)) { |
| 382 | 383 |
| 383 ArrayToVector(arg_count, arg_names, &arg_names_); | 384 ArrayToVector(arg_count, arg_names, &arg_names_); |
| 384 ArrayToVector(arg_count, arg_values, &arg_values_); | 385 ArrayToVector(arg_count, arg_values, &arg_values_); |
| 385 } | 386 } |
| 386 | 387 |
| 387 WebPluginImpl::~WebPluginImpl() { | 388 WebPluginImpl::~WebPluginImpl() { |
| 388 } | 389 } |
| 389 | 390 |
| 390 void WebPluginImpl::SetWindow(gfx::NativeView window) { | 391 void WebPluginImpl::SetWindow(gfx::NativeView window) { |
| 391 if (window) { | 392 if (window) { |
| (...skipping 334 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 726 delegate_->UpdateGeometry(webkit_glue::FromIntRect(window_rect), | 727 delegate_->UpdateGeometry(webkit_glue::FromIntRect(window_rect), |
| 727 webkit_glue::FromIntRect(clip_rect)); | 728 webkit_glue::FromIntRect(clip_rect)); |
| 728 | 729 |
| 729 // Initiate a download on the plugin url. This should be done for the | 730 // Initiate a download on the plugin url. This should be done for the |
| 730 // first update geometry sequence. We need to ensure that the plugin | 731 // first update geometry sequence. We need to ensure that the plugin |
| 731 // receives the geometry update before it starts receiving data. | 732 // receives the geometry update before it starts receiving data. |
| 732 if (first_geometry_update_) { | 733 if (first_geometry_update_) { |
| 733 first_geometry_update_ = false; | 734 first_geometry_update_ = false; |
| 734 // An empty url corresponds to an EMBED tag with no src attribute. | 735 // An empty url corresponds to an EMBED tag with no src attribute. |
| 735 if (!load_manually_ && plugin_url_.is_valid()) { | 736 if (!load_manually_ && plugin_url_.is_valid()) { |
| 736 HandleURLRequestInternal("GET", false, NULL, 0, NULL, false, false, | 737 // The Flash plugin hangs for a while if it receives data before |
| 737 plugin_url_.spec().c_str(), NULL, false, | 738 // receiving valid plugin geometry. By valid geometry we mean the |
| 738 false); | 739 // geometry received by a call to setFrameRect in the Webkit |
| 740 // layout code path. To workaround this issue we download the |
| 741 // plugin source url on a timer. |
| 742 MessageLoop::current()->PostDelayedTask(FROM_HERE, |
| 743 method_factory_.NewRunnableMethod( |
| 744 &WebPluginImpl::OnDownloadPluginSrcUrl), |
| 745 0); |
| 739 } | 746 } |
| 740 } | 747 } |
| 741 } | 748 } |
| 742 | 749 |
| 750 void WebPluginImpl::OnDownloadPluginSrcUrl() { |
| 751 HandleURLRequestInternal("GET", false, NULL, 0, NULL, false, false, |
| 752 plugin_url_.spec().c_str(), NULL, false, |
| 753 false); |
| 754 } |
| 755 |
| 743 void WebPluginImpl::paint(WebCore::GraphicsContext* gc, | 756 void WebPluginImpl::paint(WebCore::GraphicsContext* gc, |
| 744 const WebCore::IntRect& damage_rect) { | 757 const WebCore::IntRect& damage_rect) { |
| 745 if (gc->paintingDisabled()) | 758 if (gc->paintingDisabled()) |
| 746 return; | 759 return; |
| 747 | 760 |
| 748 if (!parent()) | 761 if (!parent()) |
| 749 return; | 762 return; |
| 750 | 763 |
| 751 // Don't paint anything if the plugin doesn't intersect the damage rect. | 764 // Don't paint anything if the plugin doesn't intersect the damage rect. |
| 752 if (!widget_->frameRect().intersects(damage_rect)) | 765 if (!widget_->frameRect().intersects(damage_rect)) |
| (...skipping 643 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1396 | 1409 |
| 1397 WebPluginGeometry move; | 1410 WebPluginGeometry move; |
| 1398 move.window = window_; | 1411 move.window = window_; |
| 1399 move.window_rect = gfx::Rect(); | 1412 move.window_rect = gfx::Rect(); |
| 1400 move.clip_rect = gfx::Rect(); | 1413 move.clip_rect = gfx::Rect(); |
| 1401 move.rects_valid = false; | 1414 move.rects_valid = false; |
| 1402 move.visible = widget_->isVisible(); | 1415 move.visible = widget_->isVisible(); |
| 1403 | 1416 |
| 1404 webview->delegate()->DidMove(webview, move); | 1417 webview->delegate()->DidMove(webview, move); |
| 1405 } | 1418 } |
| OLD | NEW |