Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(142)

Side by Side Diff: webkit/glue/webplugin_impl.cc

Issue 106008: Fix Flash window in Analytics being incorrectly visible.... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 184 matching lines...) Expand 10 before | Expand all | Expand 10 after
195 // our parent view was scrolled. 195 // our parent view was scrolled.
196 impl_->setFrameRect(frameRect()); 196 impl_->setFrameRect(frameRect());
197 } 197 }
198 198
199 // We override this function, to make sure that geometry updates are sent 199 // We override this function, to make sure that geometry updates are sent
200 // over to the plugin. For e.g. when a plugin is instantiated it does 200 // over to the plugin. For e.g. when a plugin is instantiated it does
201 // not have a valid parent. As a result the first geometry update from 201 // not have a valid parent. As a result the first geometry update from
202 // webkit is ignored. This function is called when the plugin eventually 202 // webkit is ignored. This function is called when the plugin eventually
203 // gets a parent. 203 // gets a parent.
204 void WebPluginContainer::setParentVisible(bool visible) { 204 void WebPluginContainer::setParentVisible(bool visible) {
205 if (isParentVisible() == visible)
206 return; // No change.
207
205 WebCore::Widget::setParentVisible(visible); 208 WebCore::Widget::setParentVisible(visible);
209 if (!isSelfVisible())
210 return; // This widget has explicitely been marked as not visible.
211
206 if (visible) 212 if (visible)
207 show(); 213 show();
208 else 214 else
209 hide(); 215 hide();
210 } 216 }
211 217
212 // We override this function so that if the plugin is windowed, we can call 218 // We override this function so that if the plugin is windowed, we can call
213 // NPP_SetWindow at the first possible moment. This ensures that NPP_SetWindow 219 // NPP_SetWindow at the first possible moment. This ensures that NPP_SetWindow
214 // is called before the manual load data is sent to a plugin. If this order is 220 // is called before the manual load data is sent to a plugin. If this order is
215 // reversed, Flash won't load videos. 221 // reversed, Flash won't load videos.
(...skipping 423 matching lines...) Expand 10 before | Expand all | Expand 10 after
639 // the webview is closed. 645 // the webview is closed.
640 if (!webview->delegate()) { 646 if (!webview->delegate()) {
641 return; 647 return;
642 } 648 }
643 649
644 WebCore::IntRect window_rect; 650 WebCore::IntRect window_rect;
645 WebCore::IntRect clip_rect; 651 WebCore::IntRect clip_rect;
646 std::vector<gfx::Rect> cutout_rects; 652 std::vector<gfx::Rect> cutout_rects;
647 CalculateBounds(rect, &window_rect, &clip_rect, &cutout_rects); 653 CalculateBounds(rect, &window_rect, &clip_rect, &cutout_rects);
648 654
649 // Notify the plugin that its parameters have changed.
650 delegate_->UpdateGeometry(webkit_glue::FromIntRect(window_rect),
651 webkit_glue::FromIntRect(clip_rect));
652
653 if (window_) { 655 if (window_) {
654 // Notify the window hosting the plugin (the WebViewDelegate) that 656 // Notify the window hosting the plugin (the WebViewDelegate) that
655 // it needs to adjust the plugin, so that all the HWNDs can be moved 657 // it needs to adjust the plugin, so that all the HWNDs can be moved
656 // at the same time. 658 // at the same time.
657 WebPluginGeometry move; 659 WebPluginGeometry move;
658 move.window = window_; 660 move.window = window_;
659 move.window_rect = webkit_glue::FromIntRect(window_rect); 661 move.window_rect = webkit_glue::FromIntRect(window_rect);
660 move.clip_rect = webkit_glue::FromIntRect(clip_rect); 662 move.clip_rect = webkit_glue::FromIntRect(clip_rect);
661 move.cutout_rects = cutout_rects; 663 move.cutout_rects = cutout_rects;
662 move.visible = visible_; 664 move.visible = visible_;
663 665
664 webview->delegate()->DidMove(webview, move); 666 webview->delegate()->DidMove(webview, move);
665 } 667 }
666 668
669 // Notify the plugin that its parameters have changed.
670 delegate_->UpdateGeometry(webkit_glue::FromIntRect(window_rect),
671 webkit_glue::FromIntRect(clip_rect));
672
667 // Initiate a download on the plugin url. This should be done for the 673 // Initiate a download on the plugin url. This should be done for the
668 // first update geometry sequence. 674 // first update geometry sequence.
669 if (first_geometry_update_) { 675 if (first_geometry_update_) {
670 first_geometry_update_ = false; 676 first_geometry_update_ = false;
671 // An empty url corresponds to an EMBED tag with no src attribute. 677 // An empty url corresponds to an EMBED tag with no src attribute.
672 if (!load_manually_ && plugin_url_.is_valid()) { 678 if (!load_manually_ && plugin_url_.is_valid()) {
673 HandleURLRequestInternal("GET", false, NULL, 0, NULL, false, false, 679 HandleURLRequestInternal("GET", false, NULL, 0, NULL, false, false,
674 plugin_url_.spec().c_str(), NULL, false, 680 plugin_url_.spec().c_str(), NULL, false,
675 false); 681 false);
676 } 682 }
(...skipping 737 matching lines...) Expand 10 before | Expand all | Expand 10 after
1414 client_index = clients_.erase(client_index); 1420 client_index = clients_.erase(client_index);
1415 if (resource_client) 1421 if (resource_client)
1416 resource_client->DidFail(); 1422 resource_client->DidFail();
1417 } 1423 }
1418 1424
1419 // This needs to be called now and not in the destructor since the 1425 // This needs to be called now and not in the destructor since the
1420 // webframe_ might not be valid anymore. 1426 // webframe_ might not be valid anymore.
1421 webframe_->set_plugin_delegate(NULL); 1427 webframe_->set_plugin_delegate(NULL);
1422 webframe_ = NULL; 1428 webframe_ = NULL;
1423 } 1429 }
OLDNEW
« no previous file with comments | « webkit/glue/plugins/test/plugin_windowed_test.cc ('k') | webkit/tools/test_shell/plugin_tests.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698