| 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/npapi/webplugin_impl.h" | 5 #include "webkit/plugins/npapi/webplugin_impl.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/logging.h" | 8 #include "base/logging.h" |
| 9 #include "base/memory/linked_ptr.h" | 9 #include "base/memory/linked_ptr.h" |
| 10 #include "base/message_loop.h" | 10 #include "base/message_loop.h" |
| (...skipping 471 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 482 for (size_t i = 0; i < params.attributeNames.size(); ++i) { | 482 for (size_t i = 0; i < params.attributeNames.size(); ++i) { |
| 483 arg_names_.push_back(params.attributeNames[i].utf8()); | 483 arg_names_.push_back(params.attributeNames[i].utf8()); |
| 484 arg_values_.push_back(params.attributeValues[i].utf8()); | 484 arg_values_.push_back(params.attributeValues[i].utf8()); |
| 485 } | 485 } |
| 486 } | 486 } |
| 487 | 487 |
| 488 WebPluginImpl::~WebPluginImpl() { | 488 WebPluginImpl::~WebPluginImpl() { |
| 489 } | 489 } |
| 490 | 490 |
| 491 void WebPluginImpl::SetWindow(gfx::PluginWindowHandle window) { | 491 void WebPluginImpl::SetWindow(gfx::PluginWindowHandle window) { |
| 492 #if defined(OS_MACOSX) | |
| 493 // The only time this is called twice, and the second time with a | |
| 494 // non-zero PluginWindowHandle, is the case when this WebPluginImpl | |
| 495 // is created on behalf of the GPU plugin. This entire code path | |
| 496 // will go away soon, as soon as the GPU plugin becomes the GPU | |
| 497 // process, so it is being separated out for easy deletion. | |
| 498 | |
| 499 // The logic we want here is: if (window) DCHECK(!window_); | |
| 500 DCHECK(!(window_ && window)); | |
| 501 window_ = window; | |
| 502 // Lie to ourselves about being windowless even if we got a fake | |
| 503 // plugin window handle, so we continue to get input events. | |
| 504 windowless_ = true; | |
| 505 accepts_input_events_ = true; | |
| 506 // We do not really need to notify the page delegate that a plugin | |
| 507 // window was created -- so don't. | |
| 508 #else | |
| 509 if (window) { | 492 if (window) { |
| 510 DCHECK(!windowless_); | 493 DCHECK(!windowless_); |
| 511 window_ = window; | 494 window_ = window; |
| 495 #if defined(OS_MACOSX) |
| 496 // TODO(kbr): remove. http://crbug.com/105344 |
| 497 |
| 498 // Lie to ourselves about being windowless even if we got a fake |
| 499 // plugin window handle, so we continue to get input events. |
| 500 windowless_ = true; |
| 501 accepts_input_events_ = true; |
| 502 // We do not really need to notify the page delegate that a plugin |
| 503 // window was created -- so don't. |
| 504 #else |
| 512 accepts_input_events_ = false; | 505 accepts_input_events_ = false; |
| 513 if (page_delegate_) { | 506 if (page_delegate_) { |
| 514 // Tell the view delegate that the plugin window was created, so that it | 507 // Tell the view delegate that the plugin window was created, so that it |
| 515 // can create necessary container widgets. | 508 // can create necessary container widgets. |
| 516 page_delegate_->CreatedPluginWindow(window); | 509 page_delegate_->CreatedPluginWindow(window); |
| 517 } | 510 } |
| 511 #endif |
| 518 } else { | 512 } else { |
| 519 DCHECK(!window_); // Make sure not called twice. | 513 DCHECK(!window_); // Make sure not called twice. |
| 520 windowless_ = true; | 514 windowless_ = true; |
| 521 accepts_input_events_ = true; | 515 accepts_input_events_ = true; |
| 522 } | 516 } |
| 523 #endif | |
| 524 } | 517 } |
| 525 | 518 |
| 526 void WebPluginImpl::SetAcceptsInputEvents(bool accepts) { | 519 void WebPluginImpl::SetAcceptsInputEvents(bool accepts) { |
| 527 accepts_input_events_ = accepts; | 520 accepts_input_events_ = accepts; |
| 528 } | 521 } |
| 529 | 522 |
| 530 void WebPluginImpl::WillDestroyWindow(gfx::PluginWindowHandle window) { | 523 void WebPluginImpl::WillDestroyWindow(gfx::PluginWindowHandle window) { |
| 531 DCHECK_EQ(window, window_); | 524 DCHECK_EQ(window, window_); |
| 532 window_ = gfx::kNullPluginWindow; | 525 window_ = gfx::kNullPluginWindow; |
| 533 if (page_delegate_) | 526 if (page_delegate_) |
| (...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 747 clients_[i].loader->cancel(); | 740 clients_[i].loader->cancel(); |
| 748 if (clients_[i].client) | 741 if (clients_[i].client) |
| 749 clients_[i].client->DidFail(); | 742 clients_[i].client->DidFail(); |
| 750 } | 743 } |
| 751 } | 744 } |
| 752 break; | 745 break; |
| 753 } | 746 } |
| 754 } | 747 } |
| 755 } | 748 } |
| 756 | 749 |
| 750 #if defined(OS_MACOSX) |
| 751 void WebPluginImpl::AcceleratedPluginEnabledRendering() { |
| 752 } |
| 753 |
| 754 void WebPluginImpl::AcceleratedPluginAllocatedIOSurface(int32 width, |
| 755 int32 height, |
| 756 uint32 surface_id) { |
| 757 next_io_surface_allocated_ = true; |
| 758 next_io_surface_width_ = width; |
| 759 next_io_surface_height_ = height; |
| 760 next_io_surface_id_ = surface_id; |
| 761 } |
| 762 |
| 763 void WebPluginImpl::AcceleratedPluginSwappedIOSurface() { |
| 764 if (container_) { |
| 765 // Deferring the call to setBackingIOSurfaceId is an attempt to |
| 766 // work around garbage occasionally showing up in the plugin's |
| 767 // area during live resizing of Core Animation plugins. The |
| 768 // assumption was that by the time this was called, the plugin |
| 769 // process would have populated the newly allocated IOSurface. It |
| 770 // is not 100% clear at this point why any garbage is getting |
| 771 // through. More investigation is needed. http://crbug.com/105346 |
| 772 if (next_io_surface_allocated_) { |
| 773 container_->setBackingIOSurfaceId(next_io_surface_width_, |
| 774 next_io_surface_height_, |
| 775 next_io_surface_id_); |
| 776 next_io_surface_allocated_ = false; |
| 777 } |
| 778 container_->commitBackingTexture(); |
| 779 } |
| 780 } |
| 781 #endif |
| 782 |
| 757 void WebPluginImpl::Invalidate() { | 783 void WebPluginImpl::Invalidate() { |
| 758 if (container_) | 784 if (container_) |
| 759 container_->invalidate(); | 785 container_->invalidate(); |
| 760 } | 786 } |
| 761 | 787 |
| 762 void WebPluginImpl::InvalidateRect(const gfx::Rect& rect) { | 788 void WebPluginImpl::InvalidateRect(const gfx::Rect& rect) { |
| 763 if (container_) | 789 if (container_) |
| 764 container_->invalidateRect(rect); | 790 container_->invalidateRect(rect); |
| 765 } | 791 } |
| 766 | 792 |
| (...skipping 598 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1365 webframe_->setReferrerForRequest(*request, plugin_url_); | 1391 webframe_->setReferrerForRequest(*request, plugin_url_); |
| 1366 break; | 1392 break; |
| 1367 | 1393 |
| 1368 default: | 1394 default: |
| 1369 break; | 1395 break; |
| 1370 } | 1396 } |
| 1371 } | 1397 } |
| 1372 | 1398 |
| 1373 } // namespace npapi | 1399 } // namespace npapi |
| 1374 } // namespace webkit | 1400 } // namespace webkit |
| OLD | NEW |