| 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 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 43 #include "third_party/WebKit/Source/WebKit/chromium/public/WebPluginContainer.h" | 43 #include "third_party/WebKit/Source/WebKit/chromium/public/WebPluginContainer.h" |
| 44 #include "third_party/WebKit/Source/WebKit/chromium/public/WebRect.h" | 44 #include "third_party/WebKit/Source/WebKit/chromium/public/WebRect.h" |
| 45 #include "third_party/WebKit/Source/WebKit/chromium/public/WebString.h" | 45 #include "third_party/WebKit/Source/WebKit/chromium/public/WebString.h" |
| 46 #include "third_party/WebKit/Source/WebKit/chromium/public/WebURL.h" | 46 #include "third_party/WebKit/Source/WebKit/chromium/public/WebURL.h" |
| 47 #include "third_party/WebKit/Source/WebKit/chromium/public/WebURLRequest.h" | 47 #include "third_party/WebKit/Source/WebKit/chromium/public/WebURLRequest.h" |
| 48 #include "third_party/WebKit/Source/WebKit/chromium/public/WebView.h" | 48 #include "third_party/WebKit/Source/WebKit/chromium/public/WebView.h" |
| 49 #include "ui/gfx/rect.h" | 49 #include "ui/gfx/rect.h" |
| 50 #include "ui/gfx/skia_util.h" | 50 #include "ui/gfx/skia_util.h" |
| 51 #include "webkit/plugins/ppapi/common.h" | 51 #include "webkit/plugins/ppapi/common.h" |
| 52 #include "webkit/plugins/ppapi/event_conversion.h" | 52 #include "webkit/plugins/ppapi/event_conversion.h" |
| 53 #include "webkit/plugins/ppapi/fullscreen_container.h" | |
| 54 #include "webkit/plugins/ppapi/message_channel.h" | 53 #include "webkit/plugins/ppapi/message_channel.h" |
| 55 #include "webkit/plugins/ppapi/npapi_glue.h" | 54 #include "webkit/plugins/ppapi/npapi_glue.h" |
| 56 #include "webkit/plugins/ppapi/plugin_delegate.h" | 55 #include "webkit/plugins/ppapi/plugin_delegate.h" |
| 57 #include "webkit/plugins/ppapi/plugin_module.h" | 56 #include "webkit/plugins/ppapi/plugin_module.h" |
| 58 #include "webkit/plugins/ppapi/plugin_object.h" | 57 #include "webkit/plugins/ppapi/plugin_object.h" |
| 59 #include "webkit/plugins/ppapi/ppb_buffer_impl.h" | 58 #include "webkit/plugins/ppapi/ppb_buffer_impl.h" |
| 60 #include "webkit/plugins/ppapi/ppb_graphics_2d_impl.h" | 59 #include "webkit/plugins/ppapi/ppb_graphics_2d_impl.h" |
| 61 #include "webkit/plugins/ppapi/ppb_graphics_3d_impl.h" | 60 #include "webkit/plugins/ppapi/ppb_graphics_3d_impl.h" |
| 62 #include "webkit/plugins/ppapi/ppb_image_data_impl.h" | 61 #include "webkit/plugins/ppapi/ppb_image_data_impl.h" |
| 63 #include "webkit/plugins/ppapi/ppb_input_event_impl.h" | 62 #include "webkit/plugins/ppapi/ppb_input_event_impl.h" |
| (...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 223 plugin_private_interface_(NULL), | 222 plugin_private_interface_(NULL), |
| 224 plugin_pdf_interface_(NULL), | 223 plugin_pdf_interface_(NULL), |
| 225 plugin_policy_updated_interface_(NULL), | 224 plugin_policy_updated_interface_(NULL), |
| 226 plugin_selection_interface_(NULL), | 225 plugin_selection_interface_(NULL), |
| 227 plugin_zoom_interface_(NULL), | 226 plugin_zoom_interface_(NULL), |
| 228 checked_for_plugin_input_event_interface_(false), | 227 checked_for_plugin_input_event_interface_(false), |
| 229 checked_for_plugin_messaging_interface_(false), | 228 checked_for_plugin_messaging_interface_(false), |
| 230 plugin_print_interface_(NULL), | 229 plugin_print_interface_(NULL), |
| 231 plugin_graphics_3d_interface_(NULL), | 230 plugin_graphics_3d_interface_(NULL), |
| 232 always_on_top_(false), | 231 always_on_top_(false), |
| 233 fullscreen_container_(NULL), | 232 desired_fullscreen_state_(false), |
| 234 fullscreen_(false), | 233 fullscreen_(false), |
| 235 message_channel_(NULL), | 234 message_channel_(NULL), |
| 236 sad_plugin_(NULL), | 235 sad_plugin_(NULL), |
| 237 input_event_mask_(0), | 236 input_event_mask_(0), |
| 238 filtered_input_event_mask_(0) { | 237 filtered_input_event_mask_(0) { |
| 239 pp_instance_ = ResourceTracker::Get()->AddInstance(this); | 238 pp_instance_ = ResourceTracker::Get()->AddInstance(this); |
| 240 | 239 |
| 241 memset(¤t_print_settings_, 0, sizeof(current_print_settings_)); | 240 memset(¤t_print_settings_, 0, sizeof(current_print_settings_)); |
| 242 DCHECK(delegate); | 241 DCHECK(delegate); |
| 243 module_->InstanceCreated(this); | 242 module_->InstanceCreated(this); |
| (...skipping 23 matching lines...) Expand all Loading... |
| 267 // account that the plugin may use Var to remove the <embed> from the DOM, which | 266 // account that the plugin may use Var to remove the <embed> from the DOM, which |
| 268 // will make the WebPluginImpl drop its reference, usually the last one. If a | 267 // will make the WebPluginImpl drop its reference, usually the last one. If a |
| 269 // method needs to access a member of the instance after the call has returned, | 268 // method needs to access a member of the instance after the call has returned, |
| 270 // then it needs to keep its own reference on the stack. | 269 // then it needs to keep its own reference on the stack. |
| 271 | 270 |
| 272 void PluginInstance::Delete() { | 271 void PluginInstance::Delete() { |
| 273 // Keep a reference on the stack. See NOTE above. | 272 // Keep a reference on the stack. See NOTE above. |
| 274 scoped_refptr<PluginInstance> ref(this); | 273 scoped_refptr<PluginInstance> ref(this); |
| 275 instance_interface_->DidDestroy(pp_instance()); | 274 instance_interface_->DidDestroy(pp_instance()); |
| 276 | 275 |
| 277 if (fullscreen_container_) { | |
| 278 fullscreen_container_->Destroy(); | |
| 279 fullscreen_container_ = NULL; | |
| 280 } | |
| 281 container_ = NULL; | 276 container_ = NULL; |
| 282 } | 277 } |
| 283 | 278 |
| 284 void PluginInstance::Paint(WebCanvas* canvas, | 279 void PluginInstance::Paint(WebCanvas* canvas, |
| 285 const gfx::Rect& plugin_rect, | 280 const gfx::Rect& plugin_rect, |
| 286 const gfx::Rect& paint_rect) { | 281 const gfx::Rect& paint_rect) { |
| 287 if (module()->is_crashed()) { | 282 if (module()->is_crashed()) { |
| 288 // Crashed plugin painting. | 283 // Crashed plugin painting. |
| 289 if (!sad_plugin_) // Lazily initialize bitmap. | 284 if (!sad_plugin_) // Lazily initialize bitmap. |
| 290 sad_plugin_ = delegate_->GetSadPluginBitmap(); | 285 sad_plugin_ = delegate_->GetSadPluginBitmap(); |
| 291 if (sad_plugin_) | 286 if (sad_plugin_) |
| 292 webkit::PaintSadPlugin(canvas, plugin_rect, *sad_plugin_); | 287 webkit::PaintSadPlugin(canvas, plugin_rect, *sad_plugin_); |
| 293 return; | 288 return; |
| 294 } | 289 } |
| 295 | 290 |
| 296 if (GetBoundGraphics2D()) | 291 if (GetBoundGraphics2D()) |
| 297 GetBoundGraphics2D()->Paint(canvas, plugin_rect, paint_rect); | 292 GetBoundGraphics2D()->Paint(canvas, plugin_rect, paint_rect); |
| 298 } | 293 } |
| 299 | 294 |
| 300 void PluginInstance::InvalidateRect(const gfx::Rect& rect) { | 295 void PluginInstance::InvalidateRect(const gfx::Rect& rect) { |
| 301 if (fullscreen_container_) { | 296 if (!container_ || position_.IsEmpty()) |
| 302 if (rect.IsEmpty()) | 297 return; // Nothing to do. |
| 303 fullscreen_container_->Invalidate(); | 298 if (rect.IsEmpty()) |
| 304 else | 299 container_->invalidate(); |
| 305 fullscreen_container_->InvalidateRect(rect); | 300 else |
| 301 container_->invalidateRect(rect); |
| 302 } |
| 303 |
| 304 void PluginInstance::ScrollRect(int dx, int dy, const gfx::Rect& rect) { |
| 305 if (full_frame_) { |
| 306 container_->scrollRect(dx, dy, rect); |
| 306 } else { | 307 } else { |
| 307 if (!container_ || position_.IsEmpty()) | 308 // Can't do optimized scrolling since there could be other elements on top |
| 308 return; // Nothing to do. | 309 // of us. |
| 309 if (rect.IsEmpty()) | 310 InvalidateRect(rect); |
| 310 container_->invalidate(); | |
| 311 else | |
| 312 container_->invalidateRect(rect); | |
| 313 } | 311 } |
| 314 } | 312 } |
| 315 | 313 |
| 316 void PluginInstance::ScrollRect(int dx, int dy, const gfx::Rect& rect) { | |
| 317 if (fullscreen_container_) { | |
| 318 fullscreen_container_->ScrollRect(dx, dy, rect); | |
| 319 } else { | |
| 320 if (full_frame_) { | |
| 321 container_->scrollRect(dx, dy, rect); | |
| 322 } else { | |
| 323 // Can't do optimized scrolling since there could be other elements on top | |
| 324 // of us. | |
| 325 InvalidateRect(rect); | |
| 326 } | |
| 327 } | |
| 328 } | |
| 329 | |
| 330 unsigned PluginInstance::GetBackingTextureId() { | 314 unsigned PluginInstance::GetBackingTextureId() { |
| 331 if (GetBoundGraphics3D()) | 315 if (GetBoundGraphics3D()) |
| 332 return GetBoundGraphics3D()->GetBackingTextureId(); | 316 return GetBoundGraphics3D()->GetBackingTextureId(); |
| 333 else if (GetBoundSurface3D()) | 317 else if (GetBoundSurface3D()) |
| 334 return GetBoundSurface3D()->GetBackingTextureId(); | 318 return GetBoundSurface3D()->GetBackingTextureId(); |
| 335 | 319 |
| 336 return 0; | 320 return 0; |
| 337 } | 321 } |
| 338 | 322 |
| 339 void PluginInstance::CommitBackingTexture() { | 323 void PluginInstance::CommitBackingTexture() { |
| 340 if (fullscreen_container_) | 324 container_->commitBackingTexture(); |
| 341 fullscreen_container_->Invalidate(); | |
| 342 else | |
| 343 container_->commitBackingTexture(); | |
| 344 } | 325 } |
| 345 | 326 |
| 346 void PluginInstance::InstanceCrashed() { | 327 void PluginInstance::InstanceCrashed() { |
| 347 // Force free all resources and vars. | 328 // Force free all resources and vars. |
| 348 ResourceTracker::Get()->InstanceCrashed(pp_instance()); | 329 ResourceTracker::Get()->InstanceCrashed(pp_instance()); |
| 349 | 330 |
| 350 // Free any associated graphics. | 331 // Free any associated graphics. |
| 351 SetFullscreen(false, false); | 332 SetFullscreen(false, false); |
| 352 bound_graphics_ = NULL; | 333 bound_graphics_ = NULL; |
| 353 InvalidateRect(gfx::Rect()); | 334 InvalidateRect(gfx::Rect()); |
| (...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 496 | 477 |
| 497 // If the plugin supports the private instance interface, try to retrieve its | 478 // If the plugin supports the private instance interface, try to retrieve its |
| 498 // instance object. | 479 // instance object. |
| 499 if (LoadPrivateInterface()) | 480 if (LoadPrivateInterface()) |
| 500 return plugin_private_interface_->GetInstanceObject(pp_instance()); | 481 return plugin_private_interface_->GetInstanceObject(pp_instance()); |
| 501 return PP_MakeUndefined(); | 482 return PP_MakeUndefined(); |
| 502 } | 483 } |
| 503 | 484 |
| 504 void PluginInstance::ViewChanged(const gfx::Rect& position, | 485 void PluginInstance::ViewChanged(const gfx::Rect& position, |
| 505 const gfx::Rect& clip) { | 486 const gfx::Rect& clip) { |
| 506 fullscreen_ = (fullscreen_container_ != NULL); | 487 fullscreen_ = desired_fullscreen_state_; |
| 507 position_ = position; | 488 position_ = position; |
| 508 | 489 |
| 509 if (clip.IsEmpty()) { | 490 if (clip.IsEmpty()) { |
| 510 // WebKit can give weird (x,y) positions for empty clip rects (since the | 491 // WebKit can give weird (x,y) positions for empty clip rects (since the |
| 511 // position technically doesn't matter). But we want to make these | 492 // position technically doesn't matter). But we want to make these |
| 512 // consistent since this is given to the plugin, so force everything to 0 | 493 // consistent since this is given to the plugin, so force everything to 0 |
| 513 // in the "everything is clipped" case. | 494 // in the "everything is clipped" case. |
| 514 clip_ = gfx::Rect(); | 495 clip_ = gfx::Rect(); |
| 515 } else { | 496 } else { |
| 516 clip_ = clip; | 497 clip_ = clip; |
| (...skipping 251 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 768 } | 749 } |
| 769 | 750 |
| 770 return !!plugin_zoom_interface_; | 751 return !!plugin_zoom_interface_; |
| 771 } | 752 } |
| 772 | 753 |
| 773 bool PluginInstance::PluginHasFocus() const { | 754 bool PluginInstance::PluginHasFocus() const { |
| 774 return has_webkit_focus_ && has_content_area_focus_; | 755 return has_webkit_focus_ && has_content_area_focus_; |
| 775 } | 756 } |
| 776 | 757 |
| 777 void PluginInstance::ReportGeometry() { | 758 void PluginInstance::ReportGeometry() { |
| 778 // If this call was delayed, we may have transitioned back to fullscreen in | 759 if (container_) |
| 779 // the mean time, so only report the geometry if we are actually in normal | |
| 780 // mode. | |
| 781 if (container_ && !fullscreen_container_) | |
| 782 container_->reportGeometry(); | 760 container_->reportGeometry(); |
| 783 } | 761 } |
| 784 | 762 |
| 785 bool PluginInstance::GetPreferredPrintOutputFormat( | 763 bool PluginInstance::GetPreferredPrintOutputFormat( |
| 786 PP_PrintOutputFormat_Dev_0_4* format) { | 764 PP_PrintOutputFormat_Dev_0_4* format) { |
| 787 // Keep a reference on the stack. See NOTE above. | 765 // Keep a reference on the stack. See NOTE above. |
| 788 scoped_refptr<PluginInstance> ref(this); | 766 scoped_refptr<PluginInstance> ref(this); |
| 789 if (!LoadPrintInterface()) | 767 if (!LoadPrintInterface()) |
| 790 return false; | 768 return false; |
| 791 if (plugin_print_interface_->QuerySupportedFormats) { | 769 if (plugin_print_interface_->QuerySupportedFormats) { |
| (...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 947 if (plugin_print_interface_.get()) | 925 if (plugin_print_interface_.get()) |
| 948 plugin_print_interface_->End(pp_instance()); | 926 plugin_print_interface_->End(pp_instance()); |
| 949 | 927 |
| 950 memset(¤t_print_settings_, 0, sizeof(current_print_settings_)); | 928 memset(¤t_print_settings_, 0, sizeof(current_print_settings_)); |
| 951 #if defined(OS_MACOSX) | 929 #if defined(OS_MACOSX) |
| 952 last_printed_page_ = NULL; | 930 last_printed_page_ = NULL; |
| 953 #endif // defined(OS_MACOSX) | 931 #endif // defined(OS_MACOSX) |
| 954 } | 932 } |
| 955 | 933 |
| 956 bool PluginInstance::IsFullscreenOrPending() { | 934 bool PluginInstance::IsFullscreenOrPending() { |
| 957 return fullscreen_container_ != NULL; | 935 return desired_fullscreen_state_; |
| 958 } | 936 } |
| 959 | 937 |
| 960 void PluginInstance::SetFullscreen(bool fullscreen, bool delay_report) { | 938 void PluginInstance::SetFullscreen(bool fullscreen, bool delay_report) { |
| 961 // Keep a reference on the stack. See NOTE above. | 939 // Keep a reference on the stack. See NOTE above. |
| 962 scoped_refptr<PluginInstance> ref(this); | 940 scoped_refptr<PluginInstance> ref(this); |
| 963 | 941 |
| 964 // We check whether we are trying to switch to the state we're already going | 942 // We check whether we are trying to switch to the state we're already going |
| 965 // to (i.e. if we're already switching to fullscreen but the fullscreen | 943 // to (i.e. if we're already switching to fullscreen but the fullscreen |
| 966 // container isn't ready yet, don't do anything more). | 944 // container isn't ready yet, don't do anything more). |
| 967 if (fullscreen == IsFullscreenOrPending()) | 945 if (fullscreen == IsFullscreenOrPending()) |
| 968 return; | 946 return; |
| 969 | 947 |
| 970 BindGraphics(pp_instance(), 0); | 948 desired_fullscreen_state_ = fullscreen; |
| 971 VLOG(1) << "Setting fullscreen to " << (fullscreen ? "on" : "off"); | 949 delegate_->SetFullscreen(this, fullscreen); |
| 972 if (fullscreen) { | 950 if (!delay_report) { |
| 973 DCHECK(!fullscreen_container_); | 951 ReportGeometry(); |
| 974 fullscreen_container_ = delegate_->CreateFullscreenContainer(this); | |
| 975 } else { | 952 } else { |
| 976 DCHECK(fullscreen_container_); | 953 MessageLoop::current()->PostTask( |
| 977 fullscreen_container_->Destroy(); | |
| 978 fullscreen_container_ = NULL; | |
| 979 fullscreen_ = false; | |
| 980 if (!delay_report) { | |
| 981 ReportGeometry(); | |
| 982 } else { | |
| 983 MessageLoop::current()->PostTask( | |
| 984 FROM_HERE, NewRunnableMethod(this, &PluginInstance::ReportGeometry)); | 954 FROM_HERE, NewRunnableMethod(this, &PluginInstance::ReportGeometry)); |
| 985 } | |
| 986 } | 955 } |
| 987 } | 956 } |
| 988 | 957 |
| 989 int32_t PluginInstance::Navigate(PPB_URLRequestInfo_Impl* request, | 958 int32_t PluginInstance::Navigate(PPB_URLRequestInfo_Impl* request, |
| 990 const char* target, | 959 const char* target, |
| 991 bool from_user_action) { | 960 bool from_user_action) { |
| 992 if (!container_) | 961 if (!container_) |
| 993 return PP_ERROR_FAILED; | 962 return PP_ERROR_FAILED; |
| 994 | 963 |
| 995 WebDocument document = container_->element().document(); | 964 WebDocument document = container_->element().document(); |
| (...skipping 23 matching lines...) Expand all Loading... |
| 1019 if (web_request.httpMethod() != "GET" && | 988 if (web_request.httpMethod() != "GET" && |
| 1020 web_request.httpMethod() != "POST") | 989 web_request.httpMethod() != "POST") |
| 1021 return PP_ERROR_BADARGUMENT; | 990 return PP_ERROR_BADARGUMENT; |
| 1022 | 991 |
| 1023 WebString target_str = WebString::fromUTF8(target); | 992 WebString target_str = WebString::fromUTF8(target); |
| 1024 container_->loadFrameRequest(web_request, target_str, false, NULL); | 993 container_->loadFrameRequest(web_request, target_str, false, NULL); |
| 1025 return PP_OK; | 994 return PP_OK; |
| 1026 } | 995 } |
| 1027 | 996 |
| 1028 PluginDelegate::PlatformContext3D* PluginInstance::CreateContext3D() { | 997 PluginDelegate::PlatformContext3D* PluginInstance::CreateContext3D() { |
| 1029 if (fullscreen_container_) | 998 return delegate_->CreateContext3D(); |
| 1030 return fullscreen_container_->CreateContext3D(); | |
| 1031 else | |
| 1032 return delegate_->CreateContext3D(); | |
| 1033 } | 999 } |
| 1034 | 1000 |
| 1035 bool PluginInstance::PrintPDFOutput(PP_Resource print_output, | 1001 bool PluginInstance::PrintPDFOutput(PP_Resource print_output, |
| 1036 WebKit::WebCanvas* canvas) { | 1002 WebKit::WebCanvas* canvas) { |
| 1037 ::ppapi::thunk::EnterResourceNoLock<PPB_Buffer_API> enter(print_output, true); | 1003 ::ppapi::thunk::EnterResourceNoLock<PPB_Buffer_API> enter(print_output, true); |
| 1038 if (enter.failed()) | 1004 if (enter.failed()) |
| 1039 return false; | 1005 return false; |
| 1040 | 1006 |
| 1041 BufferAutoMapper mapper(enter.object()); | 1007 BufferAutoMapper mapper(enter.object()); |
| 1042 if (!mapper.data() || !mapper.size()) { | 1008 if (!mapper.data() || !mapper.size()) { |
| (...skipping 249 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1292 PPB_Surface3D_Impl* PluginInstance::GetBoundSurface3D() const { | 1258 PPB_Surface3D_Impl* PluginInstance::GetBoundSurface3D() const { |
| 1293 if (bound_graphics_.get() == NULL) | 1259 if (bound_graphics_.get() == NULL) |
| 1294 return NULL; | 1260 return NULL; |
| 1295 | 1261 |
| 1296 if (bound_graphics_->AsPPB_Surface3D_API()) | 1262 if (bound_graphics_->AsPPB_Surface3D_API()) |
| 1297 return static_cast<PPB_Surface3D_Impl*>(bound_graphics_.get()); | 1263 return static_cast<PPB_Surface3D_Impl*>(bound_graphics_.get()); |
| 1298 return NULL; | 1264 return NULL; |
| 1299 } | 1265 } |
| 1300 | 1266 |
| 1301 void PluginInstance::setBackingTextureId(unsigned int id) { | 1267 void PluginInstance::setBackingTextureId(unsigned int id) { |
| 1302 // If we have a full-screen container_ then the plugin is fullscreen, | |
| 1303 // and the parent context is not the one for the browser page, but for the | |
| 1304 // full-screen window, and so the parent texture ID doesn't correspond to | |
| 1305 // anything in the page's context. | |
| 1306 // | |
| 1307 // TODO(alokp): It would be better at some point to have the equivalent | |
| 1308 // in the FullscreenContainer so that we don't need to poll | |
| 1309 if (fullscreen_container_) | |
| 1310 return; | |
| 1311 | |
| 1312 if (container_) | 1268 if (container_) |
| 1313 container_->setBackingTextureId(id); | 1269 container_->setBackingTextureId(id); |
| 1314 } | 1270 } |
| 1315 | 1271 |
| 1316 void PluginInstance::AddPluginObject(PluginObject* plugin_object) { | 1272 void PluginInstance::AddPluginObject(PluginObject* plugin_object) { |
| 1317 DCHECK(live_plugin_objects_.find(plugin_object) == | 1273 DCHECK(live_plugin_objects_.find(plugin_object) == |
| 1318 live_plugin_objects_.end()); | 1274 live_plugin_objects_.end()); |
| 1319 live_plugin_objects_.insert(plugin_object); | 1275 live_plugin_objects_.insert(plugin_object); |
| 1320 } | 1276 } |
| 1321 | 1277 |
| (...skipping 25 matching lines...) Expand all Loading... |
| 1347 bound_graphics_ = NULL; | 1303 bound_graphics_ = NULL; |
| 1348 } | 1304 } |
| 1349 | 1305 |
| 1350 // Special-case clearing the current device. | 1306 // Special-case clearing the current device. |
| 1351 if (!device) { | 1307 if (!device) { |
| 1352 setBackingTextureId(0); | 1308 setBackingTextureId(0); |
| 1353 InvalidateRect(gfx::Rect()); | 1309 InvalidateRect(gfx::Rect()); |
| 1354 return PP_TRUE; | 1310 return PP_TRUE; |
| 1355 } | 1311 } |
| 1356 | 1312 |
| 1357 // Refuse to bind if we're transitioning to fullscreen. | |
| 1358 if (fullscreen_container_ && !fullscreen_) | |
| 1359 return PP_FALSE; | |
| 1360 | |
| 1361 EnterResourceNoLock<PPB_Graphics2D_API> enter_2d(device, false); | 1313 EnterResourceNoLock<PPB_Graphics2D_API> enter_2d(device, false); |
| 1362 PPB_Graphics2D_Impl* graphics_2d = enter_2d.succeeded() ? | 1314 PPB_Graphics2D_Impl* graphics_2d = enter_2d.succeeded() ? |
| 1363 static_cast<PPB_Graphics2D_Impl*>(enter_2d.object()) : NULL; | 1315 static_cast<PPB_Graphics2D_Impl*>(enter_2d.object()) : NULL; |
| 1364 EnterResourceNoLock<PPB_Graphics3D_API> enter_3d(device, false); | 1316 EnterResourceNoLock<PPB_Graphics3D_API> enter_3d(device, false); |
| 1365 PPB_Graphics3D_Impl* graphics_3d = enter_3d.succeeded() ? | 1317 PPB_Graphics3D_Impl* graphics_3d = enter_3d.succeeded() ? |
| 1366 static_cast<PPB_Graphics3D_Impl*>(enter_3d.object()) : NULL; | 1318 static_cast<PPB_Graphics3D_Impl*>(enter_3d.object()) : NULL; |
| 1367 EnterResourceNoLock<PPB_Surface3D_API> enter_surface_3d(device, false); | 1319 EnterResourceNoLock<PPB_Surface3D_API> enter_surface_3d(device, false); |
| 1368 PPB_Surface3D_Impl* surface_3d = enter_surface_3d.succeeded() ? | 1320 PPB_Surface3D_Impl* surface_3d = enter_surface_3d.succeeded() ? |
| 1369 static_cast<PPB_Surface3D_Impl*>(enter_surface_3d.object()) : NULL; | 1321 static_cast<PPB_Surface3D_Impl*>(enter_surface_3d.object()) : NULL; |
| 1370 | 1322 |
| (...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1538 void PluginInstance::PostMessage(PP_Instance instance, PP_Var message) { | 1490 void PluginInstance::PostMessage(PP_Instance instance, PP_Var message) { |
| 1539 message_channel_->PostMessageToJavaScript(message); | 1491 message_channel_->PostMessageToJavaScript(message); |
| 1540 } | 1492 } |
| 1541 | 1493 |
| 1542 void PluginInstance::SubscribeToPolicyUpdates(PP_Instance instance) { | 1494 void PluginInstance::SubscribeToPolicyUpdates(PP_Instance instance) { |
| 1543 delegate()->SubscribeToPolicyUpdates(this); | 1495 delegate()->SubscribeToPolicyUpdates(this); |
| 1544 } | 1496 } |
| 1545 | 1497 |
| 1546 void PluginInstance::DoSetCursor(WebCursorInfo* cursor) { | 1498 void PluginInstance::DoSetCursor(WebCursorInfo* cursor) { |
| 1547 cursor_.reset(cursor); | 1499 cursor_.reset(cursor); |
| 1548 if (fullscreen_container_) | |
| 1549 fullscreen_container_->DidChangeCursor(*cursor); | |
| 1550 } | 1500 } |
| 1551 | 1501 |
| 1552 } // namespace ppapi | 1502 } // namespace ppapi |
| 1553 } // namespace webkit | 1503 } // namespace webkit |
| OLD | NEW |