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

Unified Diff: pdf/out_of_process_instance.cc

Issue 1403833002: Material PDF: Add metrics to count usage of PDF title and bookmarks (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Use a single histogram Created 5 years, 2 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 | « no previous file | tools/metrics/actions/extract_actions.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pdf/out_of_process_instance.cc
diff --git a/pdf/out_of_process_instance.cc b/pdf/out_of_process_instance.cc
index cfa11ba980be40c03c854e760bb54365d3a76219..12aad3ca8ab4865bfe9d05e038ef770274549780 100644
--- a/pdf/out_of_process_instance.cc
+++ b/pdf/out_of_process_instance.cc
@@ -156,6 +156,14 @@ namespace {
static const char kPPPPdfInterface[] = PPP_PDF_INTERFACE_1;
+// Used for UMA. Do not delete entries, and keep in sync with histograms.xml.
+enum PDFFeatures {
+ LOADED_DOCUMENT = 0,
+ HAS_TITLE = 1,
+ HAS_BOOKMARKS = 2,
+ FEATURES_COUNT
+};
+
PP_Var GetLinkAtPosition(PP_Instance instance, PP_Point point) {
pp::Var var;
void* object = pp::Instance::GetPerInstanceObject(instance, kPPPPdfInterface);
@@ -1101,6 +1109,8 @@ void OutOfProcessInstance::DocumentLoadComplete(int page_count) {
DCHECK(document_load_state_ == LOAD_STATE_LOADING);
document_load_state_ = LOAD_STATE_COMPLETE;
UserMetricsRecordAction("PDF.LoadSuccess");
tsergeant 2015/10/15 03:00:37 This action is now obsolete, but I'll follow up wi
+ uma_.HistogramEnumeration("PDF.DocumentFeature", LOADED_DOCUMENT,
+ FEATURES_COUNT);
// Note: If we are in print preview mode the scroll location is retained
// across document loads so we don't want to scroll again and override it.
@@ -1112,10 +1122,17 @@ void OutOfProcessInstance::DocumentLoadComplete(int page_count) {
pp::VarDictionary metadata_message;
metadata_message.Set(pp::Var(kType), pp::Var(kJSMetadataType));
std::string title = engine_->GetMetadata("Title");
- if (!base::TrimWhitespace(base::UTF8ToUTF16(title), base::TRIM_ALL).empty())
+ if (!base::TrimWhitespace(base::UTF8ToUTF16(title), base::TRIM_ALL).empty()) {
metadata_message.Set(pp::Var(kJSTitle), pp::Var(title));
+ uma_.HistogramEnumeration("PDF.DocumentFeature", HAS_TITLE, FEATURES_COUNT);
+ }
- metadata_message.Set(pp::Var(kJSBookmarks), engine_->GetBookmarks());
+ pp::VarArray bookmarks = engine_->GetBookmarks();
+ metadata_message.Set(pp::Var(kJSBookmarks), bookmarks);
+ if (bookmarks.GetLength() > 0) {
+ uma_.HistogramEnumeration("PDF.DocumentFeature", HAS_BOOKMARKS,
+ FEATURES_COUNT);
+ }
PostMessage(metadata_message);
pp::VarDictionary progress_message;
« no previous file with comments | « no previous file | tools/metrics/actions/extract_actions.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698