Index: Source/core/frame/ViewportChangeNotifier.cpp |
diff --git a/Source/core/frame/ViewportChangeNotifier.cpp b/Source/core/frame/ViewportChangeNotifier.cpp |
new file mode 100644 |
index 0000000000000000000000000000000000000000..0d0d35d17a79b06b9dc3ecc5d0c7690ff34dbd17 |
--- /dev/null |
+++ b/Source/core/frame/ViewportChangeNotifier.cpp |
@@ -0,0 +1,33 @@ |
+// 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. |
+ |
+#include "config.h" |
+#include "core/frame/ViewportChangeNotifier.h" |
+ |
+namespace WebCore { |
+ |
+PassOwnPtrWillBeRawPtr<ViewportChangeNotifier> ViewportChangeNotifier::create() |
+{ |
+ return adoptPtrWillBeNoop(new ViewportChangeNotifier()); |
+} |
+ |
+void ViewportChangeNotifier::addListener(PassRefPtrWillBeRawPtr<ViewportChangeListener> listener) |
+{ |
+ m_listeners.add(listener); |
+} |
+ |
+void ViewportChangeNotifier::removeListener(PassRefPtrWillBeRawPtr<ViewportChangeListener> listener) |
+{ |
+ ListenerContainer::iterator it = m_listeners.find(listener.get()); |
+ if (it != m_listeners.end()) |
+ m_listeners.remove(it); |
+} |
+ |
+void ViewportChangeNotifier::viewportChanged() |
+{ |
+ for (ListenerContainer::iterator it = m_listeners.begin(); it != m_listeners.end(); ++it) |
+ (*it)->viewportChanged(); |
+} |
+ |
+} // namespace |