| 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 301 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 312 void BrowserActionsContainer::StopAnimating() { | 312 void BrowserActionsContainer::StopAnimating() { |
| 313 animation_target_size_ = width(); | 313 animation_target_size_ = width(); |
| 314 resize_animation_->Reset(); | 314 resize_animation_->Reset(); |
| 315 } | 315 } |
| 316 | 316 |
| 317 int BrowserActionsContainer::GetChevronWidth() const { | 317 int BrowserActionsContainer::GetChevronWidth() const { |
| 318 return chevron_ ? | 318 return chevron_ ? |
| 319 chevron_->GetPreferredSize().width() + GetChevronSpacing() : 0; | 319 chevron_->GetPreferredSize().width() + GetChevronSpacing() : 0; |
| 320 } | 320 } |
| 321 | 321 |
| 322 void BrowserActionsContainer::ShowToolbarActionBubble( |
| 323 scoped_ptr<ToolbarActionsBarBubbleDelegate> controller) { |
| 324 // The container shouldn't be asked to show a bubble if it's animating. |
| 325 DCHECK(!animating()); |
| 326 views::View* anchor_view = nullptr; |
| 327 if (!controller->GetAnchorActionId().empty()) { |
| 328 ToolbarActionView* action_view = |
| 329 GetViewForId(controller->GetAnchorActionId()); |
| 330 anchor_view = |
| 331 action_view->visible() ? action_view : GetOverflowReferenceView(); |
| 332 } else { |
| 333 anchor_view = this; |
| 334 } |
| 335 ToolbarActionsBarBubbleViews* bubble = |
| 336 new ToolbarActionsBarBubbleViews(anchor_view, std::move(controller)); |
| 337 views::BubbleDelegateView::CreateBubble(bubble); |
| 338 bubble->Show(); |
| 339 } |
| 340 |
| 322 void BrowserActionsContainer::ShowExtensionMessageBubble( | 341 void BrowserActionsContainer::ShowExtensionMessageBubble( |
| 323 scoped_ptr<extensions::ExtensionMessageBubbleController> controller, | 342 scoped_ptr<extensions::ExtensionMessageBubbleController> controller, |
| 324 ToolbarActionViewController* anchor_action) { | 343 ToolbarActionViewController* anchor_action) { |
| 325 // The container shouldn't be asked to show a bubble if it's animating. | 344 // The container shouldn't be asked to show a bubble if it's animating. |
| 326 DCHECK(!animating()); | 345 DCHECK(!animating()); |
| 327 | 346 |
| 328 views::View* reference_view = | 347 views::View* reference_view = |
| 329 anchor_action | 348 anchor_action |
| 330 ? static_cast<views::View*>(GetViewForId(anchor_action->GetId())) | 349 ? static_cast<views::View*>(GetViewForId(anchor_action->GetId())) |
| 331 : BrowserView::GetBrowserViewForBrowser(browser_) | 350 : BrowserView::GetBrowserViewForBrowser(browser_) |
| (...skipping 427 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 759 warning_highlight_painter_.reset( | 778 warning_highlight_painter_.reset( |
| 760 views::Painter::CreateImageGridPainter(kWarningImages)); | 779 views::Painter::CreateImageGridPainter(kWarningImages)); |
| 761 } | 780 } |
| 762 | 781 |
| 763 void BrowserActionsContainer::ClearActiveBubble(views::Widget* widget) { | 782 void BrowserActionsContainer::ClearActiveBubble(views::Widget* widget) { |
| 764 DCHECK(active_bubble_); | 783 DCHECK(active_bubble_); |
| 765 DCHECK_EQ(active_bubble_->GetWidget(), widget); | 784 DCHECK_EQ(active_bubble_->GetWidget(), widget); |
| 766 widget->RemoveObserver(this); | 785 widget->RemoveObserver(this); |
| 767 active_bubble_ = nullptr; | 786 active_bubble_ = nullptr; |
| 768 } | 787 } |
| OLD | NEW |