| 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/toolbar_action_view.h" | 5 #include "chrome/browser/ui/views/toolbar/toolbar_action_view.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 | 8 |
| 9 #include "base/auto_reset.h" | 9 #include "base/auto_reset.h" |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| (...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 103 delegate_->OnMouseEnteredToolbarActionView(); | 103 delegate_->OnMouseEnteredToolbarActionView(); |
| 104 views::MenuButton::OnMouseEntered(event); | 104 views::MenuButton::OnMouseEntered(event); |
| 105 } | 105 } |
| 106 | 106 |
| 107 bool ToolbarActionView::IsTriggerableEvent(const ui::Event& event) { | 107 bool ToolbarActionView::IsTriggerableEvent(const ui::Event& event) { |
| 108 return views::MenuButton::IsTriggerableEvent(event) && | 108 return views::MenuButton::IsTriggerableEvent(event) && |
| 109 (base::TimeTicks::Now() - popup_closed_time_).InMilliseconds() > | 109 (base::TimeTicks::Now() - popup_closed_time_).InMilliseconds() > |
| 110 views::kMinimumMsBetweenButtonClicks; | 110 views::kMinimumMsBetweenButtonClicks; |
| 111 } | 111 } |
| 112 | 112 |
| 113 void ToolbarActionView::AddInkDropLayer(ui::Layer* ink_drop_layer) { | 113 SkColor ToolbarActionView::GetInkDropBaseColor() const { |
| 114 image()->SetPaintToLayer(true); | 114 if (delegate_->ShownInsideMenu()) { |
| 115 image()->SetFillsBoundsOpaquely(false); | 115 return GetNativeTheme()->GetSystemColor( |
| 116 views::MenuButton::AddInkDropLayer(ink_drop_layer); | 116 ui::NativeTheme::kColorId_HoverMenuItemBackgroundColor); |
| 117 } | 117 } |
| 118 | 118 |
| 119 void ToolbarActionView::RemoveInkDropLayer(ui::Layer* ink_drop_layer) { | |
| 120 views::MenuButton::RemoveInkDropLayer(ink_drop_layer); | |
| 121 image()->SetPaintToLayer(false); | |
| 122 } | |
| 123 | |
| 124 SkColor ToolbarActionView::GetInkDropBaseColor() const { | |
| 125 return GetThemeProvider()->GetColor( | 119 return GetThemeProvider()->GetColor( |
| 126 ThemeProperties::COLOR_TOOLBAR_BUTTON_ICON); | 120 ThemeProperties::COLOR_TOOLBAR_BUTTON_ICON); |
| 127 } | 121 } |
| 128 | 122 |
| 129 bool ToolbarActionView::ShouldShowInkDropHover() const { | 123 bool ToolbarActionView::ShouldShowInkDropHover() const { |
| 130 return !delegate_->ShownInsideMenu() && | 124 return !delegate_->ShownInsideMenu() && |
| 131 views::MenuButton::ShouldShowInkDropHover(); | 125 views::MenuButton::ShouldShowInkDropHover(); |
| 132 } | 126 } |
| 133 | 127 |
| 134 content::WebContents* ToolbarActionView::GetCurrentWebContents() const { | 128 content::WebContents* ToolbarActionView::GetCurrentWebContents() const { |
| (...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 334 if (menu_controller->in_nested_run()) { | 328 if (menu_controller->in_nested_run()) { |
| 335 // There is another menu showing. Close the outermost menu (since we are | 329 // There is another menu showing. Close the outermost menu (since we are |
| 336 // shown in the same menu, we don't want to close the whole thing). | 330 // shown in the same menu, we don't want to close the whole thing). |
| 337 menu_controller->Cancel(views::MenuController::EXIT_OUTERMOST); | 331 menu_controller->Cancel(views::MenuController::EXIT_OUTERMOST); |
| 338 return true; | 332 return true; |
| 339 } | 333 } |
| 340 } | 334 } |
| 341 | 335 |
| 342 return false; | 336 return false; |
| 343 } | 337 } |
| OLD | NEW |