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

Unified Diff: ash/common/system/chromeos/palette/common_palette_tool.cc

Issue 2343603003: [Chrome OS MD] Implement accessibility detailed view for the MD Ash system menu (Closed)
Patch Set: address comments Created 4 years, 3 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 side-by-side diff with in-line comments
Download patch
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);

Powered by Google App Engine
This is Rietveld 408576698