Commit f147ea98 authored by Daniel Hosseinian's avatar Daniel Hosseinian Committed by Commit Bot

PDF Viewer Update: Add metrics for thumbnail navigation

Bug: 652400
Change-Id: I7a08f0d58d5ca462fa5fe1a8dc4c06f0e8277151
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2402125
Commit-Queue: Daniel Hosseinian <dhoss@chromium.org>
Reviewed-by: default avatarRebekah Potter <rbpotter@chromium.org>
Cr-Commit-Position: refs/heads/master@{#806362}
parent 11784462
...@@ -181,7 +181,11 @@ PDFMetrics.UserAction = { ...@@ -181,7 +181,11 @@ PDFMetrics.UserAction = {
ZOOM_CUSTOM_FIRST: 43, ZOOM_CUSTOM_FIRST: 43,
ZOOM_CUSTOM: 44, ZOOM_CUSTOM: 44,
NUMBER_OF_ACTIONS: 45, // Recorded when a thumbnail is used for navigation.
THUMBNAIL_NAVIGATE_FIRST: 45,
THUMBNAIL_NAVIGATE: 46,
NUMBER_OF_ACTIONS: 47,
}; };
// Map from UserAction to the 'FIRST' action. These metrics are recorded // Map from UserAction to the 'FIRST' action. These metrics are recorded
...@@ -276,4 +280,8 @@ PDFMetrics.firstMap_ = new Map([ ...@@ -276,4 +280,8 @@ PDFMetrics.firstMap_ = new Map([
PDFMetrics.UserAction.ZOOM_CUSTOM, PDFMetrics.UserAction.ZOOM_CUSTOM,
PDFMetrics.UserAction.ZOOM_CUSTOM_FIRST, PDFMetrics.UserAction.ZOOM_CUSTOM_FIRST,
], ],
[
PDFMetrics.UserAction.THUMBNAIL_NAVIGATE,
PDFMetrics.UserAction.THUMBNAIL_NAVIGATE_FIRST,
],
]); ]);
...@@ -865,8 +865,9 @@ export class PDFViewerElement extends PDFViewerBaseElement { ...@@ -865,8 +865,9 @@ export class PDFViewerElement extends PDFViewerBaseElement {
PDFMetrics.record(PDFMetrics.UserAction.FOLLOW_BOOKMARK); PDFMetrics.record(PDFMetrics.UserAction.FOLLOW_BOOKMARK);
} else if (e.detail.origin === 'pageselector') { } else if (e.detail.origin === 'pageselector') {
PDFMetrics.record(PDFMetrics.UserAction.PAGE_SELECTOR_NAVIGATE); PDFMetrics.record(PDFMetrics.UserAction.PAGE_SELECTOR_NAVIGATE);
} else if (e.detail.origin === 'thumbnail') {
PDFMetrics.record(PDFMetrics.UserAction.THUMBNAIL_NAVIGATE);
} }
// TODO(dhoss): Add metrics for thumbnails.
} }
/** /**
......
...@@ -177,5 +177,24 @@ chrome.test.runTests(function() { ...@@ -177,5 +177,24 @@ chrome.test.runTests(function() {
chrome.metricsPrivate.actionCounter); chrome.metricsPrivate.actionCounter);
chrome.test.succeed(); chrome.test.succeed();
}, },
function testMetricsThumbnail() {
PDFMetrics.resetForTesting();
chrome.metricsPrivate = new MockMetricsPrivate();
PDFMetrics.record(PDFMetrics.UserAction.DOCUMENT_OPENED);
PDFMetrics.record(PDFMetrics.UserAction.THUMBNAIL_NAVIGATE);
PDFMetrics.record(PDFMetrics.UserAction.THUMBNAIL_NAVIGATE);
chrome.test.assertEq(
{
[PDFMetrics.UserAction.DOCUMENT_OPENED]: 1,
[PDFMetrics.UserAction.THUMBNAIL_NAVIGATE_FIRST]: 1,
[PDFMetrics.UserAction.THUMBNAIL_NAVIGATE]: 2
},
chrome.metricsPrivate.actionCounter);
chrome.test.succeed();
},
]; ];
}()); }());
...@@ -9766,6 +9766,8 @@ histogram as enum --> ...@@ -9766,6 +9766,8 @@ histogram as enum -->
<int value="42" label="ZoomOut"/> <int value="42" label="ZoomOut"/>
<int value="43" label="ZoomCustomFirst"/> <int value="43" label="ZoomCustomFirst"/>
<int value="44" label="ZoomCustom"/> <int value="44" label="ZoomCustom"/>
<int value="45" label="ThumbnailNavigateFirst"/>
<int value="46" label="ThumbnailNavigate"/>
</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