Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(128)

Side by Side Diff: Source/web/WebPluginContainerImpl.cpp

Issue 206603002: Add EventHandlerRegistry (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Add test for external handlers. Created 6 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2009 Google Inc. All rights reserved. 2 * Copyright (C) 2009 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
42 #include "WebViewImpl.h" 42 #include "WebViewImpl.h"
43 #include "core/page/Chrome.h" 43 #include "core/page/Chrome.h"
44 #include "core/page/EventHandler.h" 44 #include "core/page/EventHandler.h"
45 #include "platform/exported/WrappedResourceResponse.h" 45 #include "platform/exported/WrappedResourceResponse.h"
46 46
47 #include "HTMLNames.h" 47 #include "HTMLNames.h"
48 #include "WebPrintParams.h" 48 #include "WebPrintParams.h"
49 #include "bindings/v8/ScriptController.h" 49 #include "bindings/v8/ScriptController.h"
50 #include "core/clipboard/Clipboard.h" 50 #include "core/clipboard/Clipboard.h"
51 #include "core/clipboard/DataObject.h" 51 #include "core/clipboard/DataObject.h"
52 #include "core/dom/EventHandlerRegistry.h"
52 #include "core/events/GestureEvent.h" 53 #include "core/events/GestureEvent.h"
53 #include "core/events/KeyboardEvent.h" 54 #include "core/events/KeyboardEvent.h"
54 #include "core/events/MouseEvent.h" 55 #include "core/events/MouseEvent.h"
55 #include "core/events/TouchEvent.h" 56 #include "core/events/TouchEvent.h"
56 #include "core/events/WheelEvent.h" 57 #include "core/events/WheelEvent.h"
57 #include "core/html/HTMLFormElement.h" 58 #include "core/html/HTMLFormElement.h"
58 #include "core/html/HTMLPlugInElement.h" 59 #include "core/html/HTMLPlugInElement.h"
59 #include "core/loader/FormState.h" 60 #include "core/loader/FormState.h"
60 #include "core/loader/FrameLoadRequest.h" 61 #include "core/loader/FrameLoadRequest.h"
61 #include "core/page/FocusController.h" 62 #include "core/page/FocusController.h"
(...skipping 447 matching lines...) Expand 10 before | Expand all | Expand 10 after
509 return false; 510 return false;
510 return nodes.first().get() == m_element; 511 return nodes.first().get() == m_element;
511 } 512 }
512 513
513 void WebPluginContainerImpl::requestTouchEventType(TouchEventRequestType request Type) 514 void WebPluginContainerImpl::requestTouchEventType(TouchEventRequestType request Type)
514 { 515 {
515 if (m_touchEventRequestType == requestType) 516 if (m_touchEventRequestType == requestType)
516 return; 517 return;
517 518
518 if (requestType != TouchEventRequestTypeNone && m_touchEventRequestType == T ouchEventRequestTypeNone) 519 if (requestType != TouchEventRequestTypeNone && m_touchEventRequestType == T ouchEventRequestTypeNone)
519 m_element->document().didAddTouchEventHandler(m_element); 520 EventHandlerRegistry::from(m_element->document())->didAddEventHandler(*m _element, EventHandlerRegistry::TouchEvent);
520 else if (requestType == TouchEventRequestTypeNone && m_touchEventRequestType != TouchEventRequestTypeNone) 521 else if (requestType == TouchEventRequestTypeNone && m_touchEventRequestType != TouchEventRequestTypeNone)
521 m_element->document().didRemoveTouchEventHandler(m_element); 522 EventHandlerRegistry::from(m_element->document())->didRemoveEventHandler (*m_element, EventHandlerRegistry::TouchEvent);
522 m_touchEventRequestType = requestType; 523 m_touchEventRequestType = requestType;
523 } 524 }
524 525
525 void WebPluginContainerImpl::setWantsWheelEvents(bool wantsWheelEvents) 526 void WebPluginContainerImpl::setWantsWheelEvents(bool wantsWheelEvents)
526 { 527 {
527 if (m_wantsWheelEvents == wantsWheelEvents) 528 if (m_wantsWheelEvents == wantsWheelEvents)
528 return; 529 return;
529 m_wantsWheelEvents = wantsWheelEvents; 530 m_wantsWheelEvents = wantsWheelEvents;
530 if (Page* page = m_element->document().page()) { 531 if (Page* page = m_element->document().page()) {
531 if (ScrollingCoordinator* scrollingCoordinator = page->scrollingCoordina tor()) { 532 if (ScrollingCoordinator* scrollingCoordinator = page->scrollingCoordina tor()) {
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after
662 , m_webPlugin(webPlugin) 663 , m_webPlugin(webPlugin)
663 , m_webLayer(0) 664 , m_webLayer(0)
664 , m_touchEventRequestType(TouchEventRequestTypeNone) 665 , m_touchEventRequestType(TouchEventRequestTypeNone)
665 , m_wantsWheelEvents(false) 666 , m_wantsWheelEvents(false)
666 { 667 {
667 } 668 }
668 669
669 WebPluginContainerImpl::~WebPluginContainerImpl() 670 WebPluginContainerImpl::~WebPluginContainerImpl()
670 { 671 {
671 if (m_touchEventRequestType != TouchEventRequestTypeNone) 672 if (m_touchEventRequestType != TouchEventRequestTypeNone)
672 m_element->document().didRemoveTouchEventHandler(m_element); 673 EventHandlerRegistry::from(m_element->document())->didRemoveEventHandler (*m_element, EventHandlerRegistry::TouchEvent);
673 674
674 for (size_t i = 0; i < m_pluginLoadObservers.size(); ++i) 675 for (size_t i = 0; i < m_pluginLoadObservers.size(); ++i)
675 m_pluginLoadObservers[i]->clearPluginContainer(); 676 m_pluginLoadObservers[i]->clearPluginContainer();
676 m_webPlugin->destroy(); 677 m_webPlugin->destroy();
677 if (m_webLayer) 678 if (m_webLayer)
678 GraphicsLayer::unregisterContentsLayer(m_webLayer); 679 GraphicsLayer::unregisterContentsLayer(m_webLayer);
679 } 680 }
680 681
681 void WebPluginContainerImpl::handleMouseEvent(MouseEvent* event) 682 void WebPluginContainerImpl::handleMouseEvent(MouseEvent* event)
682 { 683 {
(...skipping 226 matching lines...) Expand 10 before | Expand all | Expand 10 after
909 // Take our element and get the clip rect from the enclosing layer and 910 // Take our element and get the clip rect from the enclosing layer and
910 // frame view. 911 // frame view.
911 clipRect.intersect( 912 clipRect.intersect(
912 m_element->document().view()->windowClipRectForFrameOwner(m_element) ); 913 m_element->document().view()->windowClipRectForFrameOwner(m_element) );
913 } 914 }
914 915
915 return clipRect; 916 return clipRect;
916 } 917 }
917 918
918 } // namespace blink 919 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698