[Views] Clear Focus Instead of Focusing Tab Strip on Tab Drag

When a tab is being dragged, the current instance of TabDragController
calls FocusManager::SetFocusedView()  and passes the tab strip that is
the source of the drag. Since the tab strip is not focusable, the
focus is moved to the next focusable element. In MacViews (when
keyboard accessibility is not turned on), this is the omnibox,
resulting in the omnibox being focused during a drag.

Instead of calling SetFocusedView(), FocusManager::ClearFocus() should
be called. This way, whichever element is currently focused will lose
focus during a drag, as is desired. However, no new element will be
focused, so there is no chance that an undesired focus occurs. When the
drag finishes, TabDragController restores focus to the previously
focused element as it previously did.

On ClearFocus(), the window associated with the top root view gets
focus, so key events are still forwarded properly and hitting Esc
still cancels the drag in progress.

The interactive UI test was slightly modified to check that the window
of the attached tab strip has focus rather than the tab strip itself
to reflect the new behavior.

Bug: 835550
Change-Id: Iff846e24e31428737ae204dd9e68f2f57ee83bad
Reviewed-on: https://chromium-review.googlesource.com/1132133
Commit-Queue: Tessa Nijssen <tnijssen@google.com>
Reviewed-by: Peter Kasting <pkasting@chromium.org>
Cr-Commit-Position: refs/heads/master@{#575368}
2 files changed