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

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: 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..42652f6e077353e6940827f58b40452f32603abc 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"
@@ -30,7 +31,16 @@ ToolbarButton::ToolbarButton(views::ButtonListener* listener,
model_(model),
menu_showing_(false),
y_position_on_lbuttondown_(0),
+ ink_drop_animation_controller_(nullptr),
Peter Kasting 2015/07/17 18:01:58 Omit this.
bruthig 2015/07/20 14:53:07 Done.
show_menu_factory_(this) {
+#if defined(OS_CHROMEOS)
Peter Kasting 2015/07/17 18:01:58 Why is this OS_CHROMEOS? Can't we do this for all
bruthig 2015/07/20 14:53:07 The designers want the ripple effect on Chrome OS
+ if (ui::MaterialDesignController::IsModeMaterial()) {
+ ink_drop_animation_controller_.reset(
+ new views::InkDropAnimationController(this));
+ layer()->SetFillsBoundsOpaquely(false);
Peter Kasting 2015/07/17 18:01:58 Why do we need this if it's unconditionally done o
bruthig 2015/07/20 14:53:07 Line 55 is operating on image() whereas this is op
+ }
+#endif // defined(OS_CHROMEOS)
+
set_context_menu_controller(this);
}
@@ -41,6 +51,8 @@ void ToolbarButton::Init() {
SetFocusable(false);
SetAccessibilityFocusable(true);
image()->EnableCanvasFlippingForRTLUI(true);
+ image()->SetPaintToLayer(true);
+ image()->SetFillsBoundsOpaquely(false);
}
void ToolbarButton::ClearPendingMenu() {
@@ -148,6 +160,15 @@ ToolbarButton::CreateDefaultBorder() const {
scoped_ptr<views::LabelButtonBorder> border =
LabelButton::CreateDefaultBorder();
+ if (ui::MaterialDesignController::IsModeMaterial()) {
Peter Kasting 2015/07/17 18:01:58 I suggest adding a comment on this block as to why
bruthig 2015/07/20 14:53:07 Done.
+ border->SetPainter(true, Button::STATE_HOVERED, nullptr);
+ border->SetPainter(false, Button::STATE_HOVERED, nullptr);
+#if defined(OS_CHROMEOS)
+ 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