| OLD | NEW |
| (Empty) | |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef ScrollStateCallback_h |
| 6 #define ScrollStateCallback_h |
| 7 |
| 8 #include "bindings/core/v8/ScrollStateCallbackToScriptValue.h" |
| 9 #include "core/dom/Element.h" |
| 10 #include "platform/heap/GarbageCollected.h" |
| 11 |
| 12 namespace blink { |
| 13 |
| 14 class ScrollState; |
| 15 |
| 16 class ScrollStateCallback : public GarbageCollectedFinalized<ScrollStateCallback
> { |
| 17 public: |
| 18 enum class CallbackType { |
| 19 UNSET, |
| 20 APPLY_SCROLL, |
| 21 DISTRIBUTE_SCROLL, |
| 22 }; |
| 23 ScrollStateCallback(); |
| 24 virtual ~ScrollStateCallback() {} |
| 25 DEFINE_INLINE_VIRTUAL_TRACE() { visitor->trace(m_targetElement); } |
| 26 virtual void handleEvent(ScrollState*) = 0; |
| 27 void handleEventForElement(Element& targetElement, ScrollState*); |
| 28 ScriptValue toScriptValue(ScriptState* scriptState) { return scrollStateCall
backToScriptValue(*this, scriptState); } |
| 29 CallbackType callbackType() { return m_callbackType; } |
| 30 void setCallbackType(CallbackType callbackType) { m_callbackType = callbackT
ype; } |
| 31 |
| 32 protected: |
| 33 // Used to pass the target element to handleEvent for native |
| 34 // ScrollStateCallback implementations. Null except within the |
| 35 // scope of |handleEventForElement|. |
| 36 RefPtrWillBeMember<Element> m_targetElement; |
| 37 CallbackType m_callbackType; |
| 38 }; |
| 39 |
| 40 } // namespace blink |
| 41 |
| 42 #endif // ScrollStateCallback_h |
| OLD | NEW |