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

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

Issue 2308823002: Add UMA stats for pen palette (Closed)
Patch Set: incorporate comments and rebase 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 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.
}

Powered by Google App Engine
This is Rietveld 408576698