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