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

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

Issue 2614333002: Revert of Create vector icon resource directory specific to Chrome. (Closed)
Patch Set: 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/views/controls/button/vector_icon_button.h ('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 26 matching lines...) Expand all
37 void VectorIconButton::SetIcon(gfx::VectorIconId id) { 37 void VectorIconButton::SetIcon(gfx::VectorIconId id) {
38 id_ = id; 38 id_ = id;
39 39
40 if (!border()) { 40 if (!border()) {
41 SetBorder( 41 SetBorder(
42 views::CreateEmptyBorder(kButtonExtraTouchSize, kButtonExtraTouchSize, 42 views::CreateEmptyBorder(kButtonExtraTouchSize, kButtonExtraTouchSize,
43 kButtonExtraTouchSize, kButtonExtraTouchSize)); 43 kButtonExtraTouchSize, kButtonExtraTouchSize));
44 } 44 }
45 } 45 }
46 46
47 void VectorIconButton::SetIcon(const gfx::VectorIcon& icon) {
48 icon_ = &icon;
49 SetIcon(gfx::VectorIconId::VECTOR_ICON_NONE);
50 }
51
52 void VectorIconButton::OnThemeChanged() { 47 void VectorIconButton::OnThemeChanged() {
53 SkColor icon_color = 48 SkColor icon_color =
54 color_utils::DeriveDefaultIconColor(delegate_->GetVectorIconBaseColor()); 49 color_utils::DeriveDefaultIconColor(delegate_->GetVectorIconBaseColor());
55 gfx::ImageSkia image; 50 gfx::ImageSkia image = gfx::CreateVectorIcon(id_, icon_color);
56 if (icon_)
57 image = gfx::CreateVectorIcon(*icon_, icon_color);
58 else
59 image = gfx::CreateVectorIcon(id_, icon_color);
60 SetImage(views::CustomButton::STATE_NORMAL, &image); 51 SetImage(views::CustomButton::STATE_NORMAL, &image);
61 image = gfx::CreateVectorIcon(id_, SkColorSetA(icon_color, 0xff / 2)); 52 image = gfx::CreateVectorIcon(id_, SkColorSetA(icon_color, 0xff / 2));
62 SetImage(views::CustomButton::STATE_DISABLED, &image); 53 SetImage(views::CustomButton::STATE_DISABLED, &image);
63 set_ink_drop_base_color(icon_color); 54 set_ink_drop_base_color(icon_color);
64 } 55 }
65 56
66 void VectorIconButton::OnNativeThemeChanged(const ui::NativeTheme* theme) { 57 void VectorIconButton::OnNativeThemeChanged(const ui::NativeTheme* theme) {
67 OnThemeChanged(); 58 OnThemeChanged();
68 } 59 }
69 60
70 } // namespace views 61 } // namespace views
OLDNEW
« no previous file with comments | « ui/views/controls/button/vector_icon_button.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698