1 /* 2 * Copyright (C) 2001 Peter Kelly (pmk@post.com) 3 * Copyright (C) 2001 Tobias Anton (anton@stud.fbi.fh-darmstadt.de) 4 * Copyright (C) 2006 Samuel Weinig (sam.weinig@gmail.com) 5 * Copyright (C) 2003, 2004, 2005, 2006, 2008 Apple Inc. All rights reserved. 6 * 7 * This library is free software; you can redistribute it and/or 8 * modify it under the terms of the GNU Library General Public 9 * License as published by the Free Software Foundation; either 10 * version 2 of the License, or (at your option) any later version. 11 * 12 * This library is distributed in the hope that it will be useful, 13 * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 15 * Library General Public License for more details. 16 * 17 * You should have received a copy of the GNU Library General Public License 18 * along with this library; see the file COPYING.LIB. If not, write to 19 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 20 * Boston, MA 02110-1301, USA. 21 * 22 */ 23 24 #ifndef THIRD_PARTY_BLINK_RENDERER_CORE_EVENTS_UI_EVENT_H_ 25 #define THIRD_PARTY_BLINK_RENDERER_CORE_EVENTS_UI_EVENT_H_ 26 27 #include "third_party/blink/renderer/bindings/core/v8/v8_ui_event_init.h" 28 #include "third_party/blink/renderer/core/core_export.h" 29 #include "third_party/blink/renderer/core/dom/events/event.h" 30 #include "third_party/blink/renderer/core/frame/dom_window.h" 31 #include "third_party/blink/renderer/platform/wtf/casting.h" 32 33 namespace blink { 34 35 class InputDeviceCapabilities; 36 37 // FIXME: Get rid of this type alias. 38 using AbstractView = DOMWindow; 39 40 class CORE_EXPORT UIEvent : public Event { 41 DEFINE_WRAPPERTYPEINFO(); 42 43 public: Create()44 static UIEvent* Create() { return MakeGarbageCollected<UIEvent>(); } Create(const AtomicString & type,const UIEventInit * initializer)45 static UIEvent* Create(const AtomicString& type, 46 const UIEventInit* initializer) { 47 return MakeGarbageCollected<UIEvent>(type, initializer); 48 } 49 50 UIEvent(); 51 UIEvent(const AtomicString& type, 52 Bubbles, 53 Cancelable, 54 ComposedMode, 55 base::TimeTicks platform_time_stamp, 56 AbstractView*, 57 int detail, 58 InputDeviceCapabilities* source_capabilities); 59 UIEvent(const AtomicString&, 60 const UIEventInit*, 61 base::TimeTicks platform_time_stamp); UIEvent(const AtomicString & type,const UIEventInit * init)62 UIEvent(const AtomicString& type, const UIEventInit* init) 63 : UIEvent(type, init, base::TimeTicks::Now()) {} 64 ~UIEvent() override; 65 66 void initUIEvent(const AtomicString& type, 67 bool bubbles, 68 bool cancelable, 69 AbstractView*, 70 int detail); 71 void InitUIEventInternal(const AtomicString& type, 72 bool bubbles, 73 bool cancelable, 74 EventTarget* related_target, 75 AbstractView*, 76 int detail, 77 InputDeviceCapabilities* source_capabilities); 78 view()79 AbstractView* view() const { return view_; } detail()80 int detail() const { return detail_; } sourceCapabilities()81 InputDeviceCapabilities* sourceCapabilities() const { 82 return source_capabilities_; 83 } 84 85 const AtomicString& InterfaceName() const override; 86 bool IsUIEvent() const final; 87 88 virtual unsigned which() const; 89 90 void Trace(Visitor*) override; 91 92 private: 93 Member<AbstractView> view_; 94 int detail_; 95 Member<InputDeviceCapabilities> source_capabilities_; 96 }; 97 98 template <> 99 struct DowncastTraits<UIEvent> { 100 static bool AllowFrom(const Event& event) { return event.IsUIEvent(); } 101 }; 102 103 } // namespace blink 104 105 #endif // THIRD_PARTY_BLINK_RENDERER_CORE_EVENTS_UI_EVENT_H_ 106