Chromium Code Reviews| Index: third_party/WebKit/Source/platform/scroll/Scrollbar.cpp |
| diff --git a/third_party/WebKit/Source/platform/scroll/Scrollbar.cpp b/third_party/WebKit/Source/platform/scroll/Scrollbar.cpp |
| index ed1ffd697d43b82a43c5256fbfd81f78cd8d9364..8a41a30b5f4d7db42b8c009bb0b906b5a727405a 100644 |
| --- a/third_party/WebKit/Source/platform/scroll/Scrollbar.cpp |
| +++ b/third_party/WebKit/Source/platform/scroll/Scrollbar.cpp |
| @@ -25,7 +25,7 @@ |
| #include "platform/scroll/Scrollbar.h" |
| -#include <algorithm> |
| +#include "platform/Histogram.h" |
| #include "platform/HostWindow.h" |
| #include "platform/PlatformMouseEvent.h" |
| #include "platform/geometry/FloatRect.h" |
| @@ -317,6 +317,40 @@ void Scrollbar::setPressedPart(ScrollbarPart part) { |
| || m_hoveredPart != NoPart) |
| setNeedsPaintInvalidation( |
| static_cast<ScrollbarPart>(m_pressedPart | m_hoveredPart | part)); |
| + |
| + // Send ScrollbarPressedPart histogram. |
| + ScrollbarPressedPart scrollbarPressedPart = IgnorePart; |
|
bokan
2017/01/16 21:25:33
Put all of this into a helper method that you call
|
| + switch (part) { |
| + case BackButtonStartPart: |
| + case ForwardButtonStartPart: |
| + case BackButtonEndPart: |
| + case ForwardButtonEndPart: |
| + scrollbarPressedPart = |
| + (orientation() == VerticalScrollbar ? VerticalScrollbarButton |
| + : HorizontalScrollbarButton); |
| + break; |
| + case ThumbPart: |
| + scrollbarPressedPart = |
| + (orientation() == VerticalScrollbar ? VerticalScrollbarThumb |
| + : HorizontalScrollbarThumb); |
| + break; |
| + case BackTrackPart: |
| + case ForwardTrackPart: |
| + scrollbarPressedPart = |
| + (orientation() == VerticalScrollbar ? VerticalScrollbarTrack |
| + : HorizontalScrollbarTrack); |
| + break; |
| + default: |
| + scrollbarPressedPart = IgnorePart; |
| + } |
| + |
| + if (scrollbarPressedPart != IgnorePart) { |
| + DEFINE_STATIC_LOCAL(EnumerationHistogram, scrollbarPressedPartHistogram, |
| + ("ScrollbarPressedPart", ScrollbarPressedPartMax)); |
| + scrollbarPressedPartHistogram.count( |
|
bokan
2017/01/16 21:25:33
This will still count multiple uses on a page load
|
| + static_cast<ScrollbarPressedPart>(scrollbarPressedPart)); |
| + } |
| + |
| m_pressedPart = part; |
| } |