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

Unified Diff: third_party/WebKit/Source/platform/scroll/Scrollbar.cpp

Issue 2631113003: Add metric to know how user use scrollbar (Closed)
Patch Set: Created 3 years, 11 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: 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;
}

Powered by Google App Engine
This is Rietveld 408576698