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

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: Added comment as to why ripple was on ChromeOS only. 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..6b6e35f099d8b703a2fcdc69d2a7b816ad6e777c 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,18 @@ ToolbarButton::ToolbarButton(views::ButtonListener* listener,
menu_showing_(false),
y_position_on_lbuttondown_(0),
show_menu_factory_(this) {
+#if defined(OS_CHROMEOS)
+ // The ink drop animation is only targeted at ChromeOS because there is
+ // concern it will conflict with OS level touch feedback in a bad way.
+ 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 +161,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);
Evan Stade 2015/07/22 16:29:46 for my edification, is it intentional that this al
+ 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