OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2011 Google Inc. All rights reserved. | 2 * Copyright (C) 2011 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 27 matching lines...) Expand all Loading... |
38 struct CloseEventInit : public EventInit { | 38 struct CloseEventInit : public EventInit { |
39 CloseEventInit() | 39 CloseEventInit() |
40 : wasClean(false) | 40 : wasClean(false) |
41 , code(0) { } | 41 , code(0) { } |
42 | 42 |
43 bool wasClean; | 43 bool wasClean; |
44 unsigned short code; | 44 unsigned short code; |
45 String reason; | 45 String reason; |
46 }; | 46 }; |
47 | 47 |
48 class CloseEvent FINAL : public Event { | 48 class CloseEvent final : public Event { |
49 DEFINE_WRAPPERTYPEINFO(); | 49 DEFINE_WRAPPERTYPEINFO(); |
50 public: | 50 public: |
51 static PassRefPtrWillBeRawPtr<CloseEvent> create() | 51 static PassRefPtrWillBeRawPtr<CloseEvent> create() |
52 { | 52 { |
53 return adoptRefWillBeNoop(new CloseEvent()); | 53 return adoptRefWillBeNoop(new CloseEvent()); |
54 } | 54 } |
55 | 55 |
56 static PassRefPtrWillBeRawPtr<CloseEvent> create(bool wasClean, unsigned sho
rt code, const String& reason) | 56 static PassRefPtrWillBeRawPtr<CloseEvent> create(bool wasClean, unsigned sho
rt code, const String& reason) |
57 { | 57 { |
58 return adoptRefWillBeNoop(new CloseEvent(wasClean, code, reason)); | 58 return adoptRefWillBeNoop(new CloseEvent(wasClean, code, reason)); |
59 } | 59 } |
60 | 60 |
61 static PassRefPtrWillBeRawPtr<CloseEvent> create(const AtomicString& type, c
onst CloseEventInit& initializer) | 61 static PassRefPtrWillBeRawPtr<CloseEvent> create(const AtomicString& type, c
onst CloseEventInit& initializer) |
62 { | 62 { |
63 return adoptRefWillBeNoop(new CloseEvent(type, initializer)); | 63 return adoptRefWillBeNoop(new CloseEvent(type, initializer)); |
64 } | 64 } |
65 | 65 |
66 bool wasClean() const { return m_wasClean; } | 66 bool wasClean() const { return m_wasClean; } |
67 unsigned short code() const { return m_code; } | 67 unsigned short code() const { return m_code; } |
68 String reason() const { return m_reason; } | 68 String reason() const { return m_reason; } |
69 | 69 |
70 // Event function. | 70 // Event function. |
71 virtual const AtomicString& interfaceName() const OVERRIDE { return EventNam
es::CloseEvent; } | 71 virtual const AtomicString& interfaceName() const override { return EventNam
es::CloseEvent; } |
72 | 72 |
73 virtual void trace(Visitor* visitor) OVERRIDE { Event::trace(visitor); } | 73 virtual void trace(Visitor* visitor) override { Event::trace(visitor); } |
74 | 74 |
75 private: | 75 private: |
76 CloseEvent() | 76 CloseEvent() |
77 : Event(EventTypeNames::close, false, false) | 77 : Event(EventTypeNames::close, false, false) |
78 , m_wasClean(false) | 78 , m_wasClean(false) |
79 , m_code(0) { } | 79 , m_code(0) { } |
80 | 80 |
81 CloseEvent(bool wasClean, int code, const String& reason) | 81 CloseEvent(bool wasClean, int code, const String& reason) |
82 : Event(EventTypeNames::close, false, false) | 82 : Event(EventTypeNames::close, false, false) |
83 , m_wasClean(wasClean) | 83 , m_wasClean(wasClean) |
84 , m_code(code) | 84 , m_code(code) |
85 , m_reason(reason) { } | 85 , m_reason(reason) { } |
86 | 86 |
87 CloseEvent(const AtomicString& type, const CloseEventInit& initializer) | 87 CloseEvent(const AtomicString& type, const CloseEventInit& initializer) |
88 : Event(type, initializer) | 88 : Event(type, initializer) |
89 , m_wasClean(initializer.wasClean) | 89 , m_wasClean(initializer.wasClean) |
90 , m_code(initializer.code) | 90 , m_code(initializer.code) |
91 , m_reason(initializer.reason) { } | 91 , m_reason(initializer.reason) { } |
92 | 92 |
93 bool m_wasClean; | 93 bool m_wasClean; |
94 unsigned short m_code; | 94 unsigned short m_code; |
95 String m_reason; | 95 String m_reason; |
96 }; | 96 }; |
97 | 97 |
98 } // namespace blink | 98 } // namespace blink |
99 | 99 |
100 #endif // CloseEvent_h | 100 #endif // CloseEvent_h |
OLD | NEW |