Split WebWidgetClient and WebViewClient

RenderViewImpl should not be a RenderWidget, but it must be while it
is a WebViewClient and RenderWidget, which is a WebWidgetClient. So
this contributes to the separation of RenderViewImpl and
RenderWidget. This also removes the diamond inheritance of
WebWidgetClient by RenderWidget and RenderViewImpl:

                   RenderWidget
WebWidgetClient -<               >- RenderViewImpl
                   WebViewClient

So RenderWidget no longer needs to use virtual inheritance of the
WebWidgetClient.

Previously WebViewClient was-a WebWidgetClient. Instead make them
separate interfaces, and start to pass them both explictly when they
are both used. Since WebViewClient has a method to return the
WebWidgetClient, we can use that in cases where we only have one. We
could pass them both explicitly to cover these cases too, as a path
to migrate the method off WebViewClient and make them completely
independent.

Layout tests create a RenderWidget by creating a WebWidgetTestProxy which
subclasses RenderWidget and overrides behaviour of WebWidgetClient methods
that RenderWidget implements. This continues to work okay.

But they also create a RenderViewImpl by creating a WebViewTestProxy which
subclasses RenderViewImpl, and also try to override behaviour of the
WebWidgetClient. However since RenderViewImpl is no longer visibly a
WebWidgetClient, it does not by changing what WidgetClient() returns instead
of overriding methods on RenderViewImpl.

This means that production code in RenderViewImpl and RenderWidget trying to
call methods on WebWidgetClient must not do so directly on |this| (ie on
the RenderViewImpl-RenderWidget). Instead they must go through WidgetClient()
which will point to the RenderWidget() in production but to an injected
WebWidgetTestClient in layout tests.

Before:
WebViewTestProxy is-a RenderViewImpl (is-a WebViewClient is-a RenderWidget is-a WebWidgetClient *1*)
WebViewTestProxy has-a WebViewTestClient (is-a WebViewClient is-a WebWidgetClient *2*)
WebViewTestProxy is-a WebWidgetTestProxyBase
WebWidgetTestProxyBase has-a WebWidgetTestClient (is-a WebWidgetClient *3)

WebWidgetTestProxy overrides some methods from RenderWidget *1* and redirects them to the WebWidgetTestClient *3*


After:
WebViewTestProxy is-a RenderViewImpl (is-a WebViewClient is-a RenderWidget is-a WebWidgetClient *1*)
WebViewTestProxy has-a WebViewTestClient (is-a WebViewClient has-a WebWidgetClient *2*)
WebViewTestProxy is-a WebWidgetTestProxyBase
WebWidgetTestProxyBase has-a WebWidgetTestClient (is-a WebWidgetClient *3)

WebWidgetTestProxy has a ProxyWebWidgetClient which forwards most things to the RenderWidget *1*
but ProxyWebWidgetClient redirects some methods to the WebWidgetTestClient *3*

Note that *2* changes from inherited to ownership instead, though it's not clear that
the WebWidgetTestClient ever is asked for its WebWidgetClient, since it is only used to
capture some calls that would have gone to the RenderViewImpl.

R=dcheng@chromium.org
TBR=jochen

Bug: 419087
Change-Id: I26ce181e8cf31d1fa9244d448a7e01f401081ac8
Reviewed-on: https://chromium-review.googlesource.com/1134427
Commit-Queue: danakj <danakj@chromium.org>
Reviewed-by: danakj <danakj@chromium.org>
Reviewed-by: Albert J. Wong <ajwong@chromium.org>
Reviewed-by: Daniel Cheng <dcheng@chromium.org>
Reviewed-by: Dmitry Gozman <dgozman@chromium.org>
Cr-Commit-Position: refs/heads/master@{#575849}
31 files changed