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

Side by Side Diff: content/renderer/pepper/pepper_plugin_instance_impl.cc

Issue 1962923002: Fix rendering of flash content inside an out-of-process iframe. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix for android builds Created 4 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
« no previous file with comments | « no previous file | content/renderer/render_frame_impl.cc » ('j') | content/renderer/render_widget.cc » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 "content/renderer/pepper/pepper_plugin_instance_impl.h" 5 #include "content/renderer/pepper/pepper_plugin_instance_impl.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/bit_cast.h" 10 #include "base/bit_cast.h"
(...skipping 518 matching lines...) Expand 10 before | Expand all | Expand 10 after
529 is_deleted_(false), 529 is_deleted_(false),
530 initialized_(false), 530 initialized_(false),
531 view_change_weak_ptr_factory_(this), 531 view_change_weak_ptr_factory_(this),
532 weak_factory_(this) { 532 weak_factory_(this) {
533 pp_instance_ = HostGlobals::Get()->AddInstance(this); 533 pp_instance_ = HostGlobals::Get()->AddInstance(this);
534 534
535 memset(&current_print_settings_, 0, sizeof(current_print_settings_)); 535 memset(&current_print_settings_, 0, sizeof(current_print_settings_));
536 module_->InstanceCreated(this); 536 module_->InstanceCreated(this);
537 537
538 if (render_frame) { // NULL in tests 538 if (render_frame) { // NULL in tests
539 render_frame->render_view()->PepperInstanceCreated(this); 539 render_frame->GetRenderWidget()->PepperInstanceCreated(this);
540 // Bind a callback now so that we can inform the RenderViewImpl when we are 540 // Bind a callback now so that we can inform the RenderWidget when we are
541 // destroyed. This works around a temporary problem stemming from work to 541 // destroyed. This works around a temporary problem stemming from work to
542 // move parts of RenderViewImpl in to RenderFrameImpl (see 542 // move parts of RenderWidget in to RenderFrameImpl (see
543 // crbug.com/245126). If destruction happens in this order: 543 // crbug.com/245126). If destruction happens in this order:
544 // 1) RenderFrameImpl 544 // 1) RenderFrameImpl
545 // 2) PepperPluginInstanceImpl 545 // 2) PepperPluginInstanceImpl
546 // 3) RenderViewImpl 546 // 3) RenderWidget
547 // Then after 1), the PepperPluginInstanceImpl doesn't have any way to talk 547 // Then after 1), the PepperPluginInstanceImpl doesn't have any way to talk
548 // to the RenderViewImpl. But when the instance is destroyed, it still 548 // to the RenderWidget. But when the instance is destroyed, it still
549 // needs to inform the RenderViewImpl that it has gone away, otherwise 549 // needs to inform the RenderWidget that it has gone away, otherwise
550 // between (2) and (3), the RenderViewImpl will still have the dead 550 // between (2) and (3), the RenderWidget will still have the dead
551 // instance in its active set, and so might make calls on the deleted 551 // instance in its active set, and so might make calls on the deleted
552 // instance. See crbug.com/343576 for more information. Once the plugin 552 // instance. See crbug.com/343576 for more information. Once the plugin
553 // calls move entirely from RenderViewImpl in to RenderFrameImpl, this 553 // calls move entirely from RenderWidget in to RenderFrameImpl, this
554 // can be a little bit simplified by instead making a direct call on 554 // can be a little bit simplified by instead making a direct call on
555 // RenderFrameImpl in the destructor (but only if render_frame_ is valid). 555 // RenderFrameImpl in the destructor (but only if render_frame_ is valid).
556 instance_deleted_callback_ = 556 instance_deleted_callback_ = base::Bind(
557 base::Bind(&RenderViewImpl::PepperInstanceDeleted, 557 &RenderWidget::PepperInstanceDeleted,
558 render_frame->render_view()->AsWeakPtr(), 558 render_frame->GetRenderWidget()->AsWeakPtr(), base::Unretained(this));
559 base::Unretained(this));
560 view_data_.is_page_visible = !render_frame_->GetRenderWidget()->is_hidden(); 559 view_data_.is_page_visible = !render_frame_->GetRenderWidget()->is_hidden();
561 560
562 // Set the initial focus. 561 // Set the initial focus.
563 SetContentAreaFocus(render_frame_->render_view()->has_focus()); 562 SetContentAreaFocus(render_frame_->render_view()->has_focus());
564 563
565 if (!module_->IsProxied()) { 564 if (!module_->IsProxied()) {
566 PepperBrowserConnection* browser_connection = 565 PepperBrowserConnection* browser_connection =
567 PepperBrowserConnection::Get(render_frame_); 566 PepperBrowserConnection::Get(render_frame_);
568 browser_connection->DidCreateInProcessInstance( 567 browser_connection->DidCreateInProcessInstance(
569 pp_instance(), 568 pp_instance(),
(...skipping 1057 matching lines...) Expand 10 before | Expand all | Expand 10 after
1627 top_left.y() / graphics_2d_size_in_dip.height()), 1626 top_left.y() / graphics_2d_size_in_dip.height()),
1628 gfx::PointF(lower_right.x() / graphics_2d_size_in_dip.width(), 1627 gfx::PointF(lower_right.x() / graphics_2d_size_in_dip.width(),
1629 lower_right.y() / graphics_2d_size_in_dip.height())); 1628 lower_right.y() / graphics_2d_size_in_dip.height()));
1630 } 1629 }
1631 1630
1632 bool PepperPluginInstanceImpl::PluginHasFocus() const { 1631 bool PepperPluginInstanceImpl::PluginHasFocus() const {
1633 return flash_fullscreen_ || (has_webkit_focus_ && has_content_area_focus_); 1632 return flash_fullscreen_ || (has_webkit_focus_ && has_content_area_focus_);
1634 } 1633 }
1635 1634
1636 void PepperPluginInstanceImpl::SendFocusChangeNotification() { 1635 void PepperPluginInstanceImpl::SendFocusChangeNotification() {
1637 // Keep a reference on the stack. RenderViewImpl::PepperFocusChanged may 1636 // Keep a reference on the stack. RenderWidget::PepperFocusChanged may
1638 // remove the <embed> from the DOM, which will make the PepperWebPluginImpl 1637 // remove the <embed> from the DOM, which will make the PepperWebPluginImpl
1639 // drop its reference, usually the last one. This is similar to possible 1638 // drop its reference, usually the last one. This is similar to possible
1640 // plugin behavior described at the NOTE above Delete(). 1639 // plugin behavior described at the NOTE above Delete().
1641 scoped_refptr<PepperPluginInstanceImpl> ref(this); 1640 scoped_refptr<PepperPluginInstanceImpl> ref(this);
1642 1641
1643 if (!render_frame_) 1642 if (!render_frame_)
1644 return; 1643 return;
1645 1644
1646 bool has_focus = PluginHasFocus(); 1645 bool has_focus = PluginHasFocus();
1647 render_frame_->render_view()->PepperFocusChanged(this, has_focus); 1646 render_frame_->GetRenderWidget()->PepperFocusChanged(this, has_focus);
1648 1647
1649 // instance_interface_ may have been cleared in Delete() if the 1648 // instance_interface_ may have been cleared in Delete() if the
1650 // PepperWebPluginImpl is destroyed. 1649 // PepperWebPluginImpl is destroyed.
1651 if (instance_interface_) 1650 if (instance_interface_)
1652 instance_interface_->DidChangeFocus(pp_instance(), PP_FromBool(has_focus)); 1651 instance_interface_->DidChangeFocus(pp_instance(), PP_FromBool(has_focus));
1653 } 1652 }
1654 1653
1655 void PepperPluginInstanceImpl::UpdateTouchEventRequest() { 1654 void PepperPluginInstanceImpl::UpdateTouchEventRequest() {
1656 bool raw_touch = (filtered_input_event_mask_ & PP_INPUTEVENT_CLASS_TOUCH) || 1655 bool raw_touch = (filtered_input_event_mask_ & PP_INPUTEVENT_CLASS_TOUCH) ||
1657 (input_event_mask_ & PP_INPUTEVENT_CLASS_TOUCH); 1656 (input_event_mask_ & PP_INPUTEVENT_CLASS_TOUCH);
(...skipping 1761 matching lines...) Expand 10 before | Expand all | Expand 10 after
3419 const cc::TextureMailbox& mailbox) const { 3418 const cc::TextureMailbox& mailbox) const {
3420 auto it = 3419 auto it =
3421 std::find_if(texture_ref_counts_.begin(), texture_ref_counts_.end(), 3420 std::find_if(texture_ref_counts_.begin(), texture_ref_counts_.end(),
3422 [&mailbox](const TextureMailboxRefCount& ref_count) { 3421 [&mailbox](const TextureMailboxRefCount& ref_count) {
3423 return ref_count.first.mailbox() == mailbox.mailbox(); 3422 return ref_count.first.mailbox() == mailbox.mailbox();
3424 }); 3423 });
3425 return it != texture_ref_counts_.end(); 3424 return it != texture_ref_counts_.end();
3426 } 3425 }
3427 3426
3428 } // namespace content 3427 } // namespace content
OLDNEW
« no previous file with comments | « no previous file | content/renderer/render_frame_impl.cc » ('j') | content/renderer/render_widget.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698