Index: third_party/WebKit/Source/core/page/scrolling/snap/SnapManagerBridge.h |
diff --git a/third_party/WebKit/Source/core/page/scrolling/snap/SnapManagerBridge.h b/third_party/WebKit/Source/core/page/scrolling/snap/SnapManagerBridge.h |
new file mode 100644 |
index 0000000000000000000000000000000000000000..3d5a086cc1aa8b1812744cf7960e679b8ebc23a9 |
--- /dev/null |
+++ b/third_party/WebKit/Source/core/page/scrolling/snap/SnapManagerBridge.h |
@@ -0,0 +1,54 @@ |
+// Copyright 2014 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 SnapManagerBridge_h |
+#define SnapManagerBridge_h |
+ |
+#include "bindings/core/v8/ScriptValue.h" |
+#include "core/page/scrolling/SnapCoordinator.h" |
+#include "platform/heap/Handle.h" |
+#include "wtf/RefCounted.h" |
+#include "wtf/Vector.h" |
+ |
+namespace blink { |
+ |
+class Document; |
+class Node; |
+class Element; |
+class ScriptValue; |
+ |
+// Represents the PrivateScript implementation of snap manager. |
+class CORE_EXPORT SnapManagerBridge : public GarbageCollectedFinalized<SnapManagerBridge>, public SnapCoordinator::Client { |
+public: |
+ static SnapManagerBridge* create(const Document* document) |
+ { |
+ return new SnapManagerBridge(document); |
+ } |
+ virtual ~SnapManagerBridge() {} |
+ |
+ // Delegates to implementation in private script |
+ void didUpdateSnapOffsets(const LayoutBox&, SnapOffsets) override; |
+ |
+ // Invoked from private script |
+ Vector<Element*> getUpdatedSnapContainers(); |
+ |
+ DEFINE_INLINE_TRACE() |
+ { |
+ visitor->trace(m_document); |
+ } |
+ |
+private: |
+ explicit SnapManagerBridge(const Document*); |
+ Member<const Document> m_document; |
+ RefPtr<ScriptState> m_scriptState; |
+ |
+ // The snap manager instance |
+ ScriptValue m_instance; |
+ |
+ void maybeCreateSnapManagerInstance(); |
+}; |
+ |
+} // namespace blink |
+ |
+#endif |