Change meaning of "IsLoadingToDifferentDocument" in WebContents to only
apply to loads in the main frame.

The distinction between "IsLoading" and "IsLoadingToDifferentDocument"
appears to only be relevant in UI contexts (e.g. TabRendererData, which
controls whether to show the throbber in the tabstrip on desktop
Chrome). I think the distinction only makes sense in the context of the
main frame and a load in a subframe should always be lumped in with
non-top-level document loads. For example, on Android it's sometimes
used to conditionally call ToolbarLayout.onNavigatedToDifferentPage(),
which from other callsites definitely appears to only care about main
frame navigations.

Making this change means the throbber won't flicker when content is
loaded in an iframe right after the main frame finishes loading, which
happens a lot (see bug).

With this change, we can probably remove the timer added in
896032108c97ec8e014f which attempts to smooth out favicon/throbber
flickering.

Bug: 734104
Change-Id: Ie14b1c54956479021fd9aa6c4c8aa690be52f193
Reviewed-on: https://chromium-review.googlesource.com/569060
Reviewed-by: Pavel Feldman <[email protected]>
Reviewed-by: Scott Violet <[email protected]>
Commit-Queue: Evan Stade <[email protected]>
Cr-Commit-Position: refs/heads/master@{#486854}
diff --git a/content/browser/web_contents/web_contents_impl.cc b/content/browser/web_contents/web_contents_impl.cc
index b85d291..e967a2f 100644
--- a/content/browser/web_contents/web_contents_impl.cc
+++ b/content/browser/web_contents/web_contents_impl.cc
@@ -4812,7 +4812,8 @@
 
 void WebContentsImpl::DidStartLoading(FrameTreeNode* frame_tree_node,
                                       bool to_different_document) {
-  LoadingStateChanged(to_different_document, false, nullptr);
+  LoadingStateChanged(frame_tree_node->IsMainFrame() && to_different_document,
+                      false, nullptr);
 
   // Notify accessibility that the user is navigating away from the
   // current document.