Chromium Code Reviews| 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 c852ab9df727befe824d123c1d305cb5d3555a50..7603a9a0db677c3e97a721500bacbc0a40243084 100644 |
| --- a/chrome/browser/ui/views/toolbar/browser_actions_container.cc |
| +++ b/chrome/browser/ui/views/toolbar/browser_actions_container.cc |
| @@ -201,6 +201,21 @@ views::MenuButton* BrowserActionsContainer::GetOverflowReferenceView() { |
| browser_)->toolbar()->app_menu()); |
| } |
| +void BrowserActionsContainer::OnMouseEnteredToolbarActionView() { |
| + if (!shown_bubble_ && !toolbar_action_views_.empty() && |
| + ExtensionToolbarIconSurfacingBubbleDelegate::ShouldShowForProfile( |
| + browser_->profile())) { |
| + ExtensionToolbarIconSurfacingBubble* bubble = |
| + new ExtensionToolbarIconSurfacingBubble( |
| + toolbar_action_views_[0], |
| + make_scoped_ptr(new ExtensionToolbarIconSurfacingBubbleDelegate( |
| + browser_->profile()))); |
| + views::BubbleDelegateView::CreateBubble(bubble); |
| + bubble->Show(); |
| + } |
| + shown_bubble_ = true; |
| +} |
| + |
| void BrowserActionsContainer::AddViewForAction( |
| ToolbarActionViewController* view_controller, |
| size_t index) { |
| @@ -454,18 +469,7 @@ void BrowserActionsContainer::Layout() { |
| } |
| void BrowserActionsContainer::OnMouseEntered(const ui::MouseEvent& event) { |
| - if (!shown_bubble_ && !toolbar_action_views_.empty() && |
| - ExtensionToolbarIconSurfacingBubbleDelegate::ShouldShowForProfile( |
| - browser_->profile())) { |
| - ExtensionToolbarIconSurfacingBubble* bubble = |
| - new ExtensionToolbarIconSurfacingBubble( |
| - toolbar_action_views_[0], |
| - make_scoped_ptr(new ExtensionToolbarIconSurfacingBubbleDelegate( |
| - browser_->profile()))); |
| - views::BubbleDelegateView::CreateBubble(bubble); |
| - bubble->Show(); |
| - } |
| - shown_bubble_ = true; |
| + OnMouseEnteredToolbarActionView(); |
| } |
| bool BrowserActionsContainer::GetDropFormats( |
| @@ -699,10 +703,17 @@ void BrowserActionsContainer::OnPaint(gfx::Canvas* canvas) { |
| // If the views haven't been initialized yet, wait for the next call to |
| // paint (one will be triggered by entering highlight mode). |
| if (toolbar_actions_bar_->is_highlighting() && |
| - !toolbar_action_views_.empty() && |
| - highlight_painter_) { |
| - views::Painter::PaintPainterAt( |
| - canvas, highlight_painter_.get(), GetLocalBounds()); |
| + !toolbar_action_views_.empty() && !in_overflow_mode()) { |
|
Peter Kasting
2015/07/23 00:00:12
Was this just an oversight before? Seems like we
Devlin
2015/07/23 02:43:30
It was implicitly implied by the highlight_painter
|
| + ToolbarActionsBar::HighlightType highlight_type = |
| + toolbar_actions_bar_->GetHighlightType(); |
| + // The toolbar actions bar shouldn't return true for is_highlighting() with |
| + // a highlight type of NONE. |
| + DCHECK_NE(ToolbarActionsBar::HIGHLIGHT_NONE, highlight_type); |
|
Peter Kasting
2015/07/23 00:00:12
Nit: Personally I'd leave out this comment and DCH
Devlin
2015/07/23 15:30:14
Done.
|
| + views::Painter* painter = |
| + highlight_type == ToolbarActionsBar::HIGHLIGHT_INFO |
| + ? info_highlight_painter_.get() |
| + : warning_highlight_painter_.get(); |
| + views::Painter::PaintPainterAt(canvas, painter, GetLocalBounds()); |
| } |
| // TODO(sky/glen): Instead of using a drop indicator, animate the icons while |
| @@ -783,8 +794,12 @@ void BrowserActionsContainer::LoadImages() { |
| *tp->GetImageSkiaNamed(IDR_BROWSER_ACTIONS_OVERFLOW)); |
| } |
| - const int kImages[] = IMAGE_GRID(IDR_DEVELOPER_MODE_HIGHLIGHT); |
| - highlight_painter_.reset(views::Painter::CreateImageGridPainter(kImages)); |
| + const int kInfoImages[] = IMAGE_GRID(IDR_TOOLBAR_ACTION_HIGHLIGHT); |
| + info_highlight_painter_.reset( |
| + views::Painter::CreateImageGridPainter(kInfoImages)); |
| + const int kWarningImages[] = IMAGE_GRID(IDR_DEVELOPER_MODE_HIGHLIGHT); |
| + warning_highlight_painter_.reset( |
| + views::Painter::CreateImageGridPainter(kWarningImages)); |
| } |
| void BrowserActionsContainer::ClearActiveBubble(views::Widget* widget) { |