Clean up browser controls code in the browser side.

tl;dr:
  Behaviour Before (Aura):
  RWHI->RWHVAura->RWHDelegate->WebContentsImpl->WebContentsDelegate
  Behaviour Before (Android):
  RWHI->RWHVAndroid->RVHDelegateView->WebContentsDelegate and
  RWHI->RWHVAndroid->RVHDelegateView->Interstitials
  Behaviour After (Aura):
  RWHI->RVHDelegateView->WebContentsDelegate
  Behaviour After (Android):
  RWHI->RVHDelegateView->WebContentsDelegate and
  RWHI->RVHDelegateView->Interstitials

  APIs Before:
  RenderWidgetHostDelegate::GetTopControlsHeight()
  RenderViewHostDelegateView::GetTopControlsHeight()
  WebContentsDelegate::GetTopControlsHeight()
  APIs After:
  RenderViewHostDelegateView::GetTopControlsHeight()
  WebContentsDelegate::GetTopControlsHeight()

The RenderViewHostDelegateView API gives the browser controls state.
A pointer to this API is provided by both RenderWidgetHostDelegate and
by RenderViewHostDelegate. These both are implemented in
WebContentsImpl, where the RenderViewHostDelegateView is held.

However RenderWidgetHostDelegate *also* gives the browser controls
state. So we have getters in WebContentsImpl, which redirect to the
WebContentsDelegate. Then (on Android) the RenderViewHostDelegateView
goes back through the WebContentsDelegate to get the value from the
same place as the RenderWidgetHostDelegate getters - except in the
case of android interstitials.

We remove the redundant APIs on WebContentsImpl,
RenderWidgetHostDelegate and RenderViewHostDelegate. And have code
always ask through the RenderViewHostDelegateView.

Secondly, RenderWidgetHostImpl asks the RenderWidgetHostView for the
browser controls state. The Android override goes to the
RenderViewHostDelegateView to return the values. Aura goes through
the RenderWidgetHostDelegate. RenderWidgetHostImpl already has access
to these APIs.

So remove all methods in RenderWidgetHostView to get browser controls
state, and have RenderWidgetHostImpl go directly to its delegate to
get the RenderViewHostDelegateView and get the values. Then have the
platform-specific behaviour via RenderViewHostDelegateView with
Aura and Android-non-interstitials asking the WebContentsDelegate.

Last, there is an if condition around the device scale factor being 0
that should not be possible, so remove it. It was introduced to be
cautious without understanding this can't happen (at least that's my
belief, a 0 DSF would mean all pixels are infinitely small :)).

Working toward making browser control state be a RenderView/WebView
state, since there is only 1 value for the whole page, and in blink
code querying this value is currently broken for OOPIFs (for eg in
FillsViewport() of root_scroller_controller.cc) since it tries to
get these values from the main frame, which would be a proxy. These
values should become clear WebView state instead of per-frame/widget.

R=avi@chromium.org

Change-Id: Ieda5556a32a7a2c8baed1b2291f77ed3665c05a6
Bug: 912193
Reviewed-on: https://chromium-review.googlesource.com/c/1437796
Reviewed-by: Avi Drissman <avi@chromium.org>
Commit-Queue: danakj <danakj@chromium.org>
Cr-Commit-Position: refs/heads/master@{#628004}
18 files changed