Chromium Code Reviews| Index: ash/common/system/chromeos/palette/common_palette_tool.cc |
| diff --git a/ash/common/system/chromeos/palette/common_palette_tool.cc b/ash/common/system/chromeos/palette/common_palette_tool.cc |
| index fbad6311ffbdac17640b81e6be3a1d4dd702f717..e0e78dee43ec64462b665aa0cbe7650cabeb71cd 100644 |
| --- a/ash/common/system/chromeos/palette/common_palette_tool.cc |
| +++ b/ash/common/system/chromeos/palette/common_palette_tool.cc |
| @@ -8,6 +8,7 @@ |
| #include "ash/common/system/chromeos/palette/palette_ids.h" |
| #include "ash/common/system/chromeos/palette/palette_tool_manager.h" |
| #include "ash/common/system/tray/hover_highlight_view.h" |
| +#include "ash/common/system/tray/tray_constants.h" |
| #include "ash/common/system/tray/view_click_listener.h" |
| #include "base/logging.h" |
| #include "base/metrics/histogram_macros.h" |
| @@ -22,18 +23,6 @@ |
| namespace ash { |
| namespace { |
| -// Size of the icons in DP. |
| -const int kIconSize = 20; |
| - |
| -// Distance between the icon and the check from the egdes in DP. |
| -const int kMarginFromEdges = 14; |
| - |
| -// Extra distance between the icon and the left edge in DP. |
| -const int kExtraMarginFromLeftEdge = 4; |
| - |
| -// Distance between the icon and the name of the tool in DP. |
| -const int kMarginBetweenIconAndText = 18; |
|
tdanderson
2016/09/19 23:32:27
Awesome!!!
yiyix
2016/09/21 17:10:47
Thanks~!
|
| - |
| void AddHistogramTimes(PaletteToolId id, base::TimeDelta duration) { |
| if (id == PaletteToolId::LASER_POINTER) { |
| UMA_HISTOGRAM_CUSTOM_TIMES("Ash.Shelf.Palette.InLaserPointerMode", duration, |
| @@ -98,17 +87,18 @@ void CommonPaletteTool::OnViewClicked(views::View* sender) { |
| views::View* CommonPaletteTool::CreateDefaultView(const base::string16& name) { |
| gfx::ImageSkia icon = |
| - CreateVectorIcon(GetPaletteIcon(), kIconSize, gfx::kChromeIconGrey); |
| + CreateVectorIcon(GetPaletteIcon(), kMenuIconSize, gfx::kChromeIconGrey); |
| gfx::ImageSkia check = CreateVectorIcon(gfx::VectorIconId::CHECK_CIRCLE, |
| - kIconSize, gfx::kGoogleGreen700); |
| + kMenuIconSize, gfx::kGoogleGreen700); |
| highlight_view_ = new HoverHighlightView(this); |
| highlight_view_->SetBorder( |
| - views::Border::CreateEmptyBorder(0, kExtraMarginFromLeftEdge, 0, 0)); |
| - highlight_view_->AddIconAndLabelCustomSize(icon, name, false, kIconSize, |
| - kMarginFromEdges, |
| - kMarginBetweenIconAndText); |
| - highlight_view_->AddRightIcon(check, kIconSize); |
| + views::Border::CreateEmptyBorder(0, kMenuIconMargin, 0, 0)); |
| + const int margin_from_edge = (kMenuButtonSize - kMenuIconSize) / 2; |
|
tdanderson
2016/09/19 23:32:27
nit: Consider renaming to |interior_button_padding
yiyix
2016/09/21 17:10:47
Done.
|
| + highlight_view_->AddIconAndLabelCustomSize( |
| + icon, name, false, kMenuIconSize, margin_from_edge, |
| + margin_from_edge + kMenuIconMargin); |
| + highlight_view_->AddRightIcon(check, kMenuIconSize); |
| if (enabled()) |
| highlight_view_->SetHighlight(true); |