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

Side by Side Diff: ui/views/controls/button/vector_icon_button.cc

Issue 2625273002: Migrate more vector icons to chrome/. (Closed)
Patch Set: fix mac Created 3 years, 11 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 | « ui/gfx/vector_icons/find_prev.1x.icon ('k') | no next file » | 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 "ui/views/controls/button/vector_icon_button.h" 5 #include "ui/views/controls/button/vector_icon_button.h"
6 6
7 #include "ui/gfx/color_palette.h" 7 #include "ui/gfx/color_palette.h"
8 #include "ui/gfx/color_utils.h" 8 #include "ui/gfx/color_utils.h"
9 #include "ui/gfx/paint_vector_icon.h" 9 #include "ui/gfx/paint_vector_icon.h"
10 #include "ui/gfx/vector_icons_public.h" 10 #include "ui/gfx/vector_icons_public.h"
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
45 } 45 }
46 46
47 void VectorIconButton::SetIcon(const gfx::VectorIcon& icon) { 47 void VectorIconButton::SetIcon(const gfx::VectorIcon& icon) {
48 icon_ = &icon; 48 icon_ = &icon;
49 SetIcon(gfx::VectorIconId::VECTOR_ICON_NONE); 49 SetIcon(gfx::VectorIconId::VECTOR_ICON_NONE);
50 } 50 }
51 51
52 void VectorIconButton::OnThemeChanged() { 52 void VectorIconButton::OnThemeChanged() {
53 SkColor icon_color = 53 SkColor icon_color =
54 color_utils::DeriveDefaultIconColor(delegate_->GetVectorIconBaseColor()); 54 color_utils::DeriveDefaultIconColor(delegate_->GetVectorIconBaseColor());
55 gfx::ImageSkia image; 55 SkColor disabled_color = SkColorSetA(icon_color, 0xff / 2);
56 if (icon_) 56 if (icon_) {
57 image = gfx::CreateVectorIcon(*icon_, icon_color); 57 SetImage(views::CustomButton::STATE_NORMAL,
58 else 58 gfx::CreateVectorIcon(*icon_, icon_color));
59 image = gfx::CreateVectorIcon(id_, icon_color); 59 SetImage(views::CustomButton::STATE_DISABLED,
60 SetImage(views::CustomButton::STATE_NORMAL, &image); 60 gfx::CreateVectorIcon(*icon_, disabled_color));
61 image = gfx::CreateVectorIcon(id_, SkColorSetA(icon_color, 0xff / 2)); 61 } else {
62 SetImage(views::CustomButton::STATE_DISABLED, &image); 62 SetImage(views::CustomButton::STATE_NORMAL,
63 gfx::CreateVectorIcon(id_, icon_color));
64 SetImage(views::CustomButton::STATE_DISABLED,
65 gfx::CreateVectorIcon(id_, disabled_color));
66 }
63 set_ink_drop_base_color(icon_color); 67 set_ink_drop_base_color(icon_color);
64 } 68 }
65 69
66 void VectorIconButton::OnNativeThemeChanged(const ui::NativeTheme* theme) { 70 void VectorIconButton::OnNativeThemeChanged(const ui::NativeTheme* theme) {
67 OnThemeChanged(); 71 OnThemeChanged();
68 } 72 }
69 73
70 } // namespace views 74 } // namespace views
OLDNEW
« no previous file with comments | « ui/gfx/vector_icons/find_prev.1x.icon ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698