Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "chrome/browser/ui/views/toolbar/browser_actions_container.h" | 5 #include "chrome/browser/ui/views/toolbar/browser_actions_container.h" |
| 6 | 6 |
| 7 #include <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "base/compiler_specific.h" | 9 #include "base/compiler_specific.h" |
| 10 #include "base/stl_util.h" | 10 #include "base/stl_util.h" |
| (...skipping 310 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 321 anchor_view = BrowserView::GetBrowserViewForBrowser(browser_) | 321 anchor_view = BrowserView::GetBrowserViewForBrowser(browser_) |
| 322 ->toolbar() | 322 ->toolbar() |
| 323 ->app_menu_button(); | 323 ->app_menu_button(); |
| 324 } | 324 } |
| 325 } else { | 325 } else { |
| 326 anchor_view = this; | 326 anchor_view = this; |
| 327 } | 327 } |
| 328 | 328 |
| 329 ToolbarActionsBarBubbleViews* bubble = | 329 ToolbarActionsBarBubbleViews* bubble = |
| 330 new ToolbarActionsBarBubbleViews(anchor_view, std::move(controller)); | 330 new ToolbarActionsBarBubbleViews(anchor_view, std::move(controller)); |
| 331 views::BubbleDelegateView::CreateBubble(bubble); | 331 views::BubbleDialogDelegateView::CreateBubble(bubble); |
| 332 bubble->GetWidget()->AddObserver(this); | |
| 333 bubble->Show(); | |
| 332 active_bubble_ = bubble; | 334 active_bubble_ = bubble; |
|
Devlin
2016/04/13 22:36:53
nit: I seem to recall once running into some edge
Evan Stade
2016/04/14 00:37:08
Done.
| |
| 333 active_bubble_->GetWidget()->AddObserver(this); | |
| 334 bubble->Show(); | |
| 335 } | 335 } |
| 336 | 336 |
| 337 void BrowserActionsContainer::OnWidgetClosing(views::Widget* widget) { | 337 void BrowserActionsContainer::OnWidgetClosing(views::Widget* widget) { |
| 338 ClearActiveBubble(widget); | 338 ClearActiveBubble(widget); |
| 339 } | 339 } |
| 340 | 340 |
| 341 void BrowserActionsContainer::OnWidgetDestroying(views::Widget* widget) { | 341 void BrowserActionsContainer::OnWidgetDestroying(views::Widget* widget) { |
| 342 ClearActiveBubble(widget); | 342 ClearActiveBubble(widget); |
| 343 } | 343 } |
| 344 | 344 |
| (...skipping 403 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 748 views::Painter::CreateImageGridPainter(kWarningImages)); | 748 views::Painter::CreateImageGridPainter(kWarningImages)); |
| 749 } | 749 } |
| 750 | 750 |
| 751 void BrowserActionsContainer::ClearActiveBubble(views::Widget* widget) { | 751 void BrowserActionsContainer::ClearActiveBubble(views::Widget* widget) { |
| 752 DCHECK(active_bubble_); | 752 DCHECK(active_bubble_); |
| 753 DCHECK_EQ(active_bubble_->GetWidget(), widget); | 753 DCHECK_EQ(active_bubble_->GetWidget(), widget); |
| 754 widget->RemoveObserver(this); | 754 widget->RemoveObserver(this); |
| 755 active_bubble_ = nullptr; | 755 active_bubble_ = nullptr; |
| 756 toolbar_actions_bar_->OnBubbleClosed(); | 756 toolbar_actions_bar_->OnBubbleClosed(); |
| 757 } | 757 } |
| OLD | NEW |