Fix multiple problems with omnibox text handling across focus changes.
(1) RenderText was drawing unfocused selections with the non-selection
    background color, but the selected text color, leading to white-on-white
    text.  Fix by drawing unfocused selected text as unselected.
(2) OmniboxViewViews was preserving selections across focus changes using
    SaveStateToTab(), leading to problems when something about the omnibox state
    changed after the omnibox was unfocused -- a later state restoration would
    restore a selection model that no longer lined up with the rest of the
    omnibox state (e.g. the current text).  Fix by tracking selection across
    focus changes in the same way OmniboxViewWin does.
(3) On tab changes, OnTabChanged() could be followed by an OnBlur()/OnFocus()
    call if changing from a tab where the omnibox was focused to one where it
    wasn't (or vice versa).  This led to the selection state being stomped.
    Fixed by making Browser give BrowserWindow first crack at handling the tab
    change.  This makes tabbing out of the omnibox, changing tabs away and back,
    and tabbing back in correctly restore the selection even when changing
    between tabs that disagree about whether the omnibox is focused.

BUG=293258
TEST=Following steps in bug comment 0 does not result in invisible text
[email protected], [email protected], [email protected]

Review URL: https://codereview.chromium.org/23536075

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@225074 0039d316-1c4b-4281-b951-d872f2087c98
diff --git a/chrome/browser/ui/browser_window.h b/chrome/browser/ui/browser_window.h
index 07bc569..f219b74 100644
--- a/chrome/browser/ui/browser_window.h
+++ b/chrome/browser/ui/browser_window.h
@@ -111,6 +111,14 @@
   // Sets the starred state for the current tab.
   virtual void SetStarredState(bool is_starred) = 0;
 
+  // Called when the active tab changes.  Subclasses which implement
+  // TabStripModelObserver should implement this instead of ActiveTabChanged();
+  // the Browser will call this method while processing that one.
+  virtual void OnActiveTabChanged(content::WebContents* old_contents,
+                                  content::WebContents* new_contents,
+                                  int index,
+                                  int reason) = 0;
+
   // Called to force the zoom state to for the active tab to be recalculated.
   // |can_show_bubble| is true when a user presses the zoom up or down keyboard
   // shortcuts and will be false in other cases (e.g. switching tabs, "clicking"