| OLD | NEW |
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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 #import <Cocoa/Cocoa.h> | 5 #import <Cocoa/Cocoa.h> |
| 6 | 6 |
| 7 #include "webkit/glue/plugins/webplugin_delegate_impl.h" | 7 #include "webkit/glue/plugins/webplugin_delegate_impl.h" |
| 8 | 8 |
| 9 #include <string> | 9 #include <string> |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 545 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 556 } | 556 } |
| 557 | 557 |
| 558 std::string mime_type; | 558 std::string mime_type; |
| 559 NPAPI::PluginStreamUrl *stream = instance()->CreateStream( | 559 NPAPI::PluginStreamUrl *stream = instance()->CreateStream( |
| 560 resource_id, url, mime_type, notify_needed, | 560 resource_id, url, mime_type, notify_needed, |
| 561 reinterpret_cast<void*>(notify_data)); | 561 reinterpret_cast<void*>(notify_data)); |
| 562 return stream; | 562 return stream; |
| 563 } | 563 } |
| 564 | 564 |
| 565 void WebPluginDelegateImpl::OnNullEvent() { | 565 void WebPluginDelegateImpl::OnNullEvent() { |
| 566 if (!webkit_glue::IsPluginRunningInRendererProcess()) { |
| 567 // If the plugin is running in a subprocess, drain any pending system |
| 568 // events so that the plugin's event handlers will get called on any |
| 569 // windows it has created. Filter out activate/deactivate events on |
| 570 // the fake browser window, but pass everything else through. |
| 571 EventRecord event; |
| 572 while (GetNextEvent(everyEvent, &event)) { |
| 573 if (event.what == activateEvt && cg_context_.window && |
| 574 reinterpret_cast<void *>(event.message) != cg_context_.window) |
| 575 continue; |
| 576 instance()->NPP_HandleEvent(&event); |
| 577 } |
| 578 } |
| 579 |
| 580 // Send an idle event so that the plugin can do background work |
| 566 NPEvent np_event = {0}; | 581 NPEvent np_event = {0}; |
| 567 np_event.what = nullEvent; | 582 np_event.what = nullEvent; |
| 568 np_event.when = TickCount(); | 583 np_event.when = TickCount(); |
| 569 np_event.modifiers = GetCurrentKeyModifiers(); | 584 np_event.modifiers = GetCurrentKeyModifiers(); |
| 570 if (!Button()) | 585 if (!Button()) |
| 571 np_event.modifiers |= btnState; | 586 np_event.modifiers |= btnState; |
| 572 np_event.where.h = last_mouse_x_; | 587 np_event.where.h = last_mouse_x_; |
| 573 np_event.where.v = last_mouse_y_; | 588 np_event.where.v = last_mouse_y_; |
| 574 instance()->NPP_HandleEvent(&np_event); | 589 instance()->NPP_HandleEvent(&np_event); |
| 575 | 590 |
| 576 MessageLoop::current()->PostDelayedTask(FROM_HERE, | 591 MessageLoop::current()->PostDelayedTask(FROM_HERE, |
| 577 null_event_factory_.NewRunnableMethod( | 592 null_event_factory_.NewRunnableMethod( |
| 578 &WebPluginDelegateImpl::OnNullEvent), | 593 &WebPluginDelegateImpl::OnNullEvent), |
| 579 kPluginIdleThrottleDelayMs); | 594 kPluginIdleThrottleDelayMs); |
| 580 } | 595 } |
| OLD | NEW |