Chromium Code Reviews| Index: Source/core/page/scrolling/ScrollStateCallback.h |
| diff --git a/Source/core/page/scrolling/ScrollStateCallback.h b/Source/core/page/scrolling/ScrollStateCallback.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..969abbefbbeb136ca0ef0ee7d042f890be6180b9 |
| --- /dev/null |
| +++ b/Source/core/page/scrolling/ScrollStateCallback.h |
| @@ -0,0 +1,43 @@ |
| +// Copyright 2015 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#ifndef ScrollStateCallback_h |
| +#define ScrollStateCallback_h |
| + |
| +#include "core/dom/Element.h" |
| +#include "platform/heap/GarbageCollected.h" |
| + |
| +namespace blink { |
| + |
| +class ScrollState; |
| + |
| +class ScrollStateCallback : public RefCountedWillBeGarbageCollectedFinalized<ScrollStateCallback> { |
|
haraken
2015/06/27 08:09:33
I think we can just make Oilpan the default. WillB
tdresser
2015/06/29 20:59:33
Thanks, that definitely simplifies things.
|
| +public: |
| + enum class CallbackType { |
| + UNSET, |
| + APPLY_SCROLL, |
| + DISTRIBUTE_SCROLL, |
| + }; |
| + ScrollStateCallback(); |
| + virtual ~ScrollStateCallback() |
| + { |
| + } |
| + DEFINE_INLINE_VIRTUAL_TRACE() {} |
| + virtual void handleEvent(ScrollState*) = 0; |
| + void handleEventForElement(Element& targetElement, ScrollState*); |
| + ScriptValue toScriptValue(ScriptState*); |
| + CallbackType callbackType() { return m_callbackType; } |
| + void setCallbackType(CallbackType callbackType) { m_callbackType = callbackType; } |
| + |
| +protected: |
| + // Used to pass the target element to handleEvent for native |
| + // ScrollStateCallback implementations. Null except within the |
| + // scope of |handleEventForElement|. |
| + Element* m_targetElement; |
|
haraken
2015/06/27 08:09:33
This is a strong reference, so shall we use Member
tdresser
2015/06/29 20:59:33
It can't be a Member<Element> in the non-oilpan ca
|
| + CallbackType m_callbackType; |
| +}; |
| + |
| +} // namespace blink |
| + |
| +#endif // ScrollStateCallback_h |