Currently, most of the bubble views that extend LocationBarBubbleDelegateView are closed on tab switch in BrowserView::OnActiveTabChanged. This is undesirable given that the class is enormous (the file is currently 2702 lines long) and not closely associated with the location bar or bubble UI.
A better approach would be for the bubbles to be responsible for closing themselves on tab switch by implementing TabStripModelObserver::TabDeactivated (or having their associated icon views do so). An example of this can be seen in SaveCardIconView. I took a look at moving this logic into LocationBarBubbleDelegateView or BubbleIconView in order to enable it for all of the location bar bubbles but couldn't find a simple way to do this.
The bubbles all have slightly (or largely) different ways of managing their lifecycle, a different relationship to the controller, and a different mechanism for closing them. To do this in a way that would be a nice improvement over the current state would require doing something like having controller logic similar to the save card bubble for each. Which would allow one to get the controller from the web view and close the bubble.
See https://codereview.chromium.org/1813043002/ for associated discussion.
Comment 1 by benhenry@chromium.org
, Aug 1