OLD | NEW |
---|---|
1 /* | 1 /* |
2 * Copyright (C) 2010 Google Inc. All rights reserved. | 2 * Copyright (C) 2010 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 19 matching lines...) Expand all Loading... | |
30 | 30 |
31 #ifndef WebDOMEvent_h | 31 #ifndef WebDOMEvent_h |
32 #define WebDOMEvent_h | 32 #define WebDOMEvent_h |
33 | 33 |
34 #include "../../../../public/platform/WebCommon.h" | 34 #include "../../../../public/platform/WebCommon.h" |
35 #include "../../../../public/platform/WebString.h" | 35 #include "../../../../public/platform/WebString.h" |
36 #include "WebNode.h" | 36 #include "WebNode.h" |
37 | 37 |
38 namespace WebCore { class Event; } | 38 namespace WebCore { class Event; } |
39 #if WEBKIT_IMPLEMENTATION | 39 #if WEBKIT_IMPLEMENTATION |
40 #include "wtf/RefPtr.h" | |
40 namespace WTF { template <typename T> class PassRefPtr; } | 41 namespace WTF { template <typename T> class PassRefPtr; } |
41 #endif | 42 #endif |
42 | 43 |
43 namespace WebKit { | 44 namespace WebKit { |
44 | 45 |
45 class WebDOMEvent { | 46 class WebDOMEvent { |
46 public: | 47 public: |
47 enum PhaseType { | 48 enum PhaseType { |
48 CapturingPhase = 1, | 49 CapturingPhase = 1, |
49 AtTarget = 2, | 50 AtTarget = 2, |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
105 | 106 |
106 template<typename T> const T toConst() const | 107 template<typename T> const T toConst() const |
107 { | 108 { |
108 T res; | 109 T res; |
109 res.WebDOMEvent::assign(*this); | 110 res.WebDOMEvent::assign(*this); |
110 return res; | 111 return res; |
111 } | 112 } |
112 | 113 |
113 protected: | 114 protected: |
114 typedef WebCore::Event WebDOMEventPrivate; | 115 typedef WebCore::Event WebDOMEventPrivate; |
115 void assign(WebDOMEventPrivate*); | 116 void assign(const WTF::PassRefPtr<WebDOMEventPrivate>&); |
116 WebDOMEventPrivate* m_private; | 117 WTF::RefPtr<WebDOMEventPrivate> m_private; |
abarth-chromium
2013/05/20 22:04:45
We can't use WTF::RefPtr directly because the cons
| |
117 | 118 |
118 template<typename T> T* unwrap() | 119 template<typename T> T* unwrap() |
119 { | 120 { |
120 return static_cast<T*>(m_private); | 121 return static_cast<T*>(m_private.get()); |
121 } | 122 } |
122 | 123 |
123 template<typename T> const T* constUnwrap() const | 124 template<typename T> const T* constUnwrap() const |
124 { | 125 { |
125 return static_cast<const T*>(m_private); | 126 return static_cast<const T*>(m_private.get()); |
126 } | 127 } |
127 }; | 128 }; |
128 | 129 |
129 } // namespace WebKit | 130 } // namespace WebKit |
130 | 131 |
131 #endif | 132 #endif |
OLD | NEW |