| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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 #define PEPPER_APIS_ENABLED 1 | 5 #define PEPPER_APIS_ENABLED 1 |
| 6 | 6 |
| 7 #include "chrome/renderer/webplugin_delegate_pepper.h" | 7 #include "chrome/renderer/webplugin_delegate_pepper.h" |
| 8 | 8 |
| 9 #include <string> | 9 #include <string> |
| 10 #include <vector> | 10 #include <vector> |
| 11 | 11 |
| 12 #include "app/gfx/blit.h" | 12 #include "app/gfx/blit.h" |
| 13 #include "base/file_util.h" | 13 #include "base/file_util.h" |
| 14 #include "base/message_loop.h" | 14 #include "base/message_loop.h" |
| 15 #include "base/process_util.h" | 15 #include "base/process_util.h" |
| 16 #include "base/scoped_ptr.h" | 16 #include "base/scoped_ptr.h" |
| 17 #include "base/stats_counters.h" | 17 #include "base/stats_counters.h" |
| 18 #include "base/string_util.h" | 18 #include "base/string_util.h" |
| 19 #include "chrome/common/render_messages.h" | 19 #include "chrome/common/render_messages.h" |
| 20 #include "chrome/renderer/render_thread.h" | 20 #include "chrome/renderer/render_thread.h" |
| 21 #include "chrome/renderer/webplugin_delegate_proxy.h" |
| 21 #include "third_party/npapi/bindings/npapi_extensions.h" | 22 #include "third_party/npapi/bindings/npapi_extensions.h" |
| 22 #include "third_party/WebKit/WebKit/chromium/public/WebInputEvent.h" | 23 #include "third_party/WebKit/WebKit/chromium/public/WebInputEvent.h" |
| 23 #include "webkit/glue/glue_util.h" | 24 #include "webkit/glue/glue_util.h" |
| 24 #include "webkit/glue/plugins/plugin_constants_win.h" | 25 #include "webkit/glue/plugins/plugin_constants_win.h" |
| 25 #include "webkit/glue/plugins/plugin_instance.h" | 26 #include "webkit/glue/plugins/plugin_instance.h" |
| 26 #include "webkit/glue/plugins/plugin_lib.h" | 27 #include "webkit/glue/plugins/plugin_lib.h" |
| 27 #include "webkit/glue/plugins/plugin_list.h" | 28 #include "webkit/glue/plugins/plugin_list.h" |
| 28 #include "webkit/glue/plugins/plugin_stream_url.h" | 29 #include "webkit/glue/plugins/plugin_stream_url.h" |
| 29 #include "webkit/glue/webkit_glue.h" | 30 #include "webkit/glue/webkit_glue.h" |
| 30 | 31 |
| 32 #if defined(ENABLE_GPU) |
| 33 #include "webkit/glue/plugins/plugin_constants_win.h" |
| 34 #endif |
| 35 |
| 36 using gpu::Buffer; |
| 31 using webkit_glue::WebPlugin; | 37 using webkit_glue::WebPlugin; |
| 32 using webkit_glue::WebPluginDelegate; | 38 using webkit_glue::WebPluginDelegate; |
| 33 using webkit_glue::WebPluginResourceClient; | 39 using webkit_glue::WebPluginResourceClient; |
| 34 using WebKit::WebCursorInfo; | 40 using WebKit::WebCursorInfo; |
| 35 using WebKit::WebKeyboardEvent; | 41 using WebKit::WebKeyboardEvent; |
| 36 using WebKit::WebInputEvent; | 42 using WebKit::WebInputEvent; |
| 37 using WebKit::WebMouseEvent; | 43 using WebKit::WebMouseEvent; |
| 38 using WebKit::WebMouseWheelEvent; | 44 using WebKit::WebMouseWheelEvent; |
| 39 | 45 |
| 40 namespace { | 46 namespace { |
| 41 | 47 |
| 42 const uint32 kBytesPerPixel = 4; // Only 8888 RGBA for now. | 48 const uint32 kBytesPerPixel = 4; // Only 8888 RGBA for now. |
| 43 | 49 |
| 44 } // namespace | 50 } // namespace |
| 45 | 51 |
| 46 // Implementation artifacts for a context | 52 // Implementation artifacts for a context |
| 47 struct Device2DImpl { | 53 struct Device2DImpl { |
| 48 TransportDIB* dib; | 54 TransportDIB* dib; |
| 49 }; | 55 }; |
| 50 | 56 |
| 51 uint32 WebPluginDelegatePepper::next_buffer_id = 0; | 57 uint32 WebPluginDelegatePepper::next_buffer_id = 0; |
| 52 | 58 |
| 53 WebPluginDelegatePepper* WebPluginDelegatePepper::Create( | 59 WebPluginDelegatePepper* WebPluginDelegatePepper::Create( |
| 54 const FilePath& filename, | 60 const FilePath& filename, |
| 55 const std::string& mime_type, | 61 const std::string& mime_type, |
| 62 const base::WeakPtr<RenderView>& render_view, |
| 56 gfx::PluginWindowHandle containing_view) { | 63 gfx::PluginWindowHandle containing_view) { |
| 57 scoped_refptr<NPAPI::PluginLib> plugin_lib = | 64 scoped_refptr<NPAPI::PluginLib> plugin_lib = |
| 58 NPAPI::PluginLib::CreatePluginLib(filename); | 65 NPAPI::PluginLib::CreatePluginLib(filename); |
| 59 if (plugin_lib.get() == NULL) | 66 if (plugin_lib.get() == NULL) |
| 60 return NULL; | 67 return NULL; |
| 61 | 68 |
| 62 NPError err = plugin_lib->NP_Initialize(); | 69 NPError err = plugin_lib->NP_Initialize(); |
| 63 if (err != NPERR_NO_ERROR) | 70 if (err != NPERR_NO_ERROR) |
| 64 return NULL; | 71 return NULL; |
| 65 | 72 |
| 66 scoped_refptr<NPAPI::PluginInstance> instance = | 73 scoped_refptr<NPAPI::PluginInstance> instance = |
| 67 plugin_lib->CreateInstance(mime_type); | 74 plugin_lib->CreateInstance(mime_type); |
| 68 return new WebPluginDelegatePepper(containing_view, instance.get()); | 75 return new WebPluginDelegatePepper(render_view, |
| 76 containing_view, |
| 77 instance.get()); |
| 69 } | 78 } |
| 70 | 79 |
| 71 bool WebPluginDelegatePepper::Initialize( | 80 bool WebPluginDelegatePepper::Initialize( |
| 72 const GURL& url, | 81 const GURL& url, |
| 73 const std::vector<std::string>& arg_names, | 82 const std::vector<std::string>& arg_names, |
| 74 const std::vector<std::string>& arg_values, | 83 const std::vector<std::string>& arg_values, |
| 75 WebPlugin* plugin, | 84 WebPlugin* plugin, |
| 76 bool load_manually) { | 85 bool load_manually) { |
| 77 plugin_ = plugin; | 86 plugin_ = plugin; |
| 78 | 87 |
| (...skipping 12 matching lines...) Expand all Loading... |
| 91 if (!start_result) | 100 if (!start_result) |
| 92 return false; | 101 return false; |
| 93 | 102 |
| 94 // For windowless plugins we should set the containing window handle | 103 // For windowless plugins we should set the containing window handle |
| 95 // as the instance window handle. This is what Safari does. Not having | 104 // as the instance window handle. This is what Safari does. Not having |
| 96 // a valid window handle causes subtle bugs with plugins which retreive | 105 // a valid window handle causes subtle bugs with plugins which retreive |
| 97 // the window handle and validate the same. The window handle can be | 106 // the window handle and validate the same. The window handle can be |
| 98 // retreived via NPN_GetValue of NPNVnetscapeWindow. | 107 // retreived via NPN_GetValue of NPNVnetscapeWindow. |
| 99 instance_->set_window_handle(parent_); | 108 instance_->set_window_handle(parent_); |
| 100 | 109 |
| 101 // This is a windowless plugin, so set it to have a NULL handle. | |
| 102 plugin_->SetWindow(NULL); | |
| 103 | |
| 104 plugin_url_ = url.spec(); | 110 plugin_url_ = url.spec(); |
| 105 | 111 |
| 106 return true; | 112 return true; |
| 107 } | 113 } |
| 108 | 114 |
| 109 void WebPluginDelegatePepper::DestroyInstance() { | 115 void WebPluginDelegatePepper::DestroyInstance() { |
| 110 if (instance_ && (instance_->npp()->ndata != NULL)) { | 116 if (instance_ && (instance_->npp()->ndata != NULL)) { |
| 111 // Shutdown all streams before destroying so that | 117 // Shutdown all streams before destroying so that |
| 112 // no streams are left "in progress". Need to do | 118 // no streams are left "in progress". Need to do |
| 113 // this before calling set_web_plugin(NULL) because the | 119 // this before calling set_web_plugin(NULL) because the |
| (...skipping 26 matching lines...) Expand all Loading... |
| 140 window_rect_ = window_rect; | 146 window_rect_ = window_rect; |
| 141 | 147 |
| 142 // TODO(brettw) figure out how to tell the plugin that the size changed and it | 148 // TODO(brettw) figure out how to tell the plugin that the size changed and it |
| 143 // needs to repaint? | 149 // needs to repaint? |
| 144 SkBitmap new_committed; | 150 SkBitmap new_committed; |
| 145 new_committed.setConfig(SkBitmap::kARGB_8888_Config, | 151 new_committed.setConfig(SkBitmap::kARGB_8888_Config, |
| 146 window_rect_.width(), window_rect.height()); | 152 window_rect_.width(), window_rect.height()); |
| 147 new_committed.allocPixels(); | 153 new_committed.allocPixels(); |
| 148 committed_bitmap_ = new_committed; | 154 committed_bitmap_ = new_committed; |
| 149 | 155 |
| 156 // Forward the new geometry to the nested plugin instance. |
| 157 if (nested_delegate_) |
| 158 nested_delegate_->UpdateGeometry(window_rect, clip_rect); |
| 159 |
| 150 if (!instance()) | 160 if (!instance()) |
| 151 return; | 161 return; |
| 152 | 162 |
| 153 // TODO(sehr): do we need all this? | 163 // TODO(sehr): do we need all this? |
| 154 window_.clipRect.top = clip_rect_.y(); | 164 window_.clipRect.top = clip_rect_.y(); |
| 155 window_.clipRect.left = clip_rect_.x(); | 165 window_.clipRect.left = clip_rect_.x(); |
| 156 window_.clipRect.bottom = clip_rect_.y() + clip_rect_.height(); | 166 window_.clipRect.bottom = clip_rect_.y() + clip_rect_.height(); |
| 157 window_.clipRect.right = clip_rect_.x() + clip_rect_.width(); | 167 window_.clipRect.right = clip_rect_.x() + clip_rect_.width(); |
| 158 window_.height = window_rect_.height(); | 168 window_.height = window_rect_.height(); |
| 159 window_.width = window_rect_.width(); | 169 window_.width = window_rect_.width(); |
| (...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 240 | 250 |
| 241 NPError WebPluginDelegatePepper::Device2DQueryConfig( | 251 NPError WebPluginDelegatePepper::Device2DQueryConfig( |
| 242 const NPDeviceContext2DConfig* request, | 252 const NPDeviceContext2DConfig* request, |
| 243 NPDeviceContext2DConfig* obtain) { | 253 NPDeviceContext2DConfig* obtain) { |
| 244 return NPERR_GENERIC_ERROR; | 254 return NPERR_GENERIC_ERROR; |
| 245 } | 255 } |
| 246 | 256 |
| 247 NPError WebPluginDelegatePepper::Device2DInitializeContext( | 257 NPError WebPluginDelegatePepper::Device2DInitializeContext( |
| 248 const NPDeviceContext2DConfig* config, | 258 const NPDeviceContext2DConfig* config, |
| 249 NPDeviceContext2D* context) { | 259 NPDeviceContext2D* context) { |
| 260 // This is a windowless plugin, so set it to have a NULL handle. Defer this |
| 261 // until we know the plugin will use the 2D device. If it uses the 3D device |
| 262 // it will have a window handle. |
| 263 plugin_->SetWindow(NULL); |
| 264 |
| 250 int width = window_rect_.width(); | 265 int width = window_rect_.width(); |
| 251 int height = window_rect_.height(); | 266 int height = window_rect_.height(); |
| 252 uint32 buffer_size = width * height * kBytesPerPixel; | 267 uint32 buffer_size = width * height * kBytesPerPixel; |
| 253 | 268 |
| 254 // Initialize the impelementation information in case of failure. | 269 // Initialize the impelementation information in case of failure. |
| 255 context->reserved = NULL; | 270 context->reserved = NULL; |
| 256 | 271 |
| 257 // Allocate the transport DIB and the PlatformCanvas pointing to it. | 272 // Allocate the transport DIB and the PlatformCanvas pointing to it. |
| 258 scoped_ptr<OpenPaintContext> paint_context(new OpenPaintContext); | 273 scoped_ptr<OpenPaintContext> paint_context(new OpenPaintContext); |
| 259 paint_context->transport_dib.reset( | 274 paint_context->transport_dib.reset( |
| (...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 385 | 400 |
| 386 NPError WebPluginDelegatePepper::Device3DQueryConfig( | 401 NPError WebPluginDelegatePepper::Device3DQueryConfig( |
| 387 const NPDeviceContext3DConfig* request, | 402 const NPDeviceContext3DConfig* request, |
| 388 NPDeviceContext3DConfig* obtain) { | 403 NPDeviceContext3DConfig* obtain) { |
| 389 return NPERR_GENERIC_ERROR; | 404 return NPERR_GENERIC_ERROR; |
| 390 } | 405 } |
| 391 | 406 |
| 392 NPError WebPluginDelegatePepper::Device3DInitializeContext( | 407 NPError WebPluginDelegatePepper::Device3DInitializeContext( |
| 393 const NPDeviceContext3DConfig* config, | 408 const NPDeviceContext3DConfig* config, |
| 394 NPDeviceContext3D* context) { | 409 NPDeviceContext3D* context) { |
| 410 #if defined(ENABLE_GPU) |
| 411 // Check to see if the GPU plugin is already initialized and fail if so. |
| 412 if (nested_delegate_) |
| 413 return NPERR_GENERIC_ERROR; |
| 414 |
| 415 // Create an instance of the GPU plugin that is responsible for 3D |
| 416 // rendering. |
| 417 nested_delegate_ = new WebPluginDelegateProxy(kGPUPluginMimeType, |
| 418 render_view_); |
| 419 |
| 420 // TODO(apatrick): should the GPU plugin be attached to plugin_? |
| 421 if (nested_delegate_->Initialize(GURL(), |
| 422 std::vector<std::string>(), |
| 423 std::vector<std::string>(), |
| 424 plugin_, |
| 425 false)) { |
| 426 // Ask the GPU plugin to create a command buffer and return a proxy. |
| 427 command_buffer_.reset(nested_delegate_->CreateCommandBuffer()); |
| 428 if (command_buffer_.get()) { |
| 429 // Initialize the proxy command buffer. |
| 430 if (command_buffer_->Initialize(config->commandBufferEntries)) { |
| 431 // Initialize the 3D context. |
| 432 context->reserved = NULL; |
| 433 Buffer ring_buffer = command_buffer_->GetRingBuffer(); |
| 434 context->commandBuffer = ring_buffer.ptr; |
| 435 context->commandBufferEntries = command_buffer_->GetSize(); |
| 436 context->getOffset = command_buffer_->GetGetOffset(); |
| 437 context->putOffset = command_buffer_->GetPutOffset(); |
| 438 |
| 439 // Ensure the service knows the window size before rendering anything. |
| 440 nested_delegate_->UpdateGeometry(window_rect_, clip_rect_); |
| 441 |
| 442 return NPERR_NO_ERROR; |
| 443 } |
| 444 } |
| 445 |
| 446 command_buffer_.reset(); |
| 447 } |
| 448 |
| 449 nested_delegate_->PluginDestroyed(); |
| 450 nested_delegate_ = NULL; |
| 451 #endif // ENABLE_GPU |
| 452 |
| 395 return NPERR_GENERIC_ERROR; | 453 return NPERR_GENERIC_ERROR; |
| 396 } | 454 } |
| 397 | 455 |
| 398 NPError WebPluginDelegatePepper::Device3DSetStateContext( | 456 NPError WebPluginDelegatePepper::Device3DSetStateContext( |
| 399 NPDeviceContext3D* context, | 457 NPDeviceContext3D* context, |
| 400 int32 state, | 458 int32 state, |
| 401 int32 value) { | 459 int32 value) { |
| 402 return NPERR_GENERIC_ERROR; | 460 return NPERR_GENERIC_ERROR; |
| 403 } | 461 } |
| 404 | 462 |
| 405 NPError WebPluginDelegatePepper::Device3DGetStateContext( | 463 NPError WebPluginDelegatePepper::Device3DGetStateContext( |
| 406 NPDeviceContext3D* context, | 464 NPDeviceContext3D* context, |
| 407 int32 state, | 465 int32 state, |
| 408 int32* value) { | 466 int32* value) { |
| 409 return NPERR_GENERIC_ERROR; | 467 #if defined(ENABLE_GPU) |
| 468 if (!command_buffer_.get()) |
| 469 return NPERR_GENERIC_ERROR; |
| 470 |
| 471 switch (state) { |
| 472 case NPDeviceContext3DState_GetOffset: |
| 473 context->getOffset = *value = command_buffer_->GetGetOffset(); |
| 474 break; |
| 475 case NPDeviceContext3DState_PutOffset: |
| 476 *value = command_buffer_->GetPutOffset(); |
| 477 break; |
| 478 case NPDeviceContext3DState_Token: |
| 479 *value = command_buffer_->GetToken(); |
| 480 break; |
| 481 case NPDeviceContext3DState_ParseError: |
| 482 *value = command_buffer_->ResetParseError(); |
| 483 break; |
| 484 case NPDeviceContext3DState_ErrorStatus: |
| 485 *value = command_buffer_->GetErrorStatus() ? 1 : 0; |
| 486 break; |
| 487 default: |
| 488 return NPERR_GENERIC_ERROR; |
| 489 }; |
| 490 #endif // ENABLE_GPU |
| 491 |
| 492 return NPERR_NO_ERROR; |
| 410 } | 493 } |
| 411 | 494 |
| 412 NPError WebPluginDelegatePepper::Device3DFlushContext( | 495 NPError WebPluginDelegatePepper::Device3DFlushContext( |
| 413 NPP id, | 496 NPP id, |
| 414 NPDeviceContext3D* context, | 497 NPDeviceContext3D* context, |
| 415 NPDeviceFlushContextCallbackPtr callback, | 498 NPDeviceFlushContextCallbackPtr callback, |
| 416 void* user_data) { | 499 void* user_data) { |
| 417 return NPERR_GENERIC_ERROR; | 500 #if defined(ENABLE_GPU) |
| 501 DCHECK(callback == NULL); |
| 502 context->getOffset = command_buffer_->SyncOffsets(context->putOffset); |
| 503 #endif // ENABLE_GPU |
| 504 return NPERR_NO_ERROR; |
| 418 } | 505 } |
| 419 | 506 |
| 420 NPError WebPluginDelegatePepper::Device3DDestroyContext( | 507 NPError WebPluginDelegatePepper::Device3DDestroyContext( |
| 421 NPDeviceContext3D* context) { | 508 NPDeviceContext3D* context) { |
| 422 return NPERR_GENERIC_ERROR; | 509 #if defined(ENABLE_GPU) |
| 510 command_buffer_.reset(); |
| 511 |
| 512 if (nested_delegate_) { |
| 513 nested_delegate_->PluginDestroyed(); |
| 514 nested_delegate_ = NULL; |
| 515 } |
| 516 #endif // ENABLE_GPU |
| 517 |
| 518 return NPERR_NO_ERROR; |
| 423 } | 519 } |
| 424 | 520 |
| 425 bool WebPluginDelegatePepper::IsPluginDelegateWindow( | 521 NPError WebPluginDelegatePepper::Device3DCreateBuffer( |
| 426 gfx::NativeWindow window) { | 522 NPDeviceContext3D* context, |
| 427 return false; | 523 size_t size, |
| 524 int32* id) { |
| 525 #if defined(ENABLE_GPU) |
| 526 *id = command_buffer_->CreateTransferBuffer(size); |
| 527 if (*id < 0) |
| 528 return NPERR_GENERIC_ERROR; |
| 529 #endif // ENABLE_GPU |
| 530 |
| 531 return NPERR_NO_ERROR; |
| 428 } | 532 } |
| 429 | 533 |
| 430 bool WebPluginDelegatePepper::GetPluginNameFromWindow( | 534 NPError WebPluginDelegatePepper::Device3DDestroyBuffer( |
| 431 gfx::NativeWindow window, std::wstring *plugin_name) { | 535 NPDeviceContext3D* context, |
| 432 return false; | 536 int32 id) { |
| 537 #if defined(ENABLE_GPU) |
| 538 command_buffer_->DestroyTransferBuffer(id); |
| 539 #endif // ENABLE_GPU |
| 540 return NPERR_NO_ERROR; |
| 433 } | 541 } |
| 434 | 542 |
| 435 bool WebPluginDelegatePepper::IsDummyActivationWindow( | 543 NPError WebPluginDelegatePepper::Device3DMapBuffer( |
| 436 gfx::NativeWindow window) { | 544 NPDeviceContext3D* context, |
| 437 return false; | 545 int32 id, |
| 546 NPDeviceBuffer* np_buffer) { |
| 547 #if defined(ENABLE_GPU) |
| 548 Buffer gpu_buffer = command_buffer_->GetTransferBuffer(id); |
| 549 np_buffer->ptr = gpu_buffer.ptr; |
| 550 np_buffer->size = gpu_buffer.size; |
| 551 if (!np_buffer->ptr) |
| 552 return NPERR_GENERIC_ERROR; |
| 553 #endif // ENABLE_GPU |
| 554 |
| 555 return NPERR_NO_ERROR; |
| 438 } | 556 } |
| 439 | 557 |
| 440 WebPluginDelegatePepper::WebPluginDelegatePepper( | 558 WebPluginDelegatePepper::WebPluginDelegatePepper( |
| 559 const base::WeakPtr<RenderView>& render_view, |
| 441 gfx::PluginWindowHandle containing_view, | 560 gfx::PluginWindowHandle containing_view, |
| 442 NPAPI::PluginInstance *instance) | 561 NPAPI::PluginInstance *instance) |
| 443 : plugin_(NULL), | 562 : render_view_(render_view), |
| 563 plugin_(NULL), |
| 444 instance_(instance), | 564 instance_(instance), |
| 445 parent_(containing_view), | 565 parent_(containing_view), |
| 446 buffer_size_(0), | 566 buffer_size_(0), |
| 447 plugin_buffer_(0) { | 567 plugin_buffer_(0), |
| 568 nested_delegate_(NULL) { |
| 448 // For now we keep a window struct, although it isn't used. | 569 // For now we keep a window struct, although it isn't used. |
| 449 memset(&window_, 0, sizeof(window_)); | 570 memset(&window_, 0, sizeof(window_)); |
| 450 // All Pepper plugins are windowless and transparent. | 571 // All Pepper plugins are windowless and transparent. |
| 451 // TODO(sehr): disable resetting these NPPVs by plugins. | 572 // TODO(sehr): disable resetting these NPPVs by plugins. |
| 452 instance->set_windowless(true); | 573 instance->set_windowless(true); |
| 453 instance->set_transparent(true); | 574 instance->set_transparent(true); |
| 454 } | 575 } |
| 455 | 576 |
| 456 WebPluginDelegatePepper::~WebPluginDelegatePepper() { | 577 WebPluginDelegatePepper::~WebPluginDelegatePepper() { |
| 457 DestroyInstance(); | 578 DestroyInstance(); |
| 458 } | 579 } |
| 459 | 580 |
| 460 void WebPluginDelegatePepper::PluginDestroyed() { | 581 void WebPluginDelegatePepper::PluginDestroyed() { |
| 582 if (nested_delegate_) { |
| 583 nested_delegate_->PluginDestroyed(); |
| 584 nested_delegate_ = NULL; |
| 585 } |
| 461 delete this; | 586 delete this; |
| 462 } | 587 } |
| 463 | 588 |
| 464 void WebPluginDelegatePepper::Paint(WebKit::WebCanvas* canvas, | 589 void WebPluginDelegatePepper::Paint(WebKit::WebCanvas* canvas, |
| 465 const gfx::Rect& rect) { | 590 const gfx::Rect& rect) { |
| 466 #if defined(OS_WIN) | 591 #if defined(OS_WIN) |
| 467 // Blit from background_context to context. | 592 if (nested_delegate_) { |
| 468 if (!committed_bitmap_.isNull()) { | 593 // TODO(apatrick): The GPU plugin will render to an offscreen render target. |
| 469 gfx::Point origin(window_rect_.origin().x(), window_rect_.origin().y()); | 594 // Need to copy it to the screen here. |
| 470 canvas->drawBitmap(committed_bitmap_, | 595 } else { |
| 471 SkIntToScalar(window_rect_.origin().x()), | 596 // Blit from background_context to context. |
| 472 SkIntToScalar(window_rect_.origin().y())); | 597 if (!committed_bitmap_.isNull()) { |
| 598 gfx::Point origin(window_rect_.origin().x(), window_rect_.origin().y()); |
| 599 canvas->drawBitmap(committed_bitmap_, |
| 600 SkIntToScalar(window_rect_.origin().x()), |
| 601 SkIntToScalar(window_rect_.origin().y())); |
| 602 } |
| 473 } | 603 } |
| 474 #endif | 604 #endif |
| 475 } | 605 } |
| 476 | 606 |
| 477 void WebPluginDelegatePepper::Print(gfx::NativeDrawingContext context) { | 607 void WebPluginDelegatePepper::Print(gfx::NativeDrawingContext context) { |
| 478 NOTIMPLEMENTED(); | 608 NOTIMPLEMENTED(); |
| 479 } | 609 } |
| 480 | 610 |
| 481 void WebPluginDelegatePepper::InstallMissingPlugin() { | 611 void WebPluginDelegatePepper::InstallMissingPlugin() { |
| 482 NOTIMPLEMENTED(); | 612 NOTIMPLEMENTED(); |
| (...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 596 BuildCharEvent(&event, &npevent); | 726 BuildCharEvent(&event, &npevent); |
| 597 break; | 727 break; |
| 598 case NPEventType_Minimize: | 728 case NPEventType_Minimize: |
| 599 case NPEventType_Focus: | 729 case NPEventType_Focus: |
| 600 case NPEventType_Device: | 730 case NPEventType_Device: |
| 601 // NOTIMPLEMENTED(); | 731 // NOTIMPLEMENTED(); |
| 602 break; | 732 break; |
| 603 } | 733 } |
| 604 return instance()->NPP_HandleEvent(&npevent) != 0; | 734 return instance()->NPP_HandleEvent(&npevent) != 0; |
| 605 } | 735 } |
| OLD | NEW |