[Contextual Search] Robustness for SendSurroundingText.
Update code calling SendSurroundingText to make sure all
values are reasonable to avoid crashes reported in these
bugs. I do not have a reproducable case to manually
recreate the crash, so just making the code more
robust, with the aim that this will prevent these
crashes. My guess at the failure is a negative
start offset being returned by the surrounding text
Blink callback.
Also made two changes to make the code more readable:
1) Changed usage of base::string16#size to use
base::string16#length to get the length in characters.
2) Simplified the computation of the start_position.
BUG=512985, 516650
Review URL: https://codereview.chromium.org/
1294913006
Cr-Commit-Position: refs/heads/master@{#344342}