OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2006, 2008, 2009 Apple Inc. All rights reserved. | 2 * Copyright (C) 2006, 2008, 2009 Apple Inc. All rights reserved. |
3 * | 3 * |
4 * This library is free software; you can redistribute it and/or | 4 * This library is free software; you can redistribute it and/or |
5 * modify it under the terms of the GNU Library General Public | 5 * modify it under the terms of the GNU Library General Public |
6 * License as published by the Free Software Foundation; either | 6 * License as published by the Free Software Foundation; either |
7 * version 2 of the License, or (at your option) any later version. | 7 * version 2 of the License, or (at your option) any later version. |
8 * | 8 * |
9 * This library is distributed in the hope that it will be useful, | 9 * This library is distributed in the hope that it will be useful, |
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of | 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
12 * Library General Public License for more details. | 12 * Library General Public License for more details. |
13 * | 13 * |
14 * You should have received a copy of the GNU Library General Public License | 14 * You should have received a copy of the GNU Library General Public License |
15 * along with this library; see the file COPYING.LIB. If not, write to | 15 * along with this library; see the file COPYING.LIB. If not, write to |
16 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | 16 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, |
17 * Boston, MA 02110-1301, USA. | 17 * Boston, MA 02110-1301, USA. |
18 * | 18 * |
19 */ | 19 */ |
20 | 20 |
21 #ifndef EventListener_h | 21 #ifndef EventListener_h |
22 #define EventListener_h | 22 #define EventListener_h |
23 | 23 |
24 #include "core/CoreExport.h" | 24 #include "core/CoreExport.h" |
25 #include "platform/heap/Handle.h" | 25 #include "platform/heap/Handle.h" |
26 #include "platform/wtf/text/WTFString.h" | 26 #include "platform/wtf/text/WTFString.h" |
27 | 27 |
28 namespace blink { | 28 namespace blink { |
29 | 29 |
| 30 class Document; |
30 class Event; | 31 class Event; |
31 class ExecutionContext; | 32 class ExecutionContext; |
32 | 33 |
33 class CORE_EXPORT EventListener | 34 class CORE_EXPORT EventListener |
34 : public GarbageCollectedFinalized<EventListener> { | 35 : public GarbageCollectedFinalized<EventListener> { |
35 public: | 36 public: |
36 enum ListenerType { | 37 enum ListenerType { |
37 kJSEventListenerType, | 38 kJSEventListenerType, |
38 kImageEventListenerType, | 39 kImageEventListenerType, |
39 kCPPEventListenerType, | 40 kCPPEventListenerType, |
40 kConditionEventListenerType, | 41 kConditionEventListenerType, |
41 kNativeEventListenerType, | 42 kNativeEventListenerType, |
42 }; | 43 }; |
43 | 44 |
44 virtual ~EventListener() {} | 45 virtual ~EventListener() {} |
45 virtual bool operator==(const EventListener&) const = 0; | 46 virtual bool operator==(const EventListener&) const = 0; |
46 virtual void handleEvent(ExecutionContext*, Event*) = 0; | 47 virtual void handleEvent(ExecutionContext*, Event*) = 0; |
47 virtual const String& Code() const { return g_empty_string; } | 48 virtual const String& Code() const { return g_empty_string; } |
48 virtual bool WasCreatedFromMarkup() const { return false; } | 49 virtual bool WasCreatedFromMarkup() const { return false; } |
49 virtual bool BelongsToTheCurrentWorld(ExecutionContext*) const { | 50 virtual bool BelongsToTheCurrentWorld(Document*) const { return false; } |
50 return false; | |
51 } | |
52 virtual bool IsAttribute() const { return false; } | 51 virtual bool IsAttribute() const { return false; } |
53 | 52 |
54 ListenerType GetType() const { return type_; } | 53 ListenerType GetType() const { return type_; } |
55 | 54 |
56 DEFINE_INLINE_VIRTUAL_TRACE() {} | 55 DEFINE_INLINE_VIRTUAL_TRACE() {} |
57 | 56 |
58 protected: | 57 protected: |
59 explicit EventListener(ListenerType type) : type_(type) {} | 58 explicit EventListener(ListenerType type) : type_(type) {} |
60 | 59 |
61 private: | 60 private: |
62 ListenerType type_; | 61 ListenerType type_; |
63 }; | 62 }; |
64 | 63 |
65 } // namespace blink | 64 } // namespace blink |
66 | 65 |
67 #endif | 66 #endif |
OLD | NEW |