Index: ash/common/system/chromeos/palette/palette_tool_manager.cc |
diff --git a/ash/common/system/chromeos/palette/palette_tool_manager.cc b/ash/common/system/chromeos/palette/palette_tool_manager.cc |
index f06900a16b276b98dab8da7be05dee965da99858..0161f31982026b1fb288fdabae5c7f92ddf23081 100644 |
--- a/ash/common/system/chromeos/palette/palette_tool_manager.cc |
+++ b/ash/common/system/chromeos/palette/palette_tool_manager.cc |
@@ -8,6 +8,7 @@ |
#include "ash/common/system/chromeos/palette/palette_tool.h" |
#include "base/bind.h" |
+#include "base/metrics/histogram_macros.h" |
#include "ui/gfx/vector_icons_public.h" |
namespace ash { |
@@ -38,8 +39,20 @@ void PaletteToolManager::ActivateTool(PaletteToolId tool_id) { |
if (new_tool == previous_tool) |
return; |
- if (previous_tool) |
+ if (previous_tool) { |
previous_tool->OnDisable(); |
+ if (previous_tool->GetToolId() == ash::PaletteToolId::LASER_POINTER) { |
jdufault
2016/09/02 21:54:30
nit: drop ash:: (already in the ash namespace)
jdufault
2016/09/02 21:54:30
The only time we can cancel if is if we click the
xiaoyinh(OOO Sep 11-29)
2016/09/06 17:40:05
Done.
xiaoyinh(OOO Sep 11-29)
2016/09/06 17:40:05
Done.
|
+ UMA_HISTOGRAM_ENUMERATION( |
+ "Ash.Shelf.Palette.ModeCancellation", |
+ ash::PaletteModeCancelType::PALETTE_MODE_LASER_POINTER_SWITCHED, |
+ ash::PaletteModeCancelType::PALETTE_MODE_CANCEL_TYPE_COUNT); |
+ } else if (previous_tool->GetToolId() == ash::PaletteToolId::MAGNIFY) { |
+ UMA_HISTOGRAM_ENUMERATION( |
+ "Ash.Shelf.Palette.ModeCancellation", |
+ ash::PaletteModeCancelType::PALETTE_MODE_MAGNIFY_SWITCHED, |
+ ash::PaletteModeCancelType::PALETTE_MODE_CANCEL_TYPE_COUNT); |
Ilya Sherman
2016/09/02 21:39:30
Please create a wrapper function for emitting to t
xiaoyinh(OOO Sep 11-29)
2016/09/06 17:40:05
Done.
|
+ } |
+ } |
active_tools_[new_tool->GetGroup()] = new_tool; |
new_tool->OnEnable(); |
@@ -53,6 +66,17 @@ void PaletteToolManager::DeactivateTool(PaletteToolId tool_id) { |
active_tools_[tool->GetGroup()] = nullptr; |
tool->OnDisable(); |
+ if (tool->GetToolId() == ash::PaletteToolId::LASER_POINTER) { |
+ UMA_HISTOGRAM_ENUMERATION( |
jdufault
2016/09/02 21:54:30
Should these UMA stats also have the AutoOpen chec
xiaoyinh(OOO Sep 11-29)
2016/09/06 17:40:05
AutoOpen factor are not specified for mode cancell
|
+ "Ash.Shelf.Palette.ModeCancellation", |
+ ash::PaletteModeCancelType::PALETTE_MODE_LASER_POINTER_CANCELLED, |
+ ash::PaletteModeCancelType::PALETTE_MODE_CANCEL_TYPE_COUNT); |
+ } else if (tool->GetToolId() == ash::PaletteToolId::MAGNIFY) { |
+ UMA_HISTOGRAM_ENUMERATION( |
+ "Ash.Shelf.Palette.ModeCancellation", |
+ ash::PaletteModeCancelType::PALETTE_MODE_MAGNIFY_CANCELLED, |
+ ash::PaletteModeCancelType::PALETTE_MODE_CANCEL_TYPE_COUNT); |
+ } |
delegate_->OnActiveToolChanged(); |
} |
@@ -117,6 +141,10 @@ WmWindow* PaletteToolManager::GetWindow() { |
return delegate_->GetWindow(); |
} |
+void PaletteToolManager::RecordPaletteMetrics(ash::PaletteTrayOptions option) { |
+ return delegate_->RecordPaletteMetrics(option); |
+} |
+ |
PaletteTool* PaletteToolManager::FindToolById(PaletteToolId tool_id) { |
for (std::unique_ptr<PaletteTool>& tool : tools_) { |
if (tool->GetToolId() == tool_id) |