Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(4195)

Unified Diff: chrome/browser/ui/views/toolbar/toolbar_button.cc

Issue 1242573005: Added the Material Design ink drop ripple effect to the navigation buttons in the browser toolbar. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Addressed pkasting@'s comments from patch set 1. Created 5 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/ui/views/toolbar/toolbar_button.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/views/toolbar/toolbar_button.cc
diff --git a/chrome/browser/ui/views/toolbar/toolbar_button.cc b/chrome/browser/ui/views/toolbar/toolbar_button.cc
index cf2e626384f1695631238f10ba4d0867ef99b4f4..0309e000294cef6e538c23ccc050686e85de06d7 100644
--- a/chrome/browser/ui/views/toolbar/toolbar_button.cc
+++ b/chrome/browser/ui/views/toolbar/toolbar_button.cc
@@ -18,6 +18,7 @@
#include "ui/gfx/display.h"
#include "ui/gfx/screen.h"
#include "ui/strings/grit/ui_strings.h"
+#include "ui/views/animation/ink_drop_animation_controller.h"
#include "ui/views/controls/button/label_button_border.h"
#include "ui/views/controls/menu/menu_item_view.h"
#include "ui/views/controls/menu/menu_model_adapter.h"
@@ -31,6 +32,16 @@ ToolbarButton::ToolbarButton(views::ButtonListener* listener,
menu_showing_(false),
y_position_on_lbuttondown_(0),
show_menu_factory_(this) {
+#if defined(OS_CHROMEOS)
Peter Kasting 2015/07/20 19:15:59 Can you at least add a comment here about why we'r
bruthig 2015/07/21 13:41:03 Done.
+ if (ui::MaterialDesignController::IsModeMaterial()) {
+ ink_drop_animation_controller_.reset(
+ new views::InkDropAnimationController(this));
+ layer()->SetFillsBoundsOpaquely(false);
+ image()->SetPaintToLayer(true);
+ image()->SetFillsBoundsOpaquely(false);
+ }
+#endif // defined(OS_CHROMEOS)
+
set_context_menu_controller(this);
}
@@ -148,6 +159,21 @@ ToolbarButton::CreateDefaultBorder() const {
scoped_ptr<views::LabelButtonBorder> border =
LabelButton::CreateDefaultBorder();
+ if (ui::MaterialDesignController::IsModeMaterial()) {
+ // The material design spec does not include a visual effect for the
+ // STATE_HOVERED button state so we have to remove the default one added by
+ // LabelButton::CreateDefaultBorder().
+ border->SetPainter(true, Button::STATE_HOVERED, nullptr);
+ border->SetPainter(false, Button::STATE_HOVERED, nullptr);
+
+#if defined(OS_CHROMEOS)
+ // The default STATE_PRESSED painters need to be removed so that they do not
+ // conflict with the ink drop ripple effect.
+ border->SetPainter(true, Button::STATE_PRESSED, nullptr);
+ border->SetPainter(false, Button::STATE_PRESSED, nullptr);
+#endif // defined(OS_CHROMEOS)
+ }
+
ui::ThemeProvider* provider = GetThemeProvider();
if (provider && provider->UsingSystemTheme()) {
// Theme provided insets.
« no previous file with comments | « chrome/browser/ui/views/toolbar/toolbar_button.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698