Support tracking focused node element for OOPIFs.

Focused elements are tracked by RenderViewHostImpl. Upon a change in focused
element, RenderViewImpl sends ViewHostMsg_FocusedNodeChanged to the browser.

With --site-per-process, RenderViewImpl corresponding to OOPIFs is swapped
out and cannot send the IPC. Even by allowing sending such IPCs in swapped
out state, the RenderViewHost cannot properly handle them when there are
multiple RenderWidgetHosts (same process) on the page. This is now causing
regressions with OSK for windows tablets.

This CL will move the logic from RenderViewImpl to RenderFrameImpl.
When focus moves from one WebNode to another, the corresponding frames are
already getting notified by RenderViewImpl. This CL relieves RenderViewImpl
from sending the IPC, and reuses the RenderFrameImpl::FocusNodeChanged() for
sending the update to RenderFrameHostImpl, which then stores the state and
notifies its delegate (WebContentsImpl) about the change.

For similar reasons, the logic to update FocusedNodeTouched is removed from
RenderViewImpl to RenderWidget and is now handled by RenderWidgetHostImpl.

The public API methods in RenderViewHost are unchanged but they are now
handled through RenderViewHostDelegate (WebContentsImpl), which will
query the information or send the command through the focused frame.

BUG=613326
[email protected]
CQ_INCLUDE_TRYBOTS=master.tryserver.chromium.linux:linux_site_isolation

Review-Url: https://codereview.chromium.org/2571583008
Cr-Commit-Position: refs/heads/master@{#440185}
diff --git a/content/renderer/render_widget.cc b/content/renderer/render_widget.cc
index f25fa82..cb6b0b15 100644
--- a/content/renderer/render_widget.cc
+++ b/content/renderer/render_widget.cc
@@ -2115,6 +2115,19 @@
     else
       UpdateTextInputState(ShowIme::IF_NEEDED, ChangeSource::FROM_NON_IME);
   }
+// TODO(ananta): Piggyback off existing IPCs to communicate this information,
+// crbug/420130.
+#if defined(OS_WIN)
+  if (event.type != blink::WebGestureEvent::GestureTap)
+    return;
+
+  // TODO(estade): hit test the event against focused node to make sure
+  // the tap actually hit the focused node.
+  blink::WebTextInputType text_input_type = GetWebWidget()->textInputType();
+
+  Send(new ViewHostMsg_FocusedNodeTouched(
+      routing_id_, text_input_type != blink::WebTextInputTypeNone));
+#endif
 #endif
 }