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 f71b87cd06e312493653ebc0cb8434476e4f0a53..0183a2e3dfb3726a005706769a1d7cdd86cfec0c 100644 |
--- a/ash/common/system/chromeos/palette/common_palette_tool.cc |
+++ b/ash/common/system/chromeos/palette/common_palette_tool.cc |
@@ -10,6 +10,7 @@ |
#include "ash/common/system/tray/hover_highlight_view.h" |
#include "ash/common/system/tray/view_click_listener.h" |
#include "base/logging.h" |
+#include "base/metrics/histogram_macros.h" |
#include "base/strings/utf_string_conversions.h" |
#include "grit/ash_resources.h" |
#include "ui/base/resource/resource_bundle.h" |
@@ -51,6 +52,7 @@ void CommonPaletteTool::OnViewDestroyed() { |
void CommonPaletteTool::OnEnable() { |
PaletteTool::OnEnable(); |
+ start_time_ = base::TimeTicks::Now(); |
if (highlight_view_) { |
highlight_view_->SetHighlight(true); |
@@ -61,6 +63,18 @@ void CommonPaletteTool::OnEnable() { |
void CommonPaletteTool::OnDisable() { |
PaletteTool::OnDisable(); |
+ if (GetToolId() == PaletteToolId::LASER_POINTER) { |
+ UMA_HISTOGRAM_CUSTOM_TIMES("Ash.Shelf.Palette.InLaserPointerMode", |
+ base::TimeTicks::Now() - start_time_, |
+ base::TimeDelta::FromMilliseconds(100), |
+ base::TimeDelta::FromHours(1), 50); |
+ } else if (GetToolId() == PaletteToolId::MAGNIFY) { |
+ UMA_HISTOGRAM_CUSTOM_TIMES("Ash.Shelf.Palette.InMagnifyMode", |
+ base::TimeTicks::Now() - start_time_, |
+ base::TimeDelta::FromMilliseconds(100), |
+ base::TimeDelta::FromHours(1), 50); |
+ } |
+ |
if (highlight_view_) { |
highlight_view_->SetHighlight(false); |
highlight_view_->SetRightIconVisible(false); |
@@ -68,9 +82,18 @@ void CommonPaletteTool::OnDisable() { |
} |
void CommonPaletteTool::OnViewClicked(views::View* sender) { |
- if (enabled()) |
+ delegate()->RecordPaletteOptionsUsage( |
+ PaletteToolIdToPaletteTrayOptions(GetToolId())); |
+ if (enabled()) { |
delegate()->DisableTool(GetToolId()); |
- else |
+ if (GetToolId() == PaletteToolId::LASER_POINTER) { |
+ delegate()->RecordPaletteModeCancellation( |
+ PaletteModeCancelType::PALETTE_MODE_LASER_POINTER_CANCELLED); |
+ } else if (GetToolId() == PaletteToolId::MAGNIFY) { |
+ delegate()->RecordPaletteModeCancellation( |
+ PaletteModeCancelType::PALETTE_MODE_MAGNIFY_CANCELLED); |
+ } |
+ } else |
delegate()->EnableTool(GetToolId()); |
Ilya Sherman
2016/09/06 20:45:32
nit: Please add curly braces to the else stmt, sin
xiaoyinh(OOO Sep 11-29)
2016/09/06 22:31:35
Done.
|
} |