| Index: webkit/plugins/npapi/webplugin_delegate_impl_mac.mm
|
| diff --git a/webkit/plugins/npapi/webplugin_delegate_impl_mac.mm b/webkit/plugins/npapi/webplugin_delegate_impl_mac.mm
|
| index 318a541510c91ed95c3513a4e34adfee9260b4f0..165046c1f2ff60d6d13a5dbb5ebfc8695d7daae2 100644
|
| --- a/webkit/plugins/npapi/webplugin_delegate_impl_mac.mm
|
| +++ b/webkit/plugins/npapi/webplugin_delegate_impl_mac.mm
|
| @@ -30,10 +30,6 @@
|
| #include "webkit/plugins/npapi/webplugin.h"
|
| #include "webkit/plugins/npapi/webplugin_accelerated_surface_mac.h"
|
|
|
| -#ifndef NP_NO_CARBON
|
| -#include "webkit/plugins/npapi/carbon_plugin_window_tracker_mac.h"
|
| -#endif
|
| -
|
| #if defined(USE_SKIA)
|
| #include "skia/ext/skia_utils_mac.h"
|
| #endif
|
| @@ -44,19 +40,6 @@ using WebKit::WebInputEvent;
|
| using WebKit::WebMouseEvent;
|
| using WebKit::WebMouseWheelEvent;
|
|
|
| -#if defined(MAC_OS_X_VERSION_10_7) && \
|
| - MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_7
|
| -#ifndef NP_NO_CARBON
|
| -// QuickdrawAPI.h is no longer included in the 10.7 SDK, but the symbols are
|
| -// still exported by QD.framework (a subframework of ApplicationServices).
|
| -// http://developer.apple.com/legacy/mac/library/documentation/Carbon/reference/QuickDraw_Ref/QuickDraw_Ref.pdf
|
| -extern "C" {
|
| -void SetRect(Rect* r, short left, short top, short right, short bottom);
|
| -void OffsetRect(Rect* r, short dh, short dv);
|
| -}
|
| -#endif // NP_NO_CARBON
|
| -#endif // 10.7+ SDK
|
| -
|
| // Important implementation notes: The Mac definition of NPAPI, particularly
|
| // the distinction between windowed and windowless modes, differs from the
|
| // Windows and Linux definitions. Most of those differences are
|
| @@ -87,98 +70,6 @@ class ScopedActiveDelegate {
|
| DISALLOW_COPY_AND_ASSIGN(ScopedActiveDelegate);
|
| };
|
|
|
| -#ifndef NP_NO_CARBON
|
| -// Timer periods for sending idle events to Carbon plugins. The visible value
|
| -// (50Hz) matches both Safari and Firefox. The hidden value (8Hz) matches
|
| -// Firefox; according to https://bugzilla.mozilla.org/show_bug.cgi?id=525533
|
| -// going lower than that causes issues.
|
| -const int kVisibleIdlePeriodMs = 20; // (50Hz)
|
| -const int kHiddenIdlePeriodMs = 125; // (8Hz)
|
| -
|
| -class CarbonIdleEventSource {
|
| - public:
|
| - // Returns the shared Carbon idle event source.
|
| - static CarbonIdleEventSource* SharedInstance() {
|
| - DCHECK(MessageLoop::current()->type() == MessageLoop::TYPE_UI);
|
| - static CarbonIdleEventSource* event_source = new CarbonIdleEventSource();
|
| - return event_source;
|
| - }
|
| -
|
| - // Registers the plugin delegate as interested in receiving idle events at
|
| - // a rate appropriate for the given visibility. A delegate can safely be
|
| - // re-registered any number of times, with the latest registration winning.
|
| - void RegisterDelegate(WebPluginDelegateImpl* delegate, bool visible) {
|
| - if (visible) {
|
| - visible_delegates_->RegisterDelegate(delegate);
|
| - hidden_delegates_->UnregisterDelegate(delegate);
|
| - } else {
|
| - hidden_delegates_->RegisterDelegate(delegate);
|
| - visible_delegates_->UnregisterDelegate(delegate);
|
| - }
|
| - }
|
| -
|
| - // Removes the plugin delegate from the list of plugins receiving idle events.
|
| - void UnregisterDelegate(WebPluginDelegateImpl* delegate) {
|
| - visible_delegates_->UnregisterDelegate(delegate);
|
| - hidden_delegates_->UnregisterDelegate(delegate);
|
| - }
|
| -
|
| - private:
|
| - class VisibilityGroup {
|
| - public:
|
| - explicit VisibilityGroup(int timer_period)
|
| - : timer_period_(timer_period), iterator_(delegates_.end()) {}
|
| -
|
| - // Adds |delegate| to this visibility group.
|
| - void RegisterDelegate(WebPluginDelegateImpl* delegate) {
|
| - if (delegates_.empty()) {
|
| - timer_.Start(FROM_HERE,
|
| - base::TimeDelta::FromMilliseconds(timer_period_),
|
| - this, &VisibilityGroup::SendIdleEvents);
|
| - }
|
| - delegates_.insert(delegate);
|
| - }
|
| -
|
| - // Removes |delegate| from this visibility group.
|
| - void UnregisterDelegate(WebPluginDelegateImpl* delegate) {
|
| - // If a plugin changes visibility during idle event handling, it
|
| - // may be removed from this set while SendIdleEvents is still iterating;
|
| - // if that happens and it's next on the list, increment the iterator
|
| - // before erasing so that the iteration won't be corrupted.
|
| - if ((iterator_ != delegates_.end()) && (*iterator_ == delegate))
|
| - ++iterator_;
|
| - size_t removed = delegates_.erase(delegate);
|
| - if (removed > 0 && delegates_.empty())
|
| - timer_.Stop();
|
| - }
|
| -
|
| - private:
|
| - // Fires off idle events for each delegate in the group.
|
| - void SendIdleEvents() {
|
| - for (iterator_ = delegates_.begin(); iterator_ != delegates_.end();) {
|
| - // Pre-increment so that the skip logic in UnregisterDelegates works.
|
| - WebPluginDelegateImpl* delegate = *(iterator_++);
|
| - delegate->FireIdleEvent();
|
| - }
|
| - }
|
| -
|
| - int timer_period_;
|
| - base::RepeatingTimer<VisibilityGroup> timer_;
|
| - std::set<WebPluginDelegateImpl*> delegates_;
|
| - std::set<WebPluginDelegateImpl*>::iterator iterator_;
|
| - };
|
| -
|
| - CarbonIdleEventSource()
|
| - : visible_delegates_(new VisibilityGroup(kVisibleIdlePeriodMs)),
|
| - hidden_delegates_(new VisibilityGroup(kHiddenIdlePeriodMs)) {}
|
| -
|
| - scoped_ptr<VisibilityGroup> visible_delegates_;
|
| - scoped_ptr<VisibilityGroup> hidden_delegates_;
|
| -
|
| - DISALLOW_COPY_AND_ASSIGN(CarbonIdleEventSource);
|
| -};
|
| -#endif // !NP_NO_CARBON
|
| -
|
| } // namespace
|
|
|
| // Helper to build and maintain a model of a drag entering the plugin but not
|
| @@ -293,21 +184,11 @@ WebPluginDelegateImpl::WebPluginDelegateImpl(
|
| containing_view_has_focus_(true),
|
| creation_succeeded_(false) {
|
| memset(&window_, 0, sizeof(window_));
|
| -#ifndef NP_NO_CARBON
|
| - memset(&np_cg_context_, 0, sizeof(np_cg_context_));
|
| -#endif
|
| instance->set_windowless(true);
|
| }
|
|
|
| WebPluginDelegateImpl::~WebPluginDelegateImpl() {
|
| DestroyInstance();
|
| -
|
| -#ifndef NP_NO_CARBON
|
| - if (np_cg_context_.window) {
|
| - CarbonPluginWindowTracker::SharedInstance()->DestroyDummyWindowForDelegate(
|
| - this, reinterpret_cast<WindowRef>(np_cg_context_.window));
|
| - }
|
| -#endif
|
| }
|
|
|
| bool WebPluginDelegateImpl::PlatformInitialize() {
|
| @@ -322,21 +203,11 @@ bool WebPluginDelegateImpl::PlatformInitialize() {
|
| instance()->plugin_lib()->PreventLibraryUnload();
|
|
|
| #ifndef NP_NO_CARBON
|
| - // Carbon is no longer supported.
|
| if (instance()->event_model() == NPEventModelCarbon)
|
| return false;
|
| -
|
| - if (instance()->event_model() == NPEventModelCarbon) {
|
| - // Create a stand-in for the browser window so that the plugin will have
|
| - // a non-NULL WindowRef to which it can refer.
|
| - CarbonPluginWindowTracker* window_tracker =
|
| - CarbonPluginWindowTracker::SharedInstance();
|
| - np_cg_context_.window = window_tracker->CreateDummyWindowForDelegate(this);
|
| - np_cg_context_.context = NULL;
|
| - UpdateDummyWindowBounds(gfx::Point(0, 0));
|
| - }
|
| #endif
|
|
|
| + window_.type = NPWindowTypeDrawable;
|
| NPDrawingModel drawing_model = instance()->drawing_model();
|
| switch (drawing_model) {
|
| #ifndef NP_NO_QUICKDRAW
|
| @@ -344,17 +215,9 @@ bool WebPluginDelegateImpl::PlatformInitialize() {
|
| return false;
|
| #endif
|
| case NPDrawingModelCoreGraphics:
|
| -#ifndef NP_NO_CARBON
|
| - if (instance()->event_model() == NPEventModelCarbon)
|
| - window_.window = &np_cg_context_;
|
| -#endif
|
| - window_.type = NPWindowTypeDrawable;
|
| break;
|
| case NPDrawingModelCoreAnimation:
|
| case NPDrawingModelInvalidatingCoreAnimation: {
|
| - if (instance()->event_model() != NPEventModelCocoa)
|
| - return false;
|
| - window_.type = NPWindowTypeDrawable;
|
| // Ask the plug-in for the CALayer it created for rendering content.
|
| // Create a surface to host it, and request a "window" handle to identify
|
| // the surface.
|
| @@ -410,20 +273,10 @@ bool WebPluginDelegateImpl::PlatformInitialize() {
|
| if (!layer_)
|
| plugin_->SetWindow(gfx::kNullPluginWindow);
|
|
|
| -#ifndef NP_NO_CARBON
|
| - // If the plugin wants Carbon events, hook up to the source of idle events.
|
| - if (instance()->event_model() == NPEventModelCarbon)
|
| - UpdateIdleEventRate();
|
| -#endif
|
| -
|
| return true;
|
| }
|
|
|
| void WebPluginDelegateImpl::PlatformDestroyInstance() {
|
| -#ifndef NP_NO_CARBON
|
| - if (instance()->event_model() == NPEventModelCarbon)
|
| - CarbonIdleEventSource::SharedInstance()->UnregisterDelegate(this);
|
| -#endif
|
| if (redraw_timer_.get())
|
| redraw_timer_->Stop();
|
| [renderer_ release];
|
| @@ -435,17 +288,6 @@ void WebPluginDelegateImpl::UpdateGeometryAndContext(
|
| const gfx::Rect& window_rect, const gfx::Rect& clip_rect,
|
| CGContextRef context) {
|
| buffer_context_ = context;
|
| -#ifndef NP_NO_CARBON
|
| - if (instance()->event_model() == NPEventModelCarbon) {
|
| - // Update the structure that is passed to Carbon+CoreGraphics plugins in
|
| - // NPP_SetWindow before calling UpdateGeometry, since that will trigger an
|
| - // NPP_SetWindow call if the geometry changes (which is the only time the
|
| - // context would be different), and some plugins (e.g., Flash) have an
|
| - // internal cache of the context that they only update when NPP_SetWindow
|
| - // is called.
|
| - np_cg_context_.context = context;
|
| - }
|
| -#endif
|
| UpdateGeometry(window_rect, clip_rect);
|
| }
|
|
|
| @@ -469,21 +311,14 @@ bool WebPluginDelegateImpl::PlatformHandleInputEvent(
|
| const WebInputEvent& event, WebCursorInfo* cursor_info) {
|
| DCHECK(cursor_info != NULL);
|
|
|
| - // If we get an event before we've set up the plugin, bail.
|
| + // If an event comes in before the plugin has been set up, bail.
|
| if (!have_called_set_window_)
|
| return false;
|
| -#ifndef NP_NO_CARBON
|
| - if (instance()->event_model() == NPEventModelCarbon &&
|
| - !np_cg_context_.context) {
|
| - return false;
|
| - }
|
| -#endif
|
|
|
| // WebKit sometimes sends spurious mouse move events when the window doesn't
|
| // have focus; Cocoa event model plugins don't expect to receive mouse move
|
| // events when they are in a background window, so drop those events.
|
| if (!containing_window_has_focus_ &&
|
| - instance()->event_model() == NPEventModelCocoa &&
|
| (event.type == WebInputEvent::MouseMove ||
|
| event.type == WebInputEvent::MouseEnter ||
|
| event.type == WebInputEvent::MouseLeave)) {
|
| @@ -525,55 +360,42 @@ bool WebPluginDelegateImpl::PlatformHandleInputEvent(
|
| return true;
|
| }
|
|
|
| -#ifndef NP_NO_CARBON
|
| - if (instance()->event_model() == NPEventModelCarbon &&
|
| - event.type == WebInputEvent::MouseMove) {
|
| - return true; // The recurring FireIdleEvent will send null events.
|
| - }
|
| -#endif
|
| -
|
| ScopedActiveDelegate active_delegate(this);
|
|
|
| // Create the plugin event structure.
|
| - NPEventModel event_model = instance()->event_model();
|
| scoped_ptr<PluginWebEventConverter> event_converter(
|
| - PluginWebEventConverterFactory::CreateConverterForModel(event_model));
|
| - if (!(event_converter.get() && event_converter->InitWithEvent(event))) {
|
| - // Silently consume any keyboard event types that we don't handle, so that
|
| + new PluginWebEventConverter);
|
| + if (!event_converter->InitWithEvent(event)) {
|
| + // Silently consume any keyboard event types that aren't handled, so that
|
| // they don't fall through to the page.
|
| if (WebInputEvent::isKeyboardEventType(event.type))
|
| return true;
|
| return false;
|
| }
|
| - void* plugin_event = event_converter->plugin_event();
|
| -
|
| - if (instance()->event_model() == NPEventModelCocoa) {
|
| - // We recieve events related to drags starting outside the plugin, but the
|
| - // NPAPI Cocoa event model spec says plugins shouldn't receive them, so
|
| - // filter them out.
|
| - // If we add a page capture mode at the WebKit layer (like the plugin
|
| - // capture mode that handles drags starting inside) this can be removed.
|
| - bool drag_related = external_drag_tracker_->EventIsRelatedToDrag(event);
|
| - external_drag_tracker_->UpdateDragStateFromEvent(event);
|
| - if (drag_related) {
|
| - if (event.type == WebInputEvent::MouseUp &&
|
| - !external_drag_tracker_->IsDragInProgress()) {
|
| - // When an external drag ends, we need to synthesize a MouseEntered.
|
| - NPCocoaEvent enter_event = *(static_cast<NPCocoaEvent*>(plugin_event));
|
| - enter_event.type = NPCocoaEventMouseEntered;
|
| - ScopedCurrentPluginEvent event_scope(instance(), &enter_event);
|
| - instance()->NPP_HandleEvent(&enter_event);
|
| - }
|
| - return false;
|
| + NPCocoaEvent* plugin_event = event_converter->plugin_event();
|
| +
|
| + // The plugin host recieves events related to drags starting outside the
|
| + // plugin, but the NPAPI Cocoa event model spec says plugins shouldn't receive
|
| + // them, so filter them out.
|
| + // If WebKit adds a page capture mode (like the plugin capture mode that
|
| + // handles drags starting inside) this can be removed.
|
| + bool drag_related = external_drag_tracker_->EventIsRelatedToDrag(event);
|
| + external_drag_tracker_->UpdateDragStateFromEvent(event);
|
| + if (drag_related) {
|
| + if (event.type == WebInputEvent::MouseUp &&
|
| + !external_drag_tracker_->IsDragInProgress()) {
|
| + // When an external drag ends, we need to synthesize a MouseEntered.
|
| + NPCocoaEvent enter_event = *plugin_event;
|
| + enter_event.type = NPCocoaEventMouseEntered;
|
| + ScopedCurrentPluginEvent event_scope(instance(), &enter_event);
|
| + instance()->NPP_HandleEvent(&enter_event);
|
| }
|
| + return false;
|
| }
|
|
|
| // Send the plugin the event.
|
| - scoped_ptr<ScopedCurrentPluginEvent> event_scope(NULL);
|
| - if (instance()->event_model() == NPEventModelCocoa) {
|
| - event_scope.reset(new ScopedCurrentPluginEvent(
|
| - instance(), static_cast<NPCocoaEvent*>(plugin_event)));
|
| - }
|
| + scoped_ptr<ScopedCurrentPluginEvent> event_scope(
|
| + new ScopedCurrentPluginEvent(instance(), plugin_event));
|
| int16_t handle_response = instance()->NPP_HandleEvent(plugin_event);
|
| bool handled = handle_response != kNPEventNotHandled;
|
|
|
| @@ -661,30 +483,15 @@ void WebPluginDelegateImpl::WindowlessPaint(gfx::NativeDrawingContext context,
|
| CGContextTranslateCTM(context, window_rect_.x(), window_rect_.y());
|
| }
|
|
|
| - switch (instance()->event_model()) {
|
| -#ifndef NP_NO_CARBON
|
| - case NPEventModelCarbon: {
|
| - NPEvent paint_event = { 0 };
|
| - paint_event.what = updateEvt;
|
| - paint_event.message = reinterpret_cast<uint32>(np_cg_context_.window);
|
| - paint_event.when = TickCount();
|
| - instance()->NPP_HandleEvent(&paint_event);
|
| - break;
|
| - }
|
| -#endif
|
| - case NPEventModelCocoa: {
|
| - NPCocoaEvent paint_event;
|
| - memset(&paint_event, 0, sizeof(NPCocoaEvent));
|
| - paint_event.type = NPCocoaEventDrawRect;
|
| - paint_event.data.draw.context = context;
|
| - paint_event.data.draw.x = paint_rect.x();
|
| - paint_event.data.draw.y = paint_rect.y();
|
| - paint_event.data.draw.width = paint_rect.width();
|
| - paint_event.data.draw.height = paint_rect.height();
|
| - instance()->NPP_HandleEvent(&paint_event);
|
| - break;
|
| - }
|
| - }
|
| + NPCocoaEvent paint_event;
|
| + memset(&paint_event, 0, sizeof(NPCocoaEvent));
|
| + paint_event.type = NPCocoaEventDrawRect;
|
| + paint_event.data.draw.context = context;
|
| + paint_event.data.draw.x = paint_rect.x();
|
| + paint_event.data.draw.y = paint_rect.y();
|
| + paint_event.data.draw.width = paint_rect.width();
|
| + paint_event.data.draw.height = paint_rect.height();
|
| + instance()->NPP_HandleEvent(&paint_event);
|
|
|
| if (use_buffer_context_) {
|
| // The backing buffer can change during the call to NPP_HandleEvent, in
|
| @@ -767,29 +574,11 @@ void WebPluginDelegateImpl::SetWindowHasFocus(bool has_focus) {
|
| containing_window_has_focus_ = has_focus;
|
|
|
| ScopedActiveDelegate active_delegate(this);
|
| - switch (instance()->event_model()) {
|
| -#ifndef NP_NO_CARBON
|
| - case NPEventModelCarbon: {
|
| - NPEvent focus_event = { 0 };
|
| - focus_event.what = activateEvt;
|
| - if (has_focus)
|
| - focus_event.modifiers |= activeFlag;
|
| - focus_event.message =
|
| - reinterpret_cast<unsigned long>(np_cg_context_.window);
|
| - focus_event.when = TickCount();
|
| - instance()->NPP_HandleEvent(&focus_event);
|
| - break;
|
| - }
|
| -#endif
|
| - case NPEventModelCocoa: {
|
| - NPCocoaEvent focus_event;
|
| - memset(&focus_event, 0, sizeof(focus_event));
|
| - focus_event.type = NPCocoaEventWindowFocusChanged;
|
| - focus_event.data.focus.hasFocus = has_focus;
|
| - instance()->NPP_HandleEvent(&focus_event);
|
| - break;
|
| - }
|
| - }
|
| + NPCocoaEvent focus_event;
|
| + memset(&focus_event, 0, sizeof(focus_event));
|
| + focus_event.type = NPCocoaEventWindowFocusChanged;
|
| + focus_event.data.focus.hasFocus = has_focus;
|
| + instance()->NPP_HandleEvent(&focus_event);
|
| }
|
|
|
| bool WebPluginDelegateImpl::PlatformSetPluginHasFocus(bool focused) {
|
| @@ -800,28 +589,12 @@ bool WebPluginDelegateImpl::PlatformSetPluginHasFocus(bool focused) {
|
|
|
| ScopedActiveDelegate active_delegate(this);
|
|
|
| - switch (instance()->event_model()) {
|
| -#ifndef NP_NO_CARBON
|
| - case NPEventModelCarbon: {
|
| - NPEvent focus_event = { 0 };
|
| - if (focused)
|
| - focus_event.what = NPEventType_GetFocusEvent;
|
| - else
|
| - focus_event.what = NPEventType_LoseFocusEvent;
|
| - focus_event.when = TickCount();
|
| - instance()->NPP_HandleEvent(&focus_event);
|
| - break;
|
| - }
|
| -#endif
|
| - case NPEventModelCocoa: {
|
| - NPCocoaEvent focus_event;
|
| - memset(&focus_event, 0, sizeof(focus_event));
|
| - focus_event.type = NPCocoaEventFocusChanged;
|
| - focus_event.data.focus.hasFocus = focused;
|
| - instance()->NPP_HandleEvent(&focus_event);
|
| - break;
|
| - }
|
| - }
|
| + NPCocoaEvent focus_event;
|
| + memset(&focus_event, 0, sizeof(focus_event));
|
| + focus_event.type = NPCocoaEventFocusChanged;
|
| + focus_event.data.focus.hasFocus = focused;
|
| + instance()->NPP_HandleEvent(&focus_event);
|
| +
|
| return true;
|
| }
|
|
|
| @@ -863,11 +636,6 @@ void WebPluginDelegateImpl::WindowFrameChanged(const gfx::Rect& window_frame,
|
| }
|
|
|
| void WebPluginDelegateImpl::ImeCompositionCompleted(const string16& text) {
|
| - if (instance()->event_model() != NPEventModelCocoa) {
|
| - DLOG(ERROR) << "IME notification receieved in Carbon event model";
|
| - return;
|
| - }
|
| -
|
| ime_enabled_ = false;
|
|
|
| // If |text| is empty this was just called to tell us composition was
|
| @@ -896,15 +664,8 @@ void WebPluginDelegateImpl::SetNSCursor(NSCursor* cursor) {
|
| current_windowless_cursor_.InitFromNSCursor(cursor);
|
| }
|
|
|
| -bool WebPluginDelegateImpl::AllowBufferFlipping() {
|
| -#ifndef NP_NO_CARBON
|
| - // Using buffer flipping for Carbon plugins would require issuing an
|
| - // NPP_SetWindow() call for every frame, which would likely expose plugin
|
| - // bugs and/or suboptimal behaviour. So we don't allow it.
|
| - return instance()->event_model() != NPEventModelCarbon;
|
| -#else
|
| - return true;
|
| -#endif
|
| +void WebPluginDelegateImpl::SetNoBufferContext() {
|
| + use_buffer_context_ = false;
|
| }
|
|
|
| #pragma mark -
|
| @@ -928,19 +689,9 @@ void WebPluginDelegateImpl::PluginScreenLocationChanged() {
|
| gfx::Point plugin_origin(content_area_origin_.x() + window_rect_.x(),
|
| content_area_origin_.y() + window_rect_.y());
|
| instance()->set_plugin_origin(plugin_origin);
|
| -
|
| -#ifndef NP_NO_CARBON
|
| - if (instance()->event_model() == NPEventModelCarbon) {
|
| - UpdateDummyWindowBounds(plugin_origin);
|
| - }
|
| -#endif
|
| }
|
|
|
| void WebPluginDelegateImpl::PluginVisibilityChanged() {
|
| -#ifndef NP_NO_CARBON
|
| - if (instance()->event_model() == NPEventModelCarbon)
|
| - UpdateIdleEventRate();
|
| -#endif
|
| if (instance()->drawing_model() == NPDrawingModelCoreAnimation) {
|
| bool plugin_visible = container_is_visible_ && !clip_rect_.IsEmpty();
|
| if (plugin_visible && !redraw_timer_->IsRunning() &&
|
| @@ -955,8 +706,6 @@ void WebPluginDelegateImpl::PluginVisibilityChanged() {
|
| }
|
|
|
| void WebPluginDelegateImpl::StartIme() {
|
| - if (instance()->event_model() != NPEventModelCocoa)
|
| - return;
|
| if (ime_enabled_)
|
| return;
|
| ime_enabled_ = true;
|
| @@ -1024,69 +773,5 @@ void WebPluginDelegateImpl::set_windowed_handle(
|
| PluginVisibilityChanged();
|
| }
|
|
|
| -#pragma mark -
|
| -#pragma mark Carbon Event support
|
| -
|
| -#ifndef NP_NO_CARBON
|
| -void WebPluginDelegateImpl::UpdateDummyWindowBounds(
|
| - const gfx::Point& plugin_origin) {
|
| - WindowRef window = reinterpret_cast<WindowRef>(np_cg_context_.window);
|
| - Rect current_bounds;
|
| - GetWindowBounds(window, kWindowContentRgn, ¤t_bounds);
|
| -
|
| - Rect new_bounds;
|
| - // We never want to resize the window to 0x0, so if the plugin is 0x0 just
|
| - // move the window without resizing it.
|
| - if (window_rect_.width() > 0 && window_rect_.height() > 0) {
|
| - SetRect(&new_bounds, 0, 0, window_rect_.width(), window_rect_.height());
|
| - OffsetRect(&new_bounds, plugin_origin.x(), plugin_origin.y());
|
| - } else {
|
| - new_bounds = current_bounds;
|
| - OffsetRect(&new_bounds, plugin_origin.x() - current_bounds.left,
|
| - plugin_origin.y() - current_bounds.top);
|
| - }
|
| -
|
| - if (new_bounds.left != current_bounds.left ||
|
| - new_bounds.top != current_bounds.top ||
|
| - new_bounds.right != current_bounds.right ||
|
| - new_bounds.bottom != current_bounds.bottom)
|
| - SetWindowBounds(window, kWindowContentRgn, &new_bounds);
|
| -}
|
| -
|
| -void WebPluginDelegateImpl::UpdateIdleEventRate() {
|
| - bool plugin_visible = container_is_visible_ && !clip_rect_.IsEmpty();
|
| - CarbonIdleEventSource::SharedInstance()->RegisterDelegate(this,
|
| - plugin_visible);
|
| -}
|
| -
|
| -void WebPluginDelegateImpl::SetNoBufferContext() {
|
| - use_buffer_context_ = false;
|
| -}
|
| -
|
| -void WebPluginDelegateImpl::FireIdleEvent() {
|
| - // Avoid a race condition between IO and UI threads during plugin shutdown
|
| - if (!instance())
|
| - return;
|
| - // Don't send idle events until we've called SetWindow.
|
| - if (!have_called_set_window_)
|
| - return;
|
| -
|
| - ScopedActiveDelegate active_delegate(this);
|
| -
|
| - // Send an idle event so that the plugin can do background work
|
| - NPEvent np_event = {0};
|
| - np_event.what = nullEvent;
|
| - np_event.when = TickCount();
|
| - np_event.modifiers = GetCurrentKeyModifiers();
|
| - if (!GetCurrentButtonState())
|
| - np_event.modifiers |= btnState;
|
| - HIPoint mouse_location;
|
| - HIGetMousePosition(kHICoordSpaceScreenPixel, NULL, &mouse_location);
|
| - np_event.where.h = mouse_location.x;
|
| - np_event.where.v = mouse_location.y;
|
| - instance()->NPP_HandleEvent(&np_event);
|
| -}
|
| -#endif // !NP_NO_CARBON
|
| -
|
| } // namespace npapi
|
| } // namespace webkit
|
|
|