Commit 80b01933 authored by rbpotter's avatar rbpotter Committed by Commit Bot

PDF Viewer: Add custom zoom metric

Bug: 1105701
Change-Id: I1f45d55f6eb744bc63885016e5e8a9b2b4571d48
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2311521Reviewed-by: default avatarJohn Lee <johntlee@chromium.org>
Commit-Queue: Rebekah Potter <rbpotter@chromium.org>
Cr-Commit-Position: refs/heads/master@{#791506}
parent a915d244
...@@ -178,7 +178,11 @@ PDFMetrics.UserAction = { ...@@ -178,7 +178,11 @@ PDFMetrics.UserAction = {
ZOOM_OUT_FIRST: 41, ZOOM_OUT_FIRST: 41,
ZOOM_OUT: 42, ZOOM_OUT: 42,
NUMBER_OF_ACTIONS: 43, // Recorded when the custom zoom input field is modified.
ZOOM_CUSTOM_FIRST: 43,
ZOOM_CUSTOM: 44,
NUMBER_OF_ACTIONS: 45,
}; };
// Map from UserAction to the 'FIRST' action. These metrics are recorded // Map from UserAction to the 'FIRST' action. These metrics are recorded
...@@ -269,4 +273,8 @@ PDFMetrics.firstMap_ = new Map([ ...@@ -269,4 +273,8 @@ PDFMetrics.firstMap_ = new Map([
PDFMetrics.UserAction.ZOOM_OUT, PDFMetrics.UserAction.ZOOM_OUT,
PDFMetrics.UserAction.ZOOM_OUT_FIRST, PDFMetrics.UserAction.ZOOM_OUT_FIRST,
], ],
[
PDFMetrics.UserAction.ZOOM_CUSTOM,
PDFMetrics.UserAction.ZOOM_CUSTOM_FIRST,
],
]); ]);
...@@ -610,6 +610,7 @@ export class PDFViewerBaseElement extends PolymerElement { ...@@ -610,6 +610,7 @@ export class PDFViewerBaseElement extends PolymerElement {
*/ */
onZoomChanged(e) { onZoomChanged(e) {
this.viewport_.setZoom(e.detail / 100); this.viewport_.setZoom(e.detail / 100);
PDFMetrics.record(PDFMetrics.UserAction.ZOOM_CUSTOM);
} }
/** @protected */ /** @protected */
......
...@@ -115,6 +115,8 @@ chrome.test.runTests(function() { ...@@ -115,6 +115,8 @@ chrome.test.runTests(function() {
PDFMetrics.recordZoomAction(/*isZoomIn=*/ true); PDFMetrics.recordZoomAction(/*isZoomIn=*/ true);
PDFMetrics.recordZoomAction(/*isZoomIn=*/ false); PDFMetrics.recordZoomAction(/*isZoomIn=*/ false);
PDFMetrics.recordZoomAction(/*isZoomIn=*/ true); PDFMetrics.recordZoomAction(/*isZoomIn=*/ true);
PDFMetrics.record(PDFMetrics.UserAction.ZOOM_CUSTOM);
PDFMetrics.record(PDFMetrics.UserAction.ZOOM_CUSTOM);
chrome.test.assertEq( chrome.test.assertEq(
{ {
...@@ -122,7 +124,9 @@ chrome.test.runTests(function() { ...@@ -122,7 +124,9 @@ chrome.test.runTests(function() {
[PDFMetrics.UserAction.ZOOM_IN_FIRST]: 1, [PDFMetrics.UserAction.ZOOM_IN_FIRST]: 1,
[PDFMetrics.UserAction.ZOOM_IN]: 3, [PDFMetrics.UserAction.ZOOM_IN]: 3,
[PDFMetrics.UserAction.ZOOM_OUT_FIRST]: 1, [PDFMetrics.UserAction.ZOOM_OUT_FIRST]: 1,
[PDFMetrics.UserAction.ZOOM_OUT]: 2 [PDFMetrics.UserAction.ZOOM_OUT]: 2,
[PDFMetrics.UserAction.ZOOM_CUSTOM_FIRST]: 1,
[PDFMetrics.UserAction.ZOOM_CUSTOM]: 2
}, },
chrome.metricsPrivate.actionCounter); chrome.metricsPrivate.actionCounter);
chrome.test.succeed(); chrome.test.succeed();
......
...@@ -9539,6 +9539,8 @@ histogram as enum --> ...@@ -9539,6 +9539,8 @@ histogram as enum -->
<int value="40" label="ZoomIn"/> <int value="40" label="ZoomIn"/>
<int value="41" label="ZoomOutFirst"/> <int value="41" label="ZoomOutFirst"/>
<int value="42" label="ZoomOut"/> <int value="42" label="ZoomOut"/>
<int value="43" label="ZoomCustomFirst"/>
<int value="44" label="ZoomCustom"/>
</enum> </enum>
<enum name="ChromePDFViewerAnnotationType"> <enum name="ChromePDFViewerAnnotationType">
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment