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 "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/callback_helpers.h" | 8 #include "base/callback_helpers.h" |
| 9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
| 10 #include "base/debug/trace_event.h" | 10 #include "base/debug/trace_event.h" |
| (...skipping 13 matching lines...) Expand all Loading... | |
| 24 #include "content/renderer/pepper/common.h" | 24 #include "content/renderer/pepper/common.h" |
| 25 #include "content/renderer/pepper/content_decryptor_delegate.h" | 25 #include "content/renderer/pepper/content_decryptor_delegate.h" |
| 26 #include "content/renderer/pepper/event_conversion.h" | 26 #include "content/renderer/pepper/event_conversion.h" |
| 27 #include "content/renderer/pepper/fullscreen_container.h" | 27 #include "content/renderer/pepper/fullscreen_container.h" |
| 28 #include "content/renderer/pepper/gfx_conversion.h" | 28 #include "content/renderer/pepper/gfx_conversion.h" |
| 29 #include "content/renderer/pepper/host_dispatcher_wrapper.h" | 29 #include "content/renderer/pepper/host_dispatcher_wrapper.h" |
| 30 #include "content/renderer/pepper/host_globals.h" | 30 #include "content/renderer/pepper/host_globals.h" |
| 31 #include "content/renderer/pepper/message_channel.h" | 31 #include "content/renderer/pepper/message_channel.h" |
| 32 #include "content/renderer/pepper/npapi_glue.h" | 32 #include "content/renderer/pepper/npapi_glue.h" |
| 33 #include "content/renderer/pepper/pepper_browser_connection.h" | 33 #include "content/renderer/pepper/pepper_browser_connection.h" |
| 34 #include "content/renderer/pepper/pepper_compositor_host.h" | |
| 34 #include "content/renderer/pepper/pepper_file_ref_renderer_host.h" | 35 #include "content/renderer/pepper/pepper_file_ref_renderer_host.h" |
| 35 #include "content/renderer/pepper/pepper_graphics_2d_host.h" | 36 #include "content/renderer/pepper/pepper_graphics_2d_host.h" |
| 36 #include "content/renderer/pepper/pepper_in_process_router.h" | 37 #include "content/renderer/pepper/pepper_in_process_router.h" |
| 37 #include "content/renderer/pepper/pepper_url_loader_host.h" | 38 #include "content/renderer/pepper/pepper_url_loader_host.h" |
| 38 #include "content/renderer/pepper/plugin_module.h" | 39 #include "content/renderer/pepper/plugin_module.h" |
| 39 #include "content/renderer/pepper/plugin_object.h" | 40 #include "content/renderer/pepper/plugin_object.h" |
| 40 #include "content/renderer/pepper/ppb_buffer_impl.h" | 41 #include "content/renderer/pepper/ppb_buffer_impl.h" |
| 41 #include "content/renderer/pepper/ppb_graphics_3d_impl.h" | 42 #include "content/renderer/pepper/ppb_graphics_3d_impl.h" |
| 42 #include "content/renderer/pepper/ppb_image_data_impl.h" | 43 #include "content/renderer/pepper/ppb_image_data_impl.h" |
| 43 #include "content/renderer/pepper/renderer_ppapi_host_impl.h" | 44 #include "content/renderer/pepper/renderer_ppapi_host_impl.h" |
| (...skipping 448 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 492 : RenderFrameObserver(render_frame), | 493 : RenderFrameObserver(render_frame), |
| 493 render_frame_(render_frame), | 494 render_frame_(render_frame), |
| 494 module_(module), | 495 module_(module), |
| 495 instance_interface_(instance_interface), | 496 instance_interface_(instance_interface), |
| 496 pp_instance_(0), | 497 pp_instance_(0), |
| 497 container_(container), | 498 container_(container), |
| 498 layer_bound_to_fullscreen_(false), | 499 layer_bound_to_fullscreen_(false), |
| 499 plugin_url_(plugin_url), | 500 plugin_url_(plugin_url), |
| 500 full_frame_(false), | 501 full_frame_(false), |
| 501 sent_initial_did_change_view_(false), | 502 sent_initial_did_change_view_(false), |
| 503 bound_graphics_3d_(NULL), | |
| 502 bound_graphics_2d_platform_(NULL), | 504 bound_graphics_2d_platform_(NULL), |
| 505 bound_compositor_(NULL), | |
| 503 has_webkit_focus_(false), | 506 has_webkit_focus_(false), |
| 504 has_content_area_focus_(false), | 507 has_content_area_focus_(false), |
| 505 find_identifier_(-1), | 508 find_identifier_(-1), |
| 506 plugin_find_interface_(NULL), | 509 plugin_find_interface_(NULL), |
| 507 plugin_input_event_interface_(NULL), | 510 plugin_input_event_interface_(NULL), |
| 508 plugin_mouse_lock_interface_(NULL), | 511 plugin_mouse_lock_interface_(NULL), |
| 509 plugin_pdf_interface_(NULL), | 512 plugin_pdf_interface_(NULL), |
| 510 plugin_private_interface_(NULL), | 513 plugin_private_interface_(NULL), |
| 511 plugin_selection_interface_(NULL), | 514 plugin_selection_interface_(NULL), |
| 512 plugin_textinput_interface_(NULL), | 515 plugin_textinput_interface_(NULL), |
| (...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 698 fullscreen_container_->InvalidateRect(rect); | 701 fullscreen_container_->InvalidateRect(rect); |
| 699 } else { | 702 } else { |
| 700 if (!container_ || view_data_.rect.size.width == 0 || | 703 if (!container_ || view_data_.rect.size.width == 0 || |
| 701 view_data_.rect.size.height == 0) | 704 view_data_.rect.size.height == 0) |
| 702 return; // Nothing to do. | 705 return; // Nothing to do. |
| 703 if (rect.IsEmpty()) | 706 if (rect.IsEmpty()) |
| 704 container_->invalidate(); | 707 container_->invalidate(); |
| 705 else | 708 else |
| 706 container_->invalidateRect(rect); | 709 container_->invalidateRect(rect); |
| 707 } | 710 } |
| 708 if (texture_layer_) { | 711 scoped_refptr<cc::Layer> layer = texture_layer_ ? |
| 712 static_cast<scoped_refptr<cc::Layer> >(texture_layer_) : | |
| 713 static_cast<scoped_refptr<cc::Layer> >(compositor_layer_); | |
| 714 if (layer) { | |
| 709 if (rect.IsEmpty()) { | 715 if (rect.IsEmpty()) { |
| 710 texture_layer_->SetNeedsDisplay(); | 716 layer->SetNeedsDisplay(); |
| 711 } else { | 717 } else { |
| 712 texture_layer_->SetNeedsDisplayRect(rect); | 718 layer->SetNeedsDisplayRect(rect); |
| 713 } | 719 } |
| 714 } | 720 } |
| 715 } | 721 } |
| 716 | 722 |
| 717 void PepperPluginInstanceImpl::ScrollRect(int dx, | 723 void PepperPluginInstanceImpl::ScrollRect(int dx, |
| 718 int dy, | 724 int dy, |
| 719 const gfx::Rect& rect) { | 725 const gfx::Rect& rect) { |
| 720 if (texture_layer_) { | 726 scoped_refptr<cc::Layer> layer = texture_layer_ ? |
| 727 static_cast<scoped_refptr<cc::Layer> >(texture_layer_) : | |
| 728 static_cast<scoped_refptr<cc::Layer> >(compositor_layer_); | |
| 729 if (layer) { | |
| 721 InvalidateRect(rect); | 730 InvalidateRect(rect); |
| 722 } else if (fullscreen_container_) { | 731 } else if (fullscreen_container_) { |
| 723 fullscreen_container_->ScrollRect(dx, dy, rect); | 732 fullscreen_container_->ScrollRect(dx, dy, rect); |
| 724 } else { | 733 } else { |
| 725 if (full_frame_ && !IsViewAccelerated()) { | 734 if (full_frame_ && !IsViewAccelerated()) { |
| 726 container_->scrollRect(dx, dy, rect); | 735 container_->scrollRect(dx, dy, rect); |
| 727 } else { | 736 } else { |
| 728 // Can't do optimized scrolling since there could be other elements on top | 737 // Can't do optimized scrolling since there could be other elements on top |
| 729 // of us or the view renders via the accelerated compositor which is | 738 // of us or the view renders via the accelerated compositor which is |
| 730 // incompatible with the move and backfill scrolling model. | 739 // incompatible with the move and backfill scrolling model. |
| (...skipping 422 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1153 new_clip = clip; | 1162 new_clip = clip; |
| 1154 | 1163 |
| 1155 cut_outs_rects_ = cut_outs_rects; | 1164 cut_outs_rects_ = cut_outs_rects; |
| 1156 | 1165 |
| 1157 view_data_.rect = PP_FromGfxRect(position); | 1166 view_data_.rect = PP_FromGfxRect(position); |
| 1158 view_data_.clip_rect = PP_FromGfxRect(clip); | 1167 view_data_.clip_rect = PP_FromGfxRect(clip); |
| 1159 view_data_.device_scale = container_->deviceScaleFactor(); | 1168 view_data_.device_scale = container_->deviceScaleFactor(); |
| 1160 view_data_.css_scale = | 1169 view_data_.css_scale = |
| 1161 container_->pageZoomFactor() * container_->pageScaleFactor(); | 1170 container_->pageZoomFactor() * container_->pageScaleFactor(); |
| 1162 | 1171 |
| 1172 if (texture_layer_) | |
| 1173 texture_layer_->SetBounds(position.size()); | |
|
raymes
2014/06/02 03:51:08
Why is this added?
Peng
2014/06/02 19:01:55
Oops!
Done.
| |
| 1174 | |
| 1163 if (desired_fullscreen_state_ || view_data_.is_fullscreen) { | 1175 if (desired_fullscreen_state_ || view_data_.is_fullscreen) { |
| 1164 WebElement element = container_->element(); | 1176 WebElement element = container_->element(); |
| 1165 WebDocument document = element.document(); | 1177 WebDocument document = element.document(); |
| 1166 bool is_fullscreen_element = (element == document.fullScreenElement()); | 1178 bool is_fullscreen_element = (element == document.fullScreenElement()); |
| 1167 if (!view_data_.is_fullscreen && desired_fullscreen_state_ && | 1179 if (!view_data_.is_fullscreen && desired_fullscreen_state_ && |
| 1168 render_frame()->GetRenderWidget()->is_fullscreen() && | 1180 render_frame()->GetRenderWidget()->is_fullscreen() && |
| 1169 is_fullscreen_element) { | 1181 is_fullscreen_element) { |
| 1170 // Entered fullscreen. Only possible via SetFullscreen(). | 1182 // Entered fullscreen. Only possible via SetFullscreen(). |
| 1171 view_data_.is_fullscreen = true; | 1183 view_data_.is_fullscreen = true; |
| 1172 } else if (view_data_.is_fullscreen && !is_fullscreen_element) { | 1184 } else if (view_data_.is_fullscreen && !is_fullscreen_element) { |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1226 // |view_data_| haven't been properly initialized. | 1238 // |view_data_| haven't been properly initialized. |
| 1227 if (sent_initial_did_change_view_) | 1239 if (sent_initial_did_change_view_) |
| 1228 SendDidChangeView(); | 1240 SendDidChangeView(); |
| 1229 } | 1241 } |
| 1230 | 1242 |
| 1231 void PepperPluginInstanceImpl::ViewInitiatedPaint() { | 1243 void PepperPluginInstanceImpl::ViewInitiatedPaint() { |
| 1232 if (bound_graphics_2d_platform_) | 1244 if (bound_graphics_2d_platform_) |
| 1233 bound_graphics_2d_platform_->ViewInitiatedPaint(); | 1245 bound_graphics_2d_platform_->ViewInitiatedPaint(); |
| 1234 else if (bound_graphics_3d_.get()) | 1246 else if (bound_graphics_3d_.get()) |
| 1235 bound_graphics_3d_->ViewInitiatedPaint(); | 1247 bound_graphics_3d_->ViewInitiatedPaint(); |
| 1248 else if (bound_compositor_) | |
| 1249 bound_compositor_->ViewInitiatedPaint(); | |
| 1236 } | 1250 } |
| 1237 | 1251 |
| 1238 void PepperPluginInstanceImpl::ViewFlushedPaint() { | 1252 void PepperPluginInstanceImpl::ViewFlushedPaint() { |
| 1239 // Keep a reference on the stack. See NOTE above. | 1253 // Keep a reference on the stack. See NOTE above. |
| 1240 scoped_refptr<PepperPluginInstanceImpl> ref(this); | 1254 scoped_refptr<PepperPluginInstanceImpl> ref(this); |
| 1241 if (bound_graphics_2d_platform_) | 1255 if (bound_graphics_2d_platform_) |
| 1242 bound_graphics_2d_platform_->ViewFlushedPaint(); | 1256 bound_graphics_2d_platform_->ViewFlushedPaint(); |
| 1243 else if (bound_graphics_3d_.get()) | 1257 else if (bound_graphics_3d_.get()) |
| 1244 bound_graphics_3d_->ViewFlushedPaint(); | 1258 bound_graphics_3d_->ViewFlushedPaint(); |
| 1259 else if (bound_compositor_) | |
| 1260 bound_compositor_->ViewFlushedPaint(); | |
| 1245 } | 1261 } |
| 1246 | 1262 |
| 1247 void PepperPluginInstanceImpl::SetSelectedText( | 1263 void PepperPluginInstanceImpl::SetSelectedText( |
| 1248 const base::string16& selected_text) { | 1264 const base::string16& selected_text) { |
| 1249 selected_text_ = selected_text; | 1265 selected_text_ = selected_text; |
| 1250 } | 1266 } |
| 1251 | 1267 |
| 1252 void PepperPluginInstanceImpl::SetLinkUnderCursor(const std::string& url) { | 1268 void PepperPluginInstanceImpl::SetLinkUnderCursor(const std::string& url) { |
| 1253 link_under_cursor_ = base::UTF8ToUTF16(url); | 1269 link_under_cursor_ = base::UTF8ToUTF16(url); |
| 1254 } | 1270 } |
| (...skipping 664 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1919 return; | 1935 return; |
| 1920 | 1936 |
| 1921 gpu::Mailbox mailbox; | 1937 gpu::Mailbox mailbox; |
| 1922 uint32 sync_point = 0; | 1938 uint32 sync_point = 0; |
| 1923 if (bound_graphics_3d_.get()) { | 1939 if (bound_graphics_3d_.get()) { |
| 1924 bound_graphics_3d_->GetBackingMailbox(&mailbox, &sync_point); | 1940 bound_graphics_3d_->GetBackingMailbox(&mailbox, &sync_point); |
| 1925 DCHECK_EQ(mailbox.IsZero(), sync_point == 0); | 1941 DCHECK_EQ(mailbox.IsZero(), sync_point == 0); |
| 1926 } | 1942 } |
| 1927 bool want_3d_layer = !mailbox.IsZero(); | 1943 bool want_3d_layer = !mailbox.IsZero(); |
| 1928 bool want_2d_layer = !!bound_graphics_2d_platform_; | 1944 bool want_2d_layer = !!bound_graphics_2d_platform_; |
| 1929 bool want_layer = want_3d_layer || want_2d_layer; | 1945 bool want_texture_layer = want_3d_layer || want_2d_layer; |
| 1946 bool want_compositor_layer = !!bound_compositor_; | |
| 1930 | 1947 |
| 1931 if ((want_layer == !!texture_layer_.get()) && | 1948 if ((want_texture_layer == !!texture_layer_.get()) && |
| 1932 (want_3d_layer == layer_is_hardware_) && | 1949 (want_3d_layer == layer_is_hardware_) && |
| 1933 layer_bound_to_fullscreen_ == !!fullscreen_container_) { | 1950 layer_bound_to_fullscreen_ == !!fullscreen_container_) { |
| 1934 UpdateLayerTransform(); | 1951 UpdateLayerTransform(); |
| 1935 return; | 1952 return; |
| 1936 } | 1953 } |
| 1937 | 1954 |
| 1938 if (texture_layer_) { | 1955 if (texture_layer_ || compositor_layer_) { |
| 1939 if (!layer_bound_to_fullscreen_) | 1956 if (!layer_bound_to_fullscreen_) |
| 1940 container_->setWebLayer(NULL); | 1957 container_->setWebLayer(NULL); |
| 1941 else if (fullscreen_container_) | 1958 else if (fullscreen_container_) |
| 1942 fullscreen_container_->SetLayer(NULL); | 1959 fullscreen_container_->SetLayer(NULL); |
| 1943 web_layer_.reset(); | 1960 web_layer_.reset(); |
| 1944 texture_layer_ = NULL; | 1961 texture_layer_ = NULL; |
| 1962 compositor_layer_ = NULL; | |
| 1945 } | 1963 } |
| 1946 if (want_layer) { | 1964 |
| 1965 if (want_texture_layer) { | |
| 1947 bool opaque = false; | 1966 bool opaque = false; |
| 1948 if (want_3d_layer) { | 1967 if (want_3d_layer) { |
| 1949 DCHECK(bound_graphics_3d_.get()); | 1968 DCHECK(bound_graphics_3d_.get()); |
| 1950 texture_layer_ = cc::TextureLayer::CreateForMailbox(NULL); | 1969 texture_layer_ = cc::TextureLayer::CreateForMailbox(NULL); |
| 1951 opaque = bound_graphics_3d_->IsOpaque(); | 1970 opaque = bound_graphics_3d_->IsOpaque(); |
| 1952 texture_layer_->SetTextureMailboxWithoutReleaseCallback( | 1971 texture_layer_->SetTextureMailboxWithoutReleaseCallback( |
| 1953 cc::TextureMailbox(mailbox, GL_TEXTURE_2D, sync_point)); | 1972 cc::TextureMailbox(mailbox, GL_TEXTURE_2D, sync_point)); |
| 1954 } else { | 1973 } else { |
| 1955 DCHECK(bound_graphics_2d_platform_); | 1974 DCHECK(bound_graphics_2d_platform_); |
| 1956 texture_layer_ = cc::TextureLayer::CreateForMailbox(this); | 1975 texture_layer_ = cc::TextureLayer::CreateForMailbox(this); |
| 1957 bound_graphics_2d_platform_->AttachedToNewLayer(); | 1976 bound_graphics_2d_platform_->AttachedToNewLayer(); |
| 1958 opaque = bound_graphics_2d_platform_->IsAlwaysOpaque(); | 1977 opaque = bound_graphics_2d_platform_->IsAlwaysOpaque(); |
| 1959 texture_layer_->SetFlipped(false); | 1978 texture_layer_->SetFlipped(false); |
| 1960 } | 1979 } |
| 1980 | |
| 1981 // Ignore transparency in fullscreen, since that's what Flash always | |
| 1982 // wants to do, and that lets it not recreate a context if | |
| 1983 // wmode=transparent was specified. | |
| 1984 opaque = opaque || fullscreen_container_; | |
| 1985 texture_layer_->SetContentsOpaque(opaque); | |
| 1961 web_layer_.reset(new webkit::WebLayerImpl(texture_layer_)); | 1986 web_layer_.reset(new webkit::WebLayerImpl(texture_layer_)); |
| 1987 } else if (want_compositor_layer) { | |
| 1988 compositor_layer_ = bound_compositor_->layer(); | |
| 1989 web_layer_.reset(new webkit::WebLayerImpl(compositor_layer_)); | |
| 1990 } | |
| 1991 | |
| 1992 if (web_layer_) { | |
| 1962 if (fullscreen_container_) { | 1993 if (fullscreen_container_) { |
| 1963 fullscreen_container_->SetLayer(web_layer_.get()); | 1994 fullscreen_container_->SetLayer(web_layer_.get()); |
| 1964 // Ignore transparency in fullscreen, since that's what Flash always | |
| 1965 // wants to do, and that lets it not recreate a context if | |
| 1966 // wmode=transparent was specified. | |
| 1967 texture_layer_->SetContentsOpaque(true); | |
| 1968 } else { | 1995 } else { |
| 1969 container_->setWebLayer(web_layer_.get()); | 1996 container_->setWebLayer(web_layer_.get()); |
| 1970 texture_layer_->SetContentsOpaque(opaque); | |
| 1971 } | 1997 } |
| 1972 } | 1998 } |
| 1999 | |
| 1973 layer_bound_to_fullscreen_ = !!fullscreen_container_; | 2000 layer_bound_to_fullscreen_ = !!fullscreen_container_; |
| 1974 layer_is_hardware_ = want_3d_layer; | 2001 layer_is_hardware_ = want_3d_layer; |
| 1975 UpdateLayerTransform(); | 2002 UpdateLayerTransform(); |
| 1976 } | 2003 } |
| 1977 | 2004 |
| 1978 bool PepperPluginInstanceImpl::PrepareTextureMailbox( | 2005 bool PepperPluginInstanceImpl::PrepareTextureMailbox( |
| 1979 cc::TextureMailbox* mailbox, | 2006 cc::TextureMailbox* mailbox, |
| 1980 scoped_ptr<cc::SingleReleaseCallback>* release_callback, | 2007 scoped_ptr<cc::SingleReleaseCallback>* release_callback, |
| 1981 bool use_shared_memory) { | 2008 bool use_shared_memory) { |
| 1982 if (!bound_graphics_2d_platform_) | 2009 if (!bound_graphics_2d_platform_) |
| (...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2129 // UpdateLayer(). | 2156 // UpdateLayer(). |
| 2130 scoped_refptr<ppapi::Resource> old_graphics = bound_graphics_3d_.get(); | 2157 scoped_refptr<ppapi::Resource> old_graphics = bound_graphics_3d_.get(); |
| 2131 if (bound_graphics_3d_.get()) { | 2158 if (bound_graphics_3d_.get()) { |
| 2132 bound_graphics_3d_->BindToInstance(false); | 2159 bound_graphics_3d_->BindToInstance(false); |
| 2133 bound_graphics_3d_ = NULL; | 2160 bound_graphics_3d_ = NULL; |
| 2134 } | 2161 } |
| 2135 if (bound_graphics_2d_platform_) { | 2162 if (bound_graphics_2d_platform_) { |
| 2136 bound_graphics_2d_platform_->BindToInstance(NULL); | 2163 bound_graphics_2d_platform_->BindToInstance(NULL); |
| 2137 bound_graphics_2d_platform_ = NULL; | 2164 bound_graphics_2d_platform_ = NULL; |
| 2138 } | 2165 } |
| 2166 if (bound_compositor_) { | |
| 2167 bound_compositor_->BindToInstance(NULL); | |
| 2168 bound_compositor_ = NULL; | |
| 2169 } | |
| 2139 | 2170 |
| 2140 // Special-case clearing the current device. | 2171 // Special-case clearing the current device. |
| 2141 if (!device) { | 2172 if (!device) { |
| 2142 UpdateLayer(); | 2173 UpdateLayer(); |
| 2143 InvalidateRect(gfx::Rect()); | 2174 InvalidateRect(gfx::Rect()); |
| 2144 return PP_TRUE; | 2175 return PP_TRUE; |
| 2145 } | 2176 } |
| 2146 | 2177 |
| 2147 // Refuse to bind if in transition to fullscreen with PPB_FlashFullscreen or | 2178 // Refuse to bind if in transition to fullscreen with PPB_FlashFullscreen or |
| 2148 // to/from fullscreen with PPB_Fullscreen. | 2179 // to/from fullscreen with PPB_Fullscreen. |
| 2149 if ((fullscreen_container_ && !flash_fullscreen_) || | 2180 if ((fullscreen_container_ && !flash_fullscreen_) || |
| 2150 desired_fullscreen_state_ != view_data_.is_fullscreen) | 2181 desired_fullscreen_state_ != view_data_.is_fullscreen) |
| 2151 return PP_FALSE; | 2182 return PP_FALSE; |
| 2152 | 2183 |
| 2153 const ppapi::host::PpapiHost* ppapi_host = | 2184 const ppapi::host::PpapiHost* ppapi_host = |
| 2154 RendererPpapiHost::GetForPPInstance(instance)->GetPpapiHost(); | 2185 RendererPpapiHost::GetForPPInstance(instance)->GetPpapiHost(); |
| 2155 ppapi::host::ResourceHost* host = ppapi_host->GetResourceHost(device); | 2186 ppapi::host::ResourceHost* host = ppapi_host->GetResourceHost(device); |
| 2156 PepperGraphics2DHost* graphics_2d = NULL; | 2187 PepperGraphics2DHost* graphics_2d = NULL; |
| 2188 PepperCompositorHost* compositor = NULL; | |
| 2157 if (host) { | 2189 if (host) { |
| 2158 if (host->IsGraphics2DHost()) | 2190 if (host->IsGraphics2DHost()) { |
| 2159 graphics_2d = static_cast<PepperGraphics2DHost*>(host); | 2191 graphics_2d = static_cast<PepperGraphics2DHost*>(host); |
| 2160 DLOG_IF(ERROR, !graphics_2d) << "Resource is not PepperGraphics2DHost."; | 2192 } else if (host->IsCompositorHost()) { |
| 2193 compositor = static_cast <PepperCompositorHost*>(host); | |
| 2194 } else { | |
| 2195 DLOG(ERROR) << | |
| 2196 "Resource is not PepperCompositorHost or PepperGraphics2DHost."; | |
| 2197 } | |
| 2161 } | 2198 } |
| 2162 | 2199 |
| 2163 EnterResourceNoLock<PPB_Graphics3D_API> enter_3d(device, false); | 2200 EnterResourceNoLock<PPB_Graphics3D_API> enter_3d(device, false); |
| 2164 PPB_Graphics3D_Impl* graphics_3d = | 2201 PPB_Graphics3D_Impl* graphics_3d = |
| 2165 enter_3d.succeeded() | 2202 enter_3d.succeeded() |
| 2166 ? static_cast<PPB_Graphics3D_Impl*>(enter_3d.object()) | 2203 ? static_cast<PPB_Graphics3D_Impl*>(enter_3d.object()) |
| 2167 : NULL; | 2204 : NULL; |
| 2168 | 2205 |
| 2169 if (graphics_2d) { | 2206 if (compositor) { |
| 2207 if (compositor->BindToInstance(this)) { | |
| 2208 bound_compositor_ = compositor; | |
| 2209 UpdateLayer(); | |
| 2210 return PP_TRUE; | |
| 2211 } | |
| 2212 } else if (graphics_2d) { | |
| 2170 if (graphics_2d->BindToInstance(this)) { | 2213 if (graphics_2d->BindToInstance(this)) { |
| 2171 bound_graphics_2d_platform_ = graphics_2d; | 2214 bound_graphics_2d_platform_ = graphics_2d; |
| 2172 UpdateLayer(); | 2215 UpdateLayer(); |
| 2173 return PP_TRUE; | 2216 return PP_TRUE; |
| 2174 } | 2217 } |
| 2175 } else if (graphics_3d) { | 2218 } else if (graphics_3d) { |
| 2176 // Make sure graphics can only be bound to the instance it is | 2219 // Make sure graphics can only be bound to the instance it is |
| 2177 // associated with. | 2220 // associated with. |
| 2178 if (graphics_3d->pp_instance() == pp_instance() && | 2221 if (graphics_3d->pp_instance() == pp_instance() && |
| 2179 graphics_3d->BindToInstance(true)) { | 2222 graphics_3d->BindToInstance(true)) { |
| (...skipping 958 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3138 // Running out-of-process. Initiate an IPC call to notify the plugin | 3181 // Running out-of-process. Initiate an IPC call to notify the plugin |
| 3139 // process. | 3182 // process. |
| 3140 ppapi::proxy::HostDispatcher* dispatcher = | 3183 ppapi::proxy::HostDispatcher* dispatcher = |
| 3141 ppapi::proxy::HostDispatcher::GetForInstance(pp_instance()); | 3184 ppapi::proxy::HostDispatcher::GetForInstance(pp_instance()); |
| 3142 dispatcher->Send(new PpapiMsg_PPPInstance_HandleDocumentLoad( | 3185 dispatcher->Send(new PpapiMsg_PPPInstance_HandleDocumentLoad( |
| 3143 ppapi::API_ID_PPP_INSTANCE, pp_instance(), pending_host_id, data)); | 3186 ppapi::API_ID_PPP_INSTANCE, pp_instance(), pending_host_id, data)); |
| 3144 } | 3187 } |
| 3145 } | 3188 } |
| 3146 | 3189 |
| 3147 } // namespace content | 3190 } // namespace content |
| OLD | NEW |