| Index: chrome/browser/ui/views/toolbar/browser_actions_container.cc
|
| diff --git a/chrome/browser/ui/views/toolbar/browser_actions_container.cc b/chrome/browser/ui/views/toolbar/browser_actions_container.cc
|
| index fd235129d4b4d06a242a0623f18acb4d5cc55d8a..c919144e983ef02084ed97a562489b19e2a8a3b1 100644
|
| --- a/chrome/browser/ui/views/toolbar/browser_actions_container.cc
|
| +++ b/chrome/browser/ui/views/toolbar/browser_actions_container.cc
|
| @@ -309,42 +309,41 @@ void BrowserActionsContainer::ShowToolbarActionBubble(
|
| std::unique_ptr<ToolbarActionsBarBubbleDelegate> controller) {
|
| // The container shouldn't be asked to show a bubble if it's animating.
|
| DCHECK(!animating());
|
| + DCHECK(!active_bubble_);
|
| +
|
| views::View* anchor_view = nullptr;
|
| if (!controller->GetAnchorActionId().empty()) {
|
| ToolbarActionView* action_view =
|
| GetViewForId(controller->GetAnchorActionId());
|
| - anchor_view =
|
| - action_view->visible() ? action_view : GetOverflowReferenceView();
|
| + if (action_view) {
|
| + anchor_view =
|
| + action_view->visible() ? action_view : GetOverflowReferenceView();
|
| + } else {
|
| + anchor_view = BrowserView::GetBrowserViewForBrowser(browser_)
|
| + ->toolbar()
|
| + ->app_menu_button();
|
| + }
|
| } else {
|
| anchor_view = this;
|
| }
|
| - ToolbarActionsBarBubbleViews* bubble =
|
| - new ToolbarActionsBarBubbleViews(anchor_view, std::move(controller));
|
| - views::BubbleDelegateView::CreateBubble(bubble);
|
| - bubble->Show();
|
| -}
|
|
|
| -void BrowserActionsContainer::ShowExtensionMessageBubble(
|
| - std::unique_ptr<extensions::ExtensionMessageBubbleController> controller,
|
| - ToolbarActionViewController* anchor_action) {
|
| - // The container shouldn't be asked to show a bubble if it's animating.
|
| - DCHECK(!animating());
|
| -
|
| - views::View* reference_view =
|
| - anchor_action
|
| - ? static_cast<views::View*>(GetViewForId(anchor_action->GetId()))
|
| - : BrowserView::GetBrowserViewForBrowser(browser_)
|
| - ->toolbar()
|
| - ->app_menu_button();
|
| -
|
| - extensions::ExtensionMessageBubbleView* bubble =
|
| - new extensions::ExtensionMessageBubbleView(reference_view,
|
| - views::BubbleBorder::TOP_RIGHT,
|
| - std::move(controller));
|
| - views::BubbleDelegateView::CreateBubble(bubble);
|
| - active_bubble_ = bubble;
|
| - active_bubble_->GetWidget()->AddObserver(this);
|
| - bubble->Show();
|
| + // TODO(devlin): Clean up this type-specific mess.
|
| + if (controller->IsExtensionMessageBubble()) {
|
| + extensions::ExtensionMessageBubbleView* bubble =
|
| + new extensions::ExtensionMessageBubbleView(
|
| + anchor_view, views::BubbleBorder::TOP_RIGHT, std::move(controller));
|
| + views::BubbleDelegateView::CreateBubble(bubble);
|
| + active_bubble_ = bubble;
|
| + active_bubble_->GetWidget()->AddObserver(this);
|
| + bubble->Show();
|
| + } else {
|
| + ToolbarActionsBarBubbleViews* bubble =
|
| + new ToolbarActionsBarBubbleViews(anchor_view, std::move(controller));
|
| + views::BubbleDelegateView::CreateBubble(bubble);
|
| + active_bubble_ = bubble;
|
| + active_bubble_->GetWidget()->AddObserver(this);
|
| + bubble->Show();
|
| + }
|
| }
|
|
|
| void BrowserActionsContainer::OnWidgetClosing(views::Widget* widget) {
|
| @@ -766,4 +765,5 @@ void BrowserActionsContainer::ClearActiveBubble(views::Widget* widget) {
|
| DCHECK_EQ(active_bubble_->GetWidget(), widget);
|
| widget->RemoveObserver(this);
|
| active_bubble_ = nullptr;
|
| + toolbar_actions_bar_->OnBubbleClosed();
|
| }
|
|
|