| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "webkit/plugins/ppapi/ppapi_plugin_instance.h" | 5 #include "webkit/plugins/ppapi/ppapi_plugin_instance.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "base/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
| 9 #include "base/message_loop.h" | 9 #include "base/message_loop.h" |
| 10 #include "base/metrics/histogram.h" | 10 #include "base/metrics/histogram.h" |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 45 #include "third_party/WebKit/Source/WebKit/chromium/public/WebPluginContainer.h" | 45 #include "third_party/WebKit/Source/WebKit/chromium/public/WebPluginContainer.h" |
| 46 #include "third_party/WebKit/Source/WebKit/chromium/public/WebRect.h" | 46 #include "third_party/WebKit/Source/WebKit/chromium/public/WebRect.h" |
| 47 #include "third_party/WebKit/Source/WebKit/chromium/public/WebString.h" | 47 #include "third_party/WebKit/Source/WebKit/chromium/public/WebString.h" |
| 48 #include "third_party/WebKit/Source/WebKit/chromium/public/WebURL.h" | 48 #include "third_party/WebKit/Source/WebKit/chromium/public/WebURL.h" |
| 49 #include "third_party/WebKit/Source/WebKit/chromium/public/WebURLRequest.h" | 49 #include "third_party/WebKit/Source/WebKit/chromium/public/WebURLRequest.h" |
| 50 #include "third_party/WebKit/Source/WebKit/chromium/public/WebView.h" | 50 #include "third_party/WebKit/Source/WebKit/chromium/public/WebView.h" |
| 51 #include "ui/gfx/rect.h" | 51 #include "ui/gfx/rect.h" |
| 52 #include "ui/gfx/skia_util.h" | 52 #include "ui/gfx/skia_util.h" |
| 53 #include "webkit/plugins/ppapi/common.h" | 53 #include "webkit/plugins/ppapi/common.h" |
| 54 #include "webkit/plugins/ppapi/event_conversion.h" | 54 #include "webkit/plugins/ppapi/event_conversion.h" |
| 55 #include "webkit/plugins/ppapi/fullscreen_container.h" |
| 55 #include "webkit/plugins/ppapi/message_channel.h" | 56 #include "webkit/plugins/ppapi/message_channel.h" |
| 56 #include "webkit/plugins/ppapi/npapi_glue.h" | 57 #include "webkit/plugins/ppapi/npapi_glue.h" |
| 57 #include "webkit/plugins/ppapi/plugin_delegate.h" | 58 #include "webkit/plugins/ppapi/plugin_delegate.h" |
| 58 #include "webkit/plugins/ppapi/plugin_module.h" | 59 #include "webkit/plugins/ppapi/plugin_module.h" |
| 59 #include "webkit/plugins/ppapi/plugin_object.h" | 60 #include "webkit/plugins/ppapi/plugin_object.h" |
| 60 #include "webkit/plugins/ppapi/ppb_buffer_impl.h" | 61 #include "webkit/plugins/ppapi/ppb_buffer_impl.h" |
| 61 #include "webkit/plugins/ppapi/ppb_graphics_2d_impl.h" | 62 #include "webkit/plugins/ppapi/ppb_graphics_2d_impl.h" |
| 62 #include "webkit/plugins/ppapi/ppb_graphics_3d_impl.h" | 63 #include "webkit/plugins/ppapi/ppb_graphics_3d_impl.h" |
| 63 #include "webkit/plugins/ppapi/ppb_image_data_impl.h" | 64 #include "webkit/plugins/ppapi/ppb_image_data_impl.h" |
| 64 #include "webkit/plugins/ppapi/ppb_surface_3d_impl.h" | 65 #include "webkit/plugins/ppapi/ppb_surface_3d_impl.h" |
| (...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 225 plugin_private_interface_(NULL), | 226 plugin_private_interface_(NULL), |
| 226 plugin_pdf_interface_(NULL), | 227 plugin_pdf_interface_(NULL), |
| 227 plugin_policy_updated_interface_(NULL), | 228 plugin_policy_updated_interface_(NULL), |
| 228 plugin_selection_interface_(NULL), | 229 plugin_selection_interface_(NULL), |
| 229 plugin_zoom_interface_(NULL), | 230 plugin_zoom_interface_(NULL), |
| 230 checked_for_plugin_input_event_interface_(false), | 231 checked_for_plugin_input_event_interface_(false), |
| 231 checked_for_plugin_messaging_interface_(false), | 232 checked_for_plugin_messaging_interface_(false), |
| 232 plugin_print_interface_(NULL), | 233 plugin_print_interface_(NULL), |
| 233 plugin_graphics_3d_interface_(NULL), | 234 plugin_graphics_3d_interface_(NULL), |
| 234 always_on_top_(false), | 235 always_on_top_(false), |
| 235 desired_fullscreen_state_(false), | 236 fullscreen_container_(NULL), |
| 236 fullscreen_(false), | 237 fullscreen_(false), |
| 237 message_channel_(NULL), | 238 message_channel_(NULL), |
| 238 sad_plugin_(NULL), | 239 sad_plugin_(NULL), |
| 239 input_event_mask_(0), | 240 input_event_mask_(0), |
| 240 filtered_input_event_mask_(0) { | 241 filtered_input_event_mask_(0) { |
| 241 pp_instance_ = ResourceTracker::Get()->AddInstance(this); | 242 pp_instance_ = ResourceTracker::Get()->AddInstance(this); |
| 242 | 243 |
| 243 memset(¤t_print_settings_, 0, sizeof(current_print_settings_)); | 244 memset(¤t_print_settings_, 0, sizeof(current_print_settings_)); |
| 244 DCHECK(delegate); | 245 DCHECK(delegate); |
| 245 module_->InstanceCreated(this); | 246 module_->InstanceCreated(this); |
| (...skipping 23 matching lines...) Expand all Loading... |
| 269 // account that the plugin may use Var to remove the <embed> from the DOM, which | 270 // account that the plugin may use Var to remove the <embed> from the DOM, which |
| 270 // will make the WebPluginImpl drop its reference, usually the last one. If a | 271 // will make the WebPluginImpl drop its reference, usually the last one. If a |
| 271 // method needs to access a member of the instance after the call has returned, | 272 // method needs to access a member of the instance after the call has returned, |
| 272 // then it needs to keep its own reference on the stack. | 273 // then it needs to keep its own reference on the stack. |
| 273 | 274 |
| 274 void PluginInstance::Delete() { | 275 void PluginInstance::Delete() { |
| 275 // Keep a reference on the stack. See NOTE above. | 276 // Keep a reference on the stack. See NOTE above. |
| 276 scoped_refptr<PluginInstance> ref(this); | 277 scoped_refptr<PluginInstance> ref(this); |
| 277 instance_interface_->DidDestroy(pp_instance()); | 278 instance_interface_->DidDestroy(pp_instance()); |
| 278 | 279 |
| 280 if (fullscreen_container_) { |
| 281 fullscreen_container_->Destroy(); |
| 282 fullscreen_container_ = NULL; |
| 283 } |
| 279 container_ = NULL; | 284 container_ = NULL; |
| 280 } | 285 } |
| 281 | 286 |
| 282 void PluginInstance::Paint(WebCanvas* canvas, | 287 void PluginInstance::Paint(WebCanvas* canvas, |
| 283 const gfx::Rect& plugin_rect, | 288 const gfx::Rect& plugin_rect, |
| 284 const gfx::Rect& paint_rect) { | 289 const gfx::Rect& paint_rect) { |
| 285 if (module()->is_crashed()) { | 290 if (module()->is_crashed()) { |
| 286 // Crashed plugin painting. | 291 // Crashed plugin painting. |
| 287 if (!sad_plugin_) // Lazily initialize bitmap. | 292 if (!sad_plugin_) // Lazily initialize bitmap. |
| 288 sad_plugin_ = delegate_->GetSadPluginBitmap(); | 293 sad_plugin_ = delegate_->GetSadPluginBitmap(); |
| 289 if (sad_plugin_) | 294 if (sad_plugin_) |
| 290 webkit::PaintSadPlugin(canvas, plugin_rect, *sad_plugin_); | 295 webkit::PaintSadPlugin(canvas, plugin_rect, *sad_plugin_); |
| 291 return; | 296 return; |
| 292 } | 297 } |
| 293 | 298 |
| 294 if (GetBoundGraphics2D()) | 299 if (GetBoundGraphics2D()) |
| 295 GetBoundGraphics2D()->Paint(canvas, plugin_rect, paint_rect); | 300 GetBoundGraphics2D()->Paint(canvas, plugin_rect, paint_rect); |
| 296 } | 301 } |
| 297 | 302 |
| 298 void PluginInstance::InvalidateRect(const gfx::Rect& rect) { | 303 void PluginInstance::InvalidateRect(const gfx::Rect& rect) { |
| 299 if (!container_ || position_.IsEmpty()) | 304 if (fullscreen_container_) { |
| 300 return; // Nothing to do. | 305 if (rect.IsEmpty()) |
| 301 if (rect.IsEmpty()) | 306 fullscreen_container_->Invalidate(); |
| 302 container_->invalidate(); | 307 else |
| 303 else | 308 fullscreen_container_->InvalidateRect(rect); |
| 304 container_->invalidateRect(rect); | 309 } else { |
| 310 if (!container_ || position_.IsEmpty()) |
| 311 return; // Nothing to do. |
| 312 if (rect.IsEmpty()) |
| 313 container_->invalidate(); |
| 314 else |
| 315 container_->invalidateRect(rect); |
| 316 } |
| 305 } | 317 } |
| 306 | 318 |
| 307 void PluginInstance::ScrollRect(int dx, int dy, const gfx::Rect& rect) { | 319 void PluginInstance::ScrollRect(int dx, int dy, const gfx::Rect& rect) { |
| 308 if (full_frame_) { | 320 if (fullscreen_container_) { |
| 309 container_->scrollRect(dx, dy, rect); | 321 fullscreen_container_->ScrollRect(dx, dy, rect); |
| 310 } else { | 322 } else { |
| 311 // Can't do optimized scrolling since there could be other elements on top | 323 if (full_frame_) { |
| 312 // of us. | 324 container_->scrollRect(dx, dy, rect); |
| 313 InvalidateRect(rect); | 325 } else { |
| 326 // Can't do optimized scrolling since there could be other elements on top |
| 327 // of us. |
| 328 InvalidateRect(rect); |
| 329 } |
| 314 } | 330 } |
| 315 } | 331 } |
| 316 | 332 |
| 317 unsigned PluginInstance::GetBackingTextureId() { | 333 unsigned PluginInstance::GetBackingTextureId() { |
| 318 if (GetBoundGraphics3D()) | 334 if (GetBoundGraphics3D()) |
| 319 return GetBoundGraphics3D()->GetBackingTextureId(); | 335 return GetBoundGraphics3D()->GetBackingTextureId(); |
| 320 else if (GetBoundSurface3D()) | 336 else if (GetBoundSurface3D()) |
| 321 return GetBoundSurface3D()->GetBackingTextureId(); | 337 return GetBoundSurface3D()->GetBackingTextureId(); |
| 322 | 338 |
| 323 return 0; | 339 return 0; |
| 324 } | 340 } |
| 325 | 341 |
| 326 void PluginInstance::CommitBackingTexture() { | 342 void PluginInstance::CommitBackingTexture() { |
| 327 container_->commitBackingTexture(); | 343 if (fullscreen_container_) |
| 344 fullscreen_container_->Invalidate(); |
| 345 else |
| 346 container_->commitBackingTexture(); |
| 328 } | 347 } |
| 329 | 348 |
| 330 void PluginInstance::InstanceCrashed() { | 349 void PluginInstance::InstanceCrashed() { |
| 331 // Force free all resources and vars. | 350 // Force free all resources and vars. |
| 332 ResourceTracker::Get()->InstanceCrashed(pp_instance()); | 351 ResourceTracker::Get()->InstanceCrashed(pp_instance()); |
| 333 | 352 |
| 334 // Free any associated graphics. | 353 // Free any associated graphics. |
| 335 SetFullscreen(false, false); | 354 SetFullscreen(false, false); |
| 336 bound_graphics_ = NULL; | 355 bound_graphics_ = NULL; |
| 337 InvalidateRect(gfx::Rect()); | 356 InvalidateRect(gfx::Rect()); |
| (...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 479 | 498 |
| 480 // If the plugin supports the private instance interface, try to retrieve its | 499 // If the plugin supports the private instance interface, try to retrieve its |
| 481 // instance object. | 500 // instance object. |
| 482 if (LoadPrivateInterface()) | 501 if (LoadPrivateInterface()) |
| 483 return plugin_private_interface_->GetInstanceObject(pp_instance()); | 502 return plugin_private_interface_->GetInstanceObject(pp_instance()); |
| 484 return PP_MakeUndefined(); | 503 return PP_MakeUndefined(); |
| 485 } | 504 } |
| 486 | 505 |
| 487 void PluginInstance::ViewChanged(const gfx::Rect& position, | 506 void PluginInstance::ViewChanged(const gfx::Rect& position, |
| 488 const gfx::Rect& clip) { | 507 const gfx::Rect& clip) { |
| 489 fullscreen_ = desired_fullscreen_state_; | 508 fullscreen_ = (fullscreen_container_ != NULL); |
| 490 position_ = position; | 509 position_ = position; |
| 491 | 510 |
| 492 if (clip.IsEmpty()) { | 511 if (clip.IsEmpty()) { |
| 493 // WebKit can give weird (x,y) positions for empty clip rects (since the | 512 // WebKit can give weird (x,y) positions for empty clip rects (since the |
| 494 // position technically doesn't matter). But we want to make these | 513 // position technically doesn't matter). But we want to make these |
| 495 // consistent since this is given to the plugin, so force everything to 0 | 514 // consistent since this is given to the plugin, so force everything to 0 |
| 496 // in the "everything is clipped" case. | 515 // in the "everything is clipped" case. |
| 497 clip_ = gfx::Rect(); | 516 clip_ = gfx::Rect(); |
| 498 } else { | 517 } else { |
| 499 clip_ = clip; | 518 clip_ = clip; |
| (...skipping 240 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 740 } | 759 } |
| 741 | 760 |
| 742 return !!plugin_zoom_interface_; | 761 return !!plugin_zoom_interface_; |
| 743 } | 762 } |
| 744 | 763 |
| 745 bool PluginInstance::PluginHasFocus() const { | 764 bool PluginInstance::PluginHasFocus() const { |
| 746 return has_webkit_focus_ && has_content_area_focus_; | 765 return has_webkit_focus_ && has_content_area_focus_; |
| 747 } | 766 } |
| 748 | 767 |
| 749 void PluginInstance::ReportGeometry() { | 768 void PluginInstance::ReportGeometry() { |
| 750 if (container_) | 769 // If this call was delayed, we may have transitioned back to fullscreen in |
| 770 // the mean time, so only report the geometry if we are actually in normal |
| 771 // mode. |
| 772 if (container_ && !fullscreen_container_) |
| 751 container_->reportGeometry(); | 773 container_->reportGeometry(); |
| 752 } | 774 } |
| 753 | 775 |
| 754 bool PluginInstance::GetPreferredPrintOutputFormat( | 776 bool PluginInstance::GetPreferredPrintOutputFormat( |
| 755 PP_PrintOutputFormat_Dev* format) { | 777 PP_PrintOutputFormat_Dev* format) { |
| 756 // Keep a reference on the stack. See NOTE above. | 778 // Keep a reference on the stack. See NOTE above. |
| 757 scoped_refptr<PluginInstance> ref(this); | 779 scoped_refptr<PluginInstance> ref(this); |
| 758 if (!LoadPrintInterface()) | 780 if (!LoadPrintInterface()) |
| 759 return false; | 781 return false; |
| 760 uint32_t supported_formats = | 782 uint32_t supported_formats = |
| (...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 859 if (plugin_print_interface_) | 881 if (plugin_print_interface_) |
| 860 plugin_print_interface_->End(pp_instance()); | 882 plugin_print_interface_->End(pp_instance()); |
| 861 | 883 |
| 862 memset(¤t_print_settings_, 0, sizeof(current_print_settings_)); | 884 memset(¤t_print_settings_, 0, sizeof(current_print_settings_)); |
| 863 #if defined(OS_MACOSX) | 885 #if defined(OS_MACOSX) |
| 864 last_printed_page_ = NULL; | 886 last_printed_page_ = NULL; |
| 865 #endif // defined(OS_MACOSX) | 887 #endif // defined(OS_MACOSX) |
| 866 } | 888 } |
| 867 | 889 |
| 868 bool PluginInstance::IsFullscreenOrPending() { | 890 bool PluginInstance::IsFullscreenOrPending() { |
| 869 return desired_fullscreen_state_; | 891 return fullscreen_container_ != NULL; |
| 870 } | 892 } |
| 871 | 893 |
| 872 void PluginInstance::SetFullscreen(bool fullscreen, bool delay_report) { | 894 void PluginInstance::SetFullscreen(bool fullscreen, bool delay_report) { |
| 873 // Keep a reference on the stack. See NOTE above. | 895 // Keep a reference on the stack. See NOTE above. |
| 874 scoped_refptr<PluginInstance> ref(this); | 896 scoped_refptr<PluginInstance> ref(this); |
| 875 | 897 |
| 876 // We check whether we are trying to switch to the state we're already going | 898 // We check whether we are trying to switch to the state we're already going |
| 877 // to (i.e. if we're already switching to fullscreen but the fullscreen | 899 // to (i.e. if we're already switching to fullscreen but the fullscreen |
| 878 // container isn't ready yet, don't do anything more). | 900 // container isn't ready yet, don't do anything more). |
| 879 if (fullscreen == IsFullscreenOrPending()) | 901 if (fullscreen == IsFullscreenOrPending()) |
| 880 return; | 902 return; |
| 881 | 903 |
| 882 desired_fullscreen_state_ = fullscreen; | 904 BindGraphics(pp_instance(), 0); |
| 883 if (fullscreen) | 905 VLOG(1) << "Setting fullscreen to " << (fullscreen ? "on" : "off"); |
| 884 container_->element().requestFullScreen(); | 906 if (fullscreen) { |
| 885 else | 907 DCHECK(!fullscreen_container_); |
| 886 container_->element().document().cancelFullScreen(); | 908 fullscreen_container_ = delegate_->CreateFullscreenContainer(this); |
| 887 if (!delay_report) { | |
| 888 ReportGeometry(); | |
| 889 } else { | 909 } else { |
| 890 MessageLoop::current()->PostTask( | 910 DCHECK(fullscreen_container_); |
| 911 fullscreen_container_->Destroy(); |
| 912 fullscreen_container_ = NULL; |
| 913 fullscreen_ = false; |
| 914 if (!delay_report) { |
| 915 ReportGeometry(); |
| 916 } else { |
| 917 MessageLoop::current()->PostTask( |
| 891 FROM_HERE, NewRunnableMethod(this, &PluginInstance::ReportGeometry)); | 918 FROM_HERE, NewRunnableMethod(this, &PluginInstance::ReportGeometry)); |
| 919 } |
| 892 } | 920 } |
| 893 } | 921 } |
| 894 | 922 |
| 895 int32_t PluginInstance::Navigate(PPB_URLRequestInfo_Impl* request, | 923 int32_t PluginInstance::Navigate(PPB_URLRequestInfo_Impl* request, |
| 896 const char* target, | 924 const char* target, |
| 897 bool from_user_action) { | 925 bool from_user_action) { |
| 898 if (!container_) | 926 if (!container_) |
| 899 return PP_ERROR_FAILED; | 927 return PP_ERROR_FAILED; |
| 900 | 928 |
| 901 WebDocument document = container_->element().document(); | 929 WebDocument document = container_->element().document(); |
| (...skipping 26 matching lines...) Expand all Loading... |
| 928 if (web_request.httpMethod() != "GET" && | 956 if (web_request.httpMethod() != "GET" && |
| 929 web_request.httpMethod() != "POST") | 957 web_request.httpMethod() != "POST") |
| 930 return PP_ERROR_BADARGUMENT; | 958 return PP_ERROR_BADARGUMENT; |
| 931 | 959 |
| 932 WebString target_str = WebString::fromUTF8(target); | 960 WebString target_str = WebString::fromUTF8(target); |
| 933 container_->loadFrameRequest(web_request, target_str, false, NULL); | 961 container_->loadFrameRequest(web_request, target_str, false, NULL); |
| 934 return PP_OK; | 962 return PP_OK; |
| 935 } | 963 } |
| 936 | 964 |
| 937 PluginDelegate::PlatformContext3D* PluginInstance::CreateContext3D() { | 965 PluginDelegate::PlatformContext3D* PluginInstance::CreateContext3D() { |
| 938 return delegate_->CreateContext3D(); | 966 if (fullscreen_container_) |
| 967 return fullscreen_container_->CreateContext3D(); |
| 968 else |
| 969 return delegate_->CreateContext3D(); |
| 939 } | 970 } |
| 940 | 971 |
| 941 bool PluginInstance::PrintPDFOutput(PP_Resource print_output, | 972 bool PluginInstance::PrintPDFOutput(PP_Resource print_output, |
| 942 WebKit::WebCanvas* canvas) { | 973 WebKit::WebCanvas* canvas) { |
| 943 ::ppapi::thunk::EnterResourceNoLock<PPB_Buffer_API> enter(print_output, true); | 974 ::ppapi::thunk::EnterResourceNoLock<PPB_Buffer_API> enter(print_output, true); |
| 944 if (enter.failed()) | 975 if (enter.failed()) |
| 945 return false; | 976 return false; |
| 946 | 977 |
| 947 BufferAutoMapper mapper(enter.object()); | 978 BufferAutoMapper mapper(enter.object()); |
| 948 if (!mapper.data() || !mapper.size()) { | 979 if (!mapper.data() || !mapper.size()) { |
| (...skipping 249 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1198 PPB_Surface3D_Impl* PluginInstance::GetBoundSurface3D() const { | 1229 PPB_Surface3D_Impl* PluginInstance::GetBoundSurface3D() const { |
| 1199 if (bound_graphics_.get() == NULL) | 1230 if (bound_graphics_.get() == NULL) |
| 1200 return NULL; | 1231 return NULL; |
| 1201 | 1232 |
| 1202 if (bound_graphics_->AsPPB_Surface3D_API()) | 1233 if (bound_graphics_->AsPPB_Surface3D_API()) |
| 1203 return static_cast<PPB_Surface3D_Impl*>(bound_graphics_.get()); | 1234 return static_cast<PPB_Surface3D_Impl*>(bound_graphics_.get()); |
| 1204 return NULL; | 1235 return NULL; |
| 1205 } | 1236 } |
| 1206 | 1237 |
| 1207 void PluginInstance::setBackingTextureId(unsigned int id) { | 1238 void PluginInstance::setBackingTextureId(unsigned int id) { |
| 1239 // If we have a full-screen container_ then the plugin is fullscreen, |
| 1240 // and the parent context is not the one for the browser page, but for the |
| 1241 // full-screen window, and so the parent texture ID doesn't correspond to |
| 1242 // anything in the page's context. |
| 1243 // |
| 1244 // TODO(alokp): It would be better at some point to have the equivalent |
| 1245 // in the FullscreenContainer so that we don't need to poll |
| 1246 if (fullscreen_container_) |
| 1247 return; |
| 1248 |
| 1208 if (container_) | 1249 if (container_) |
| 1209 container_->setBackingTextureId(id); | 1250 container_->setBackingTextureId(id); |
| 1210 } | 1251 } |
| 1211 | 1252 |
| 1212 void PluginInstance::AddPluginObject(PluginObject* plugin_object) { | 1253 void PluginInstance::AddPluginObject(PluginObject* plugin_object) { |
| 1213 DCHECK(live_plugin_objects_.find(plugin_object) == | 1254 DCHECK(live_plugin_objects_.find(plugin_object) == |
| 1214 live_plugin_objects_.end()); | 1255 live_plugin_objects_.end()); |
| 1215 live_plugin_objects_.insert(plugin_object); | 1256 live_plugin_objects_.insert(plugin_object); |
| 1216 } | 1257 } |
| 1217 | 1258 |
| (...skipping 25 matching lines...) Expand all Loading... |
| 1243 bound_graphics_ = NULL; | 1284 bound_graphics_ = NULL; |
| 1244 } | 1285 } |
| 1245 | 1286 |
| 1246 // Special-case clearing the current device. | 1287 // Special-case clearing the current device. |
| 1247 if (!device) { | 1288 if (!device) { |
| 1248 setBackingTextureId(0); | 1289 setBackingTextureId(0); |
| 1249 InvalidateRect(gfx::Rect()); | 1290 InvalidateRect(gfx::Rect()); |
| 1250 return PP_TRUE; | 1291 return PP_TRUE; |
| 1251 } | 1292 } |
| 1252 | 1293 |
| 1294 // Refuse to bind if we're transitioning to fullscreen. |
| 1295 if (fullscreen_container_ && !fullscreen_) |
| 1296 return PP_FALSE; |
| 1297 |
| 1253 EnterResourceNoLock<PPB_Graphics2D_API> enter_2d(device, false); | 1298 EnterResourceNoLock<PPB_Graphics2D_API> enter_2d(device, false); |
| 1254 PPB_Graphics2D_Impl* graphics_2d = enter_2d.succeeded() ? | 1299 PPB_Graphics2D_Impl* graphics_2d = enter_2d.succeeded() ? |
| 1255 static_cast<PPB_Graphics2D_Impl*>(enter_2d.object()) : NULL; | 1300 static_cast<PPB_Graphics2D_Impl*>(enter_2d.object()) : NULL; |
| 1256 EnterResourceNoLock<PPB_Graphics3D_API> enter_3d(device, false); | 1301 EnterResourceNoLock<PPB_Graphics3D_API> enter_3d(device, false); |
| 1257 PPB_Graphics3D_Impl* graphics_3d = enter_3d.succeeded() ? | 1302 PPB_Graphics3D_Impl* graphics_3d = enter_3d.succeeded() ? |
| 1258 static_cast<PPB_Graphics3D_Impl*>(enter_3d.object()) : NULL; | 1303 static_cast<PPB_Graphics3D_Impl*>(enter_3d.object()) : NULL; |
| 1259 EnterResourceNoLock<PPB_Surface3D_API> enter_surface_3d(device, false); | 1304 EnterResourceNoLock<PPB_Surface3D_API> enter_surface_3d(device, false); |
| 1260 PPB_Surface3D_Impl* surface_3d = enter_surface_3d.succeeded() ? | 1305 PPB_Surface3D_Impl* surface_3d = enter_surface_3d.succeeded() ? |
| 1261 static_cast<PPB_Surface3D_Impl*>(enter_surface_3d.object()) : NULL; | 1306 static_cast<PPB_Surface3D_Impl*>(enter_surface_3d.object()) : NULL; |
| 1262 | 1307 |
| (...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1430 void PluginInstance::PostMessage(PP_Instance instance, PP_Var message) { | 1475 void PluginInstance::PostMessage(PP_Instance instance, PP_Var message) { |
| 1431 message_channel_->PostMessageToJavaScript(message); | 1476 message_channel_->PostMessageToJavaScript(message); |
| 1432 } | 1477 } |
| 1433 | 1478 |
| 1434 void PluginInstance::SubscribeToPolicyUpdates(PP_Instance instance) { | 1479 void PluginInstance::SubscribeToPolicyUpdates(PP_Instance instance) { |
| 1435 delegate()->SubscribeToPolicyUpdates(this); | 1480 delegate()->SubscribeToPolicyUpdates(this); |
| 1436 } | 1481 } |
| 1437 | 1482 |
| 1438 void PluginInstance::DoSetCursor(WebCursorInfo* cursor) { | 1483 void PluginInstance::DoSetCursor(WebCursorInfo* cursor) { |
| 1439 cursor_.reset(cursor); | 1484 cursor_.reset(cursor); |
| 1485 if (fullscreen_container_) |
| 1486 fullscreen_container_->DidChangeCursor(*cursor); |
| 1440 } | 1487 } |
| 1441 | 1488 |
| 1442 } // namespace ppapi | 1489 } // namespace ppapi |
| 1443 } // namespace webkit | 1490 } // namespace webkit |
| OLD | NEW |