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

Side by Side Diff: chrome/browser/ui/views/bar_control_button.cc

Issue 2041033002: Moved ButtonInkDropDelegate logic into InkDropHostView and deleted InkDropDelegates. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixed merge conflict in custom_button.cc Created 4 years, 6 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 unified diff | Download patch
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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/bar_control_button.h" 5 #include "chrome/browser/ui/views/bar_control_button.h"
6 6
7 #include "ui/gfx/color_utils.h" 7 #include "ui/gfx/color_utils.h"
8 #include "ui/gfx/paint_vector_icon.h" 8 #include "ui/gfx/paint_vector_icon.h"
9 #include "ui/gfx/vector_icons_public.h" 9 #include "ui/gfx/vector_icons_public.h"
10 #include "ui/views/animation/button_ink_drop_delegate.h"
11 #include "ui/views/border.h" 10 #include "ui/views/border.h"
12 #include "ui/views/painter.h" 11 #include "ui/views/painter.h"
13 12
14 namespace { 13 namespace {
15 14
16 // Extra space around the buttons to increase their event target size. 15 // Extra space around the buttons to increase their event target size.
17 const int kButtonExtraTouchSize = 4; 16 const int kButtonExtraTouchSize = 4;
18 17
19 } // namespace 18 } // namespace
20 19
21 BarControlButton::BarControlButton(views::ButtonListener* listener) 20 BarControlButton::BarControlButton(views::ButtonListener* listener)
22 : views::ImageButton(listener), id_(gfx::VectorIconId::VECTOR_ICON_NONE) { 21 : views::ImageButton(listener), id_(gfx::VectorIconId::VECTOR_ICON_NONE) {
23 set_ink_drop_delegate( 22 SetHasInkDrop(true);
24 base::WrapUnique(new views::ButtonInkDropDelegate(this, this)));
25 set_has_ink_drop_action_on_click(true); 23 set_has_ink_drop_action_on_click(true);
26 SetImageAlignment(views::ImageButton::ALIGN_CENTER, 24 SetImageAlignment(views::ImageButton::ALIGN_CENTER,
27 views::ImageButton::ALIGN_MIDDLE); 25 views::ImageButton::ALIGN_MIDDLE);
28 SetFocusPainter(nullptr); 26 SetFocusPainter(nullptr);
29 } 27 }
30 28
31 BarControlButton::~BarControlButton() {} 29 BarControlButton::~BarControlButton() {}
32 30
33 void BarControlButton::SetIcon( 31 void BarControlButton::SetIcon(
34 gfx::VectorIconId id, 32 gfx::VectorIconId id,
(...skipping 14 matching lines...) Expand all
49 gfx::ImageSkia image = gfx::CreateVectorIcon(id_, icon_color); 47 gfx::ImageSkia image = gfx::CreateVectorIcon(id_, icon_color);
50 SetImage(views::CustomButton::STATE_NORMAL, &image); 48 SetImage(views::CustomButton::STATE_NORMAL, &image);
51 image = gfx::CreateVectorIcon(id_, SkColorSetA(icon_color, 0xff / 2)); 49 image = gfx::CreateVectorIcon(id_, SkColorSetA(icon_color, 0xff / 2));
52 SetImage(views::CustomButton::STATE_DISABLED, &image); 50 SetImage(views::CustomButton::STATE_DISABLED, &image);
53 set_ink_drop_base_color(icon_color); 51 set_ink_drop_base_color(icon_color);
54 } 52 }
55 53
56 void BarControlButton::OnNativeThemeChanged(const ui::NativeTheme* theme) { 54 void BarControlButton::OnNativeThemeChanged(const ui::NativeTheme* theme) {
57 OnThemeChanged(); 55 OnThemeChanged();
58 } 56 }
OLDNEW
« no previous file with comments | « ash/system/toast/toast_overlay.cc ('k') | chrome/browser/ui/views/bookmarks/bookmark_bar_view.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698