Avoid updating remove suggestion button visibility in Invalidate().

Invalidate() runs more often than necessary, though since the code to update
visibility only conditionally calls InvalidateLayout() this doesn't really
matter.  Slightly more problematic is that updating in Invalidate() makes it
harder to see which events can and cannot affect visibility.  Most importantly,
Invalidate() expects remove button visibility to already be up-to-date on entry.

Instead, factor out remove button visibility updates to a helper, then call this
in the cases where the state can change.  This requires some plumbing changes to
notify a result view when it's losing selection.

Bug: none
Change-Id: I5d5bdec3dce9d22d4bc5d9cbe62eed9d60fb243a
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1940563
Auto-Submit: Peter Kasting <pkasting@chromium.org>
Reviewed-by: Tommy Li <tommycli@chromium.org>
Reviewed-by: Justin Donnelly <jdonnelly@chromium.org>
Commit-Queue: Peter Kasting <pkasting@chromium.org>
Cr-Commit-Position: refs/heads/master@{#723089}
8 files changed