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

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

Issue 1817253003: [MD] Use same focus ring on BarControlButton as MdTextButton. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: update docs Created 4 years, 9 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
« no previous file with comments | « no previous file | chrome/browser/ui/views/download/download_shelf_view.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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" 10 #include "ui/views/animation/button_ink_drop_delegate.h"
11 #include "ui/views/border.h" 11 #include "ui/views/border.h"
12 #include "ui/views/painter.h"
12 13
13 namespace { 14 namespace {
14 15
15 // Extra space around the buttons to increase their event target size. 16 // Extra space around the buttons to increase their event target size.
16 const int kButtonExtraTouchSize = 4; 17 const int kButtonExtraTouchSize = 4;
17 18
18 } // namespace 19 } // namespace
19 20
20 BarControlButton::BarControlButton(views::ButtonListener* listener) 21 BarControlButton::BarControlButton(views::ButtonListener* listener)
21 : views::ImageButton(listener), 22 : views::ImageButton(listener),
22 id_(gfx::VectorIconId::VECTOR_ICON_NONE), 23 id_(gfx::VectorIconId::VECTOR_ICON_NONE),
23 ink_drop_delegate_(new views::ButtonInkDropDelegate(this, this)) { 24 ink_drop_delegate_(new views::ButtonInkDropDelegate(this, this)) {
24 set_ink_drop_delegate(ink_drop_delegate_.get()); 25 set_ink_drop_delegate(ink_drop_delegate_.get());
25 set_has_ink_drop_action_on_click(true); 26 set_has_ink_drop_action_on_click(true);
26 SetImageAlignment(views::ImageButton::ALIGN_CENTER, 27 SetImageAlignment(views::ImageButton::ALIGN_CENTER,
27 views::ImageButton::ALIGN_MIDDLE); 28 views::ImageButton::ALIGN_MIDDLE);
29 SetFocusPainter(nullptr);
30 UseMdFocusRing();
28 } 31 }
29 32
30 BarControlButton::~BarControlButton() {} 33 BarControlButton::~BarControlButton() {}
31 34
32 void BarControlButton::SetIcon( 35 void BarControlButton::SetIcon(
33 gfx::VectorIconId id, 36 gfx::VectorIconId id,
34 const base::Callback<SkColor(void)>& get_text_color_callback) { 37 const base::Callback<SkColor(void)>& get_text_color_callback) {
35 id_ = id; 38 id_ = id;
36 get_text_color_callback_ = get_text_color_callback; 39 get_text_color_callback_ = get_text_color_callback;
37 40
(...skipping 10 matching lines...) Expand all
48 gfx::ImageSkia image = gfx::CreateVectorIcon(id_, 16, icon_color); 51 gfx::ImageSkia image = gfx::CreateVectorIcon(id_, 16, icon_color);
49 SetImage(views::CustomButton::STATE_NORMAL, &image); 52 SetImage(views::CustomButton::STATE_NORMAL, &image);
50 image = gfx::CreateVectorIcon(id_, 16, SkColorSetA(icon_color, 0xff / 2)); 53 image = gfx::CreateVectorIcon(id_, 16, SkColorSetA(icon_color, 0xff / 2));
51 SetImage(views::CustomButton::STATE_DISABLED, &image); 54 SetImage(views::CustomButton::STATE_DISABLED, &image);
52 set_ink_drop_base_color(icon_color); 55 set_ink_drop_base_color(icon_color);
53 } 56 }
54 57
55 void BarControlButton::OnNativeThemeChanged(const ui::NativeTheme* theme) { 58 void BarControlButton::OnNativeThemeChanged(const ui::NativeTheme* theme) {
56 OnThemeChanged(); 59 OnThemeChanged();
57 } 60 }
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/ui/views/download/download_shelf_view.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698