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

Unified Diff: third_party/WebKit/Source/core/input/KeyboardEventManager.cpp

Issue 2729923002: UMA metrics for counting different ways of scrolling by keyboard. (Closed)
Patch Set: histogram merge conflicts resolved. Created 3 years, 10 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
« no previous file with comments | « third_party/WebKit/Source/core/frame/UseCounter.h ('k') | tools/metrics/histograms/histograms.xml » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/core/input/KeyboardEventManager.cpp
diff --git a/third_party/WebKit/Source/core/input/KeyboardEventManager.cpp b/third_party/WebKit/Source/core/input/KeyboardEventManager.cpp
index 185419fdf6bb3d5750e49870fec4943838019bb5..72f23efaa2e348455e95389a3c6d244515b9c8fb 100644
--- a/third_party/WebKit/Source/core/input/KeyboardEventManager.cpp
+++ b/third_party/WebKit/Source/core/input/KeyboardEventManager.cpp
@@ -60,7 +60,8 @@ WebFocusType focusDirectionForKey(KeyboardEvent* event) {
bool mapKeyCodeForScroll(int keyCode,
WebInputEvent::Modifiers modifiers,
ScrollDirection* scrollDirection,
- ScrollGranularity* scrollGranularity) {
+ ScrollGranularity* scrollGranularity,
+ UseCounter::Feature* scrollUseUMA) {
if (modifiers & WebInputEvent::ShiftKey || modifiers & WebInputEvent::MetaKey)
return false;
@@ -86,34 +87,42 @@ bool mapKeyCodeForScroll(int keyCode,
case VKEY_LEFT:
*scrollDirection = ScrollLeftIgnoringWritingMode;
*scrollGranularity = ScrollByLine;
+ *scrollUseUMA = UseCounter::ScrollByKeyboardArrowKeys;
break;
case VKEY_RIGHT:
*scrollDirection = ScrollRightIgnoringWritingMode;
*scrollGranularity = ScrollByLine;
+ *scrollUseUMA = UseCounter::ScrollByKeyboardArrowKeys;
break;
case VKEY_UP:
*scrollDirection = ScrollUpIgnoringWritingMode;
*scrollGranularity = ScrollByLine;
+ *scrollUseUMA = UseCounter::ScrollByKeyboardArrowKeys;
break;
case VKEY_DOWN:
*scrollDirection = ScrollDownIgnoringWritingMode;
*scrollGranularity = ScrollByLine;
+ *scrollUseUMA = UseCounter::ScrollByKeyboardArrowKeys;
break;
case VKEY_HOME:
*scrollDirection = ScrollUpIgnoringWritingMode;
*scrollGranularity = ScrollByDocument;
+ *scrollUseUMA = UseCounter::ScrollByKeyboardHomeEndKeys;
break;
case VKEY_END:
*scrollDirection = ScrollDownIgnoringWritingMode;
*scrollGranularity = ScrollByDocument;
+ *scrollUseUMA = UseCounter::ScrollByKeyboardHomeEndKeys;
break;
case VKEY_PRIOR: // page up
*scrollDirection = ScrollUpIgnoringWritingMode;
*scrollGranularity = ScrollByPage;
+ *scrollUseUMA = UseCounter::ScrollByKeyboardPageUpDownKeys;
break;
case VKEY_NEXT: // page down
*scrollDirection = ScrollDownIgnoringWritingMode;
*scrollGranularity = ScrollByPage;
+ *scrollUseUMA = UseCounter::ScrollByKeyboardPageUpDownKeys;
break;
default:
return false;
@@ -308,6 +317,8 @@ void KeyboardEventManager::defaultSpaceEventHandler(KeyboardEvent* event,
// FIXME: enable scroll customization in this case. See crbug.com/410974.
if (m_scrollManager->logicalScroll(direction, ScrollByPage, nullptr,
possibleFocusedNode)) {
+ UseCounter::count(m_frame->document(),
+ UseCounter::ScrollByKeyboardSpacebarKey);
event->setDefaultHandled();
return;
}
@@ -356,12 +367,14 @@ void KeyboardEventManager::defaultArrowEventHandler(KeyboardEvent* event,
ScrollDirection scrollDirection;
ScrollGranularity scrollGranularity;
+ UseCounter::Feature scrollUseUMA;
if (!mapKeyCodeForScroll(event->keyCode(), event->modifiers(),
- &scrollDirection, &scrollGranularity))
+ &scrollDirection, &scrollGranularity, &scrollUseUMA))
return;
if (m_scrollManager->bubblingScroll(scrollDirection, scrollGranularity,
nullptr, possibleFocusedNode)) {
+ UseCounter::count(m_frame->document(), scrollUseUMA);
event->setDefaultHandled();
return;
}
« no previous file with comments | « third_party/WebKit/Source/core/frame/UseCounter.h ('k') | tools/metrics/histograms/histograms.xml » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698