Chromium Code Reviews| 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 "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 522 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 533 is_deleted_(false), | 533 is_deleted_(false), |
| 534 initialized_(false), | 534 initialized_(false), |
| 535 audio_controller_(new PepperAudioController(this)), | 535 audio_controller_(new PepperAudioController(this)), |
| 536 view_change_weak_ptr_factory_(this), | 536 view_change_weak_ptr_factory_(this), |
| 537 weak_factory_(this) { | 537 weak_factory_(this) { |
| 538 pp_instance_ = HostGlobals::Get()->AddInstance(this); | 538 pp_instance_ = HostGlobals::Get()->AddInstance(this); |
| 539 | 539 |
| 540 memset(¤t_print_settings_, 0, sizeof(current_print_settings_)); | 540 memset(¤t_print_settings_, 0, sizeof(current_print_settings_)); |
| 541 module_->InstanceCreated(this); | 541 module_->InstanceCreated(this); |
| 542 | 542 |
| 543 if (render_frame) { // NULL in tests | 543 if (render_frame_) { // NULL in tests or if the frame has been destroyed. |
| 544 render_frame->PepperInstanceCreated(this); | 544 render_frame_->PepperInstanceCreated(this); |
|
bbudge
2016/09/07 18:25:07
I don't see how render_frame_ would be different f
| |
| 545 view_data_.is_page_visible = !render_frame_->GetRenderWidget()->is_hidden(); | 545 view_data_.is_page_visible = !render_frame_->GetRenderWidget()->is_hidden(); |
| 546 | 546 |
| 547 // Set the initial focus. | 547 // Set the initial focus. |
| 548 SetContentAreaFocus(render_frame_->GetRenderWidget()->has_focus()); | 548 SetContentAreaFocus(render_frame_->GetRenderWidget()->has_focus()); |
| 549 | 549 |
| 550 if (!module_->IsProxied()) { | 550 if (!module_->IsProxied()) { |
| 551 PepperBrowserConnection* browser_connection = | 551 PepperBrowserConnection* browser_connection = |
| 552 PepperBrowserConnection::Get(render_frame_); | 552 PepperBrowserConnection::Get(render_frame_); |
| 553 browser_connection->DidCreateInProcessInstance( | 553 browser_connection->DidCreateInProcessInstance( |
| 554 pp_instance(), | 554 pp_instance(), |
| (...skipping 1582 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2137 return false; | 2137 return false; |
| 2138 return bound_graphics_2d_platform_->PrepareTextureMailbox(mailbox, | 2138 return bound_graphics_2d_platform_->PrepareTextureMailbox(mailbox, |
| 2139 release_callback); | 2139 release_callback); |
| 2140 } | 2140 } |
| 2141 | 2141 |
| 2142 void PepperPluginInstanceImpl::AccessibilityModeChanged() { | 2142 void PepperPluginInstanceImpl::AccessibilityModeChanged() { |
| 2143 if (render_frame_->render_accessibility() && LoadPdfInterface()) | 2143 if (render_frame_->render_accessibility() && LoadPdfInterface()) |
| 2144 plugin_pdf_interface_->EnableAccessibility(pp_instance()); | 2144 plugin_pdf_interface_->EnableAccessibility(pp_instance()); |
| 2145 } | 2145 } |
| 2146 | 2146 |
| 2147 void PepperPluginInstanceImpl::OnDestruct() { render_frame_ = NULL; } | 2147 void PepperPluginInstanceImpl::OnDestruct() { |
| 2148 render_frame_ = nullptr; | |
| 2149 } | |
| 2148 | 2150 |
| 2149 void PepperPluginInstanceImpl::OnThrottleStateChange() { | 2151 void PepperPluginInstanceImpl::OnThrottleStateChange() { |
| 2150 SendDidChangeView(); | 2152 SendDidChangeView(); |
| 2151 | 2153 |
| 2152 bool is_throttled = throttler_->IsThrottled(); | 2154 bool is_throttled = throttler_->IsThrottled(); |
| 2153 render_frame()->Send(new FrameHostMsg_PluginInstanceThrottleStateChange( | 2155 render_frame()->Send(new FrameHostMsg_PluginInstanceThrottleStateChange( |
| 2154 module_->GetPluginChildId(), pp_instance_, is_throttled)); | 2156 module_->GetPluginChildId(), pp_instance_, is_throttled)); |
| 2155 } | 2157 } |
| 2156 | 2158 |
| 2157 void PepperPluginInstanceImpl::OnHiddenForPlaceholder(bool hidden) { | 2159 void PepperPluginInstanceImpl::OnHiddenForPlaceholder(bool hidden) { |
| (...skipping 1286 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3444 const cc::TextureMailbox& mailbox) const { | 3446 const cc::TextureMailbox& mailbox) const { |
| 3445 auto it = | 3447 auto it = |
| 3446 std::find_if(texture_ref_counts_.begin(), texture_ref_counts_.end(), | 3448 std::find_if(texture_ref_counts_.begin(), texture_ref_counts_.end(), |
| 3447 [&mailbox](const TextureMailboxRefCount& ref_count) { | 3449 [&mailbox](const TextureMailboxRefCount& ref_count) { |
| 3448 return ref_count.first.mailbox() == mailbox.mailbox(); | 3450 return ref_count.first.mailbox() == mailbox.mailbox(); |
| 3449 }); | 3451 }); |
| 3450 return it != texture_ref_counts_.end(); | 3452 return it != texture_ref_counts_.end(); |
| 3451 } | 3453 } |
| 3452 | 3454 |
| 3453 } // namespace content | 3455 } // namespace content |
| OLD | NEW |