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

Unified Diff: ui/android/java/src/org/chromium/ui/base/SelectFileDialog.java

Issue 2649033007: Record whether a file picker specialized for media content can be used (Closed)
Patch Set: Record whether a file picker specialized for media content can be used 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
« no previous file with comments | « tools/metrics/histograms/histograms.xml ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/android/java/src/org/chromium/ui/base/SelectFileDialog.java
diff --git a/ui/android/java/src/org/chromium/ui/base/SelectFileDialog.java b/ui/android/java/src/org/chromium/ui/base/SelectFileDialog.java
index 00ed8b5c9459574db037258b64ef83d4d19c3762..a1ab68df03869298d547ecba46e1348bc6fd0e77 100644
--- a/ui/android/java/src/org/chromium/ui/base/SelectFileDialog.java
+++ b/ui/android/java/src/org/chromium/ui/base/SelectFileDialog.java
@@ -27,6 +27,7 @@ import org.chromium.base.VisibleForTesting;
import org.chromium.base.annotations.CalledByNative;
import org.chromium.base.annotations.JNINamespace;
import org.chromium.base.annotations.MainDex;
+import org.chromium.base.metrics.RecordHistogram;
import org.chromium.ui.R;
import org.chromium.ui.UiUtils;
@@ -54,6 +55,17 @@ public class SelectFileDialog
private static final String ANY_TYPES = "*/*";
/**
+ * The SELECT_FILE_DIALOG_SCOPE_* enumerations are used to measure the sort of content that
+ * developers are requesting to be shown in the select file dialog. Values must be kept in sync
+ * with their definition in //tools/metrics/histograms/histograms.xml.
+ */
+ private static final int SELECT_FILE_DIALOG_SCOPE_GENERIC = 0;
+ private static final int SELECT_FILE_DIALOG_SCOPE_IMAGES = 1;
+ private static final int SELECT_FILE_DIALOG_SCOPE_IMAGES_AND_VIDEO = 2;
+ private static final int SELECT_FILE_DIALOG_SCOPE_MAX =
+ SELECT_FILE_DIALOG_SCOPE_IMAGES_AND_VIDEO;
+
+ /**
* If set, overrides the WindowAndroid passed in {@link selectFile()}.
*/
private static WindowAndroid sOverrideWindowAndroid;
@@ -174,6 +186,9 @@ public class SelectFileDialog
getContentIntent.putExtra(Intent.EXTRA_ALLOW_MULTIPLE, true);
}
+ RecordHistogram.recordEnumeratedHistogram("Android.SelectFileDialogScope",
+ determineSelectFileDialogScope(), SELECT_FILE_DIALOG_SCOPE_MAX);
+
ArrayList<Intent> extraIntents = new ArrayList<Intent>();
if (!noSpecificType()) {
// Create a chooser based on the accept type that was specified in the webpage. Note
@@ -355,6 +370,20 @@ public class SelectFileDialog
nativeOnFileNotSelected(mNativeSelectFileDialog);
}
+ // Determines the scope of the requested select file dialog for use in a UMA histogram. Right
+ // now we want to distinguish between generic, photo and visual media pickers.
+ private int determineSelectFileDialogScope() {
Miguel Garcia 2017/01/24 18:42:26 So this will log as generic when asking for just v
+ if (!noSpecificType() && !shouldShowAudioTypes() && shouldShowImageTypes()) {
+ if (shouldShowVideoTypes()) {
+ return SELECT_FILE_DIALOG_SCOPE_IMAGES_AND_VIDEO;
+ } else {
+ return SELECT_FILE_DIALOG_SCOPE_IMAGES;
+ }
+ }
+
+ return SELECT_FILE_DIALOG_SCOPE_GENERIC;
+ }
+
private boolean noSpecificType() {
// We use a single Intent to decide the type of the file chooser we display to the user,
// which means we can only give it a single type. If there are multiple accept types
« no previous file with comments | « tools/metrics/histograms/histograms.xml ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698