| 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 3169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3180 if (fullscreen_container_) { | 3180 if (fullscreen_container_) { |
| 3181 fullscreen_container_->PepperDidChangeCursor(*cursor); | 3181 fullscreen_container_->PepperDidChangeCursor(*cursor); |
| 3182 } else if (render_frame_) { | 3182 } else if (render_frame_) { |
| 3183 render_frame_->PepperDidChangeCursor(this, *cursor); | 3183 render_frame_->PepperDidChangeCursor(this, *cursor); |
| 3184 } | 3184 } |
| 3185 } | 3185 } |
| 3186 | 3186 |
| 3187 bool PepperPluginInstanceImpl::IsFullPagePlugin() { | 3187 bool PepperPluginInstanceImpl::IsFullPagePlugin() { |
| 3188 WebLocalFrame* frame = container()->GetDocument().GetFrame(); | 3188 WebLocalFrame* frame = container()->GetDocument().GetFrame(); |
| 3189 return frame->View()->MainFrame()->IsWebLocalFrame() && | 3189 return frame->View()->MainFrame()->IsWebLocalFrame() && |
| 3190 frame->View()->MainFrame()->GetDocument().IsPluginDocument(); | 3190 frame->View() |
| 3191 ->MainFrame() |
| 3192 ->ToWebLocalFrame() |
| 3193 ->GetDocument() |
| 3194 .IsPluginDocument(); |
| 3191 } | 3195 } |
| 3192 | 3196 |
| 3193 bool PepperPluginInstanceImpl::FlashSetFullscreen(bool fullscreen, | 3197 bool PepperPluginInstanceImpl::FlashSetFullscreen(bool fullscreen, |
| 3194 bool delay_report) { | 3198 bool delay_report) { |
| 3195 TRACE_EVENT0("ppapi", "PepperPluginInstanceImpl::FlashSetFullscreen"); | 3199 TRACE_EVENT0("ppapi", "PepperPluginInstanceImpl::FlashSetFullscreen"); |
| 3196 // Keep a reference on the stack. See NOTE above. | 3200 // Keep a reference on the stack. See NOTE above. |
| 3197 scoped_refptr<PepperPluginInstanceImpl> ref(this); | 3201 scoped_refptr<PepperPluginInstanceImpl> ref(this); |
| 3198 | 3202 |
| 3199 // We check whether we are trying to switch to the state we're already going | 3203 // We check whether we are trying to switch to the state we're already going |
| 3200 // to (i.e. if we're already switching to fullscreen but the fullscreen | 3204 // to (i.e. if we're already switching to fullscreen but the fullscreen |
| (...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3309 bool PepperPluginInstanceImpl::CanAccessMainFrame() const { | 3313 bool PepperPluginInstanceImpl::CanAccessMainFrame() const { |
| 3310 if (!container_) | 3314 if (!container_) |
| 3311 return false; | 3315 return false; |
| 3312 blink::WebDocument containing_document = container_->GetDocument(); | 3316 blink::WebDocument containing_document = container_->GetDocument(); |
| 3313 | 3317 |
| 3314 if (!containing_document.GetFrame() || | 3318 if (!containing_document.GetFrame() || |
| 3315 !containing_document.GetFrame()->View() || | 3319 !containing_document.GetFrame()->View() || |
| 3316 !containing_document.GetFrame()->View()->MainFrame()) { | 3320 !containing_document.GetFrame()->View()->MainFrame()) { |
| 3317 return false; | 3321 return false; |
| 3318 } | 3322 } |
| 3319 blink::WebDocument main_document = | 3323 blink::WebFrame* main_frame = |
| 3320 containing_document.GetFrame()->View()->MainFrame()->GetDocument(); | 3324 containing_document.GetFrame()->View()->MainFrame(); |
| 3321 | 3325 |
| 3322 return containing_document.GetSecurityOrigin().CanAccess( | 3326 return containing_document.GetSecurityOrigin().CanAccess( |
| 3323 main_document.GetSecurityOrigin()); | 3327 main_frame->GetSecurityOrigin()); |
| 3324 } | 3328 } |
| 3325 | 3329 |
| 3326 void PepperPluginInstanceImpl::KeepSizeAttributesBeforeFullscreen() { | 3330 void PepperPluginInstanceImpl::KeepSizeAttributesBeforeFullscreen() { |
| 3327 WebElement element = container_->GetElement(); | 3331 WebElement element = container_->GetElement(); |
| 3328 width_before_fullscreen_ = element.GetAttribute(WebString::FromUTF8(kWidth)); | 3332 width_before_fullscreen_ = element.GetAttribute(WebString::FromUTF8(kWidth)); |
| 3329 height_before_fullscreen_ = | 3333 height_before_fullscreen_ = |
| 3330 element.GetAttribute(WebString::FromUTF8(kHeight)); | 3334 element.GetAttribute(WebString::FromUTF8(kHeight)); |
| 3331 border_before_fullscreen_ = | 3335 border_before_fullscreen_ = |
| 3332 element.GetAttribute(WebString::FromUTF8(kBorder)); | 3336 element.GetAttribute(WebString::FromUTF8(kBorder)); |
| 3333 style_before_fullscreen_ = element.GetAttribute(WebString::FromUTF8(kStyle)); | 3337 style_before_fullscreen_ = element.GetAttribute(WebString::FromUTF8(kStyle)); |
| (...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3496 const cc::TextureMailbox& mailbox) const { | 3500 const cc::TextureMailbox& mailbox) const { |
| 3497 auto it = | 3501 auto it = |
| 3498 std::find_if(texture_ref_counts_.begin(), texture_ref_counts_.end(), | 3502 std::find_if(texture_ref_counts_.begin(), texture_ref_counts_.end(), |
| 3499 [&mailbox](const TextureMailboxRefCount& ref_count) { | 3503 [&mailbox](const TextureMailboxRefCount& ref_count) { |
| 3500 return ref_count.first.mailbox() == mailbox.mailbox(); | 3504 return ref_count.first.mailbox() == mailbox.mailbox(); |
| 3501 }); | 3505 }); |
| 3502 return it != texture_ref_counts_.end(); | 3506 return it != texture_ref_counts_.end(); |
| 3503 } | 3507 } |
| 3504 | 3508 |
| 3505 } // namespace content | 3509 } // namespace content |
| OLD | NEW |