[Mac] Get Suggestions from Whole Text and Current Selection

Currently, the SuggestedTextTouchBarController generates text
suggestions based only text being selected and doesn't take any
surrounding text into account. The goal is to generate text
suggestions from all the text present in the textfield and the
current cursor position, which results in behavior more similar to
Safari's text suggestions.

First, WebContents::DidChangeTextSelection() and
WebContentsObserver::DidChangeTextSelection() were modified to pass in
the whole text in the textfield and the current selection range
instead of the selected text.

The method requestSuggestionsForText: was modified to
requestSuggestionsForText:inRange: so that it may receive the full
text in the textfield along with the range of the current selection.

The WebContentsTextObserver was edited to also observe when a
webpage finishes loading. This way, the controller can check whether
the cursor is in a textfield before the text selection changes. This
is necessary for websites in which a textfield is autofocused.
This currently does not account for text that may be in the
autofocused textfield, which will be addressed in a later CL.

Bug: 717553
Change-Id: I3d56d7e590ba11c9a6c1c2e55f5bf1bb1b398985
Reviewed-on: https://chromium-review.googlesource.com/1101962
Commit-Queue: Tessa Nijssen <tnijssen@google.com>
Reviewed-by: Avi Drissman <avi@chromium.org>
Reviewed-by: Sarah Chan <spqchan@chromium.org>
Cr-Commit-Position: refs/heads/master@{#571208}
8 files changed