Index: third_party/WebKit/Source/web/FrameletClientImpl.cpp |
diff --git a/third_party/WebKit/Source/web/FrameletClientImpl.cpp b/third_party/WebKit/Source/web/FrameletClientImpl.cpp |
new file mode 100644 |
index 0000000000000000000000000000000000000000..134afbd8f53fe0a08818b43aafdf0102624d2750 |
--- /dev/null |
+++ b/third_party/WebKit/Source/web/FrameletClientImpl.cpp |
@@ -0,0 +1,89 @@ |
+// 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. |
+ |
+#include "web/FrameletClientImpl.h" |
+ |
+#include "core/events/GestureEvent.h" |
+#include "core/events/KeyboardEvent.h" |
+#include "core/events/MouseEvent.h" |
+#include "core/events/TouchEvent.h" |
+#include "core/events/WheelEvent.h" |
+#include "core/frame/FrameletView.h" |
+#include "core/layout/LayoutPart.h" |
+#include "public/web/WebFrameletClient.h" |
+#include "web/WebFrameletImpl.h" |
+#include "web/WebInputEventConversion.h" |
+ |
+namespace blink { |
+ |
+FrameletClientImpl::FrameletClientImpl(WebFrameletImpl* webFrame) |
+ : m_webFramelet(webFrame) |
+{ |
+} |
+ |
+PassOwnPtrWillBeRawPtr<FrameletClientImpl> FrameletClientImpl::create(WebFrameletImpl* webFramelet) |
+{ |
+ return adoptPtrWillBeNoop(new FrameletClientImpl(webFramelet)); |
+} |
+ |
+DEFINE_TRACE(FrameletClientImpl) |
+{ |
+ visitor->trace(m_webFramelet); |
+ FrameletClient::trace(visitor); |
+} |
+ |
+void FrameletClientImpl::didAttach() |
+{ |
+ m_webFramelet->client()->didAttach(m_webFramelet); |
+} |
+ |
+void FrameletClientImpl::didDetach() |
+{ |
+ m_webFramelet->client()->didDetach(); |
+} |
+ |
+// FIXME: Remove this code once we have input routing in the browser |
+// process. See http://crbug.com/339659. |
+void FrameletClientImpl::forwardInputEvent(Event* event) |
+{ |
+ // See https://crbug.com/520705. |
+ // FIXME: We should eventually do direct routing of input. |
+ if (!m_webFramelet->framelet()->ownerLayoutObject()) |
+ return; |
+ |
+ OwnPtr<WebInputEvent> webEvent; |
+ if (event->isKeyboardEvent()) |
+ webEvent = adoptPtr(new WebKeyboardEventBuilder(*static_cast<KeyboardEvent*>(event))); |
+ else if (event->isMouseEvent()) |
+ webEvent = adoptPtr(new WebMouseEventBuilder(m_webFramelet->framelet()->view(), m_webFramelet->framelet()->ownerLayoutObject(), *static_cast<MouseEvent*>(event))); |
+ else if (event->isWheelEvent()) |
+ webEvent = adoptPtr(new WebMouseWheelEventBuilder(m_webFramelet->framelet()->view(), m_webFramelet->framelet()->ownerLayoutObject(), *static_cast<WheelEvent*>(event))); |
+ else if (event->isGestureEvent()) |
+ webEvent = adoptPtr(new WebGestureEventBuilder(m_webFramelet->framelet()->ownerLayoutObject(), *static_cast<GestureEvent*>(event))); |
+ else if (event->isTouchEvent()) |
+ webEvent = adoptPtr(new WebTouchEventBuilder(m_webFramelet->framelet()->ownerLayoutObject(), *static_cast<TouchEvent*>(event))); |
+ |
+ // Other or internal Blink events should not be forwarded. |
+ if (!webEvent || webEvent->type == WebInputEvent::Undefined) |
+ return; |
+ |
+ m_webFramelet->client()->forwardInputEvent(webEvent.get()); |
+} |
+ |
+void FrameletClientImpl::frameRectsChanged(const IntRect& frameRect) |
+{ |
+ m_webFramelet->client()->frameRectsChanged(frameRect); |
+} |
+ |
+void FrameletClientImpl::updateFocus(bool focused, WebFocusType type) |
+{ |
+ m_webFramelet->client()->updateFocus(focused, type); |
+} |
+ |
+void FrameletClientImpl::updateVisibility(bool visible) |
+{ |
+ m_webFramelet->client()->updateVisibility(visible); |
+} |
+ |
+} // namespace blink |