Chromium Code Reviews| Index: ash/shelf/shelf_view.cc |
| diff --git a/ash/shelf/shelf_view.cc b/ash/shelf/shelf_view.cc |
| index 1257032b2101fafc5640d5d7d2199ca44a153ba9..173f6a3ca037a5dd382fbedd90350d305f5b8d29 100644 |
| --- a/ash/shelf/shelf_view.cc |
| +++ b/ash/shelf/shelf_view.cc |
| @@ -27,6 +27,7 @@ |
| #include "ash/shell_delegate.h" |
| #include "base/auto_reset.h" |
| #include "base/memory/scoped_ptr.h" |
| +#include "base/metrics/histogram.h" |
| #include "grit/ash_resources.h" |
| #include "grit/ash_strings.h" |
| #include "ui/aura/client/screen_position_client.h" |
| @@ -58,6 +59,11 @@ using views::View; |
| namespace ash { |
| namespace internal { |
| +const int SHELF_ALIGNMENT_UMA_ENUM_VALUE_BOTTOM = 0; |
| +const int SHELF_ALIGNMENT_UMA_ENUM_VALUE_LEFT = 1; |
| +const int SHELF_ALIGNMENT_UMA_ENUM_VALUE_RIGHT = 2; |
| +const int SHELF_ALIGNMENT_UMA_ENUM_VALUE_COUNT = 3; |
| + |
| // Default amount content is inset on the left edge. |
| const int kDefaultLeadingInset = 8; |
| @@ -1526,9 +1532,9 @@ void ShelfView::PointerPressedOnButton(views::View* view, |
| model_->items()[index].id); |
| if (view_model_->view_size() <= 1 || !item_delegate->IsDraggable()) |
| return; // View is being deleted or not draggable, ignore request. |
| - |
| drag_view_ = view; |
| drag_offset_ = layout_manager_->PrimaryAxisValue(event.x(), event.y()); |
| + RecordCurrentAlignmentForUMAHistogram("Ash.ShelfAlignmentUsage"); |
| } |
| void ShelfView::PointerDraggedOnButton(views::View* view, |
| @@ -1884,5 +1890,16 @@ int ShelfView::CalculateShelfDistance(const gfx::Point& coordinate) const { |
| return distance > 0 ? distance : 0; |
| } |
| +void ShelfView::RecordCurrentAlignmentForUMAHistogram( |
| + const char* histogram_name) { |
| + UMA_HISTOGRAM_ENUMERATION(histogram_name, |
|
James Cook
2013/10/30 16:49:12
This won't work. UMA_HISTOGRAM_ENUMERATION does so
|
| + layout_manager_->SelectValueForShelfAlignment( |
| + SHELF_ALIGNMENT_UMA_ENUM_VALUE_BOTTOM, |
| + SHELF_ALIGNMENT_UMA_ENUM_VALUE_LEFT, |
| + SHELF_ALIGNMENT_UMA_ENUM_VALUE_RIGHT, |
| + -1), |
| + SHELF_ALIGNMENT_UMA_ENUM_VALUE_COUNT); |
| +} |
| + |
| } // namespace internal |
| } // namespace ash |