Refactor OmniboxNavigationObserver in preparation for making it trigger the
ShortcutsBackend:
* Use WebContentsObserver instead of NotificationObserver to handle everything
except the initial "which tab kicked off the load?" message. The resulting
code seems slightly clearer, and more this goes along with the general push to
reduce/eliminate notification usage that's been happening across the codebase.
* Move the State enum, which was mainly about the URLFetcher state, to the
private section and replace the navigated_to_entry_ bool with a public enum.
This allows the edit model to decide whether to delete the object based on
whether a load started, as opposed to based on whether a URL fetch started;
this in turn will be necessary for the non-"alternate nav" cases to still add
shortcuts to the shortcuts backend. Note that this means today the
OmniboxNavigationObserver object will begin deleting itself (at commit time)
for loads without an alternate_nav_url as opposed to having the edit model
delete it (at load kickoff time). This shouldn't have any meaningful effects.
* Eliminate StartFetch() by scattering its pieces throughout other functions.
* Convert SetStatusFromURLFetch() to a pair of non-member helpers, in
anticipation of needing to call them seperately to verify if the main
navigation was "successful" before we add a shortcut for it.
* BEHAVIORAL CHANGE: Also modify the new IsValidNavigation() function to not
consider as "invalid" attempts to explicitly load the
IntranetRedirectDetector's RedirectOrigin(). While this scenario was very
unlikely in the world where we only cared about alternate_nav_urls, it will be
more likely when checking all user omnibox navigations in order to add
shortcuts.
* Rename ShowInfoBarIfPossible() to the intentionally-more-generic
OnAllLoadingFinished(), and move some of its logic out to the caller side for
shorter overall code.
This also does a little misc. cleanup to OmniboxEditModel while I'm touching it,
mostly to remove using declarations that don't save lines.
BUG=151044
TEST=none
R=sky@chromium.org
Review URL: https://codereview.chromium.org/
26515007
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@228520 0039d316-1c4b-4281-b951-d872f2087c98