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

Side by Side Diff: chrome/android/java/src/org/chromium/chrome/browser/metrics/LaunchMetrics.java

Issue 1909483003: [MediaNotification] Add UMA to record user clicking media notifications (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: renaming Created 4 years, 8 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 unified diff | Download patch
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 package org.chromium.chrome.browser.metrics; 5 package org.chromium.chrome.browser.metrics;
6 6
7 import android.util.Pair; 7 import android.util.Pair;
8 8
9 import org.chromium.base.annotations.JNINamespace; 9 import org.chromium.base.annotations.JNINamespace;
10 import org.chromium.base.metrics.RecordHistogram; 10 import org.chromium.base.metrics.RecordHistogram;
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
77 77
78 @Override 78 @Override
79 protected void commitAndClear() { 79 protected void commitAndClear() {
80 for (Integer sample : mSamples) { 80 for (Integer sample : mSamples) {
81 RecordHistogram.recordSparseSlowlyHistogram(mHistogramName, samp le); 81 RecordHistogram.recordSparseSlowlyHistogram(mHistogramName, samp le);
82 } 82 }
83 mSamples.clear(); 83 mSamples.clear();
84 } 84 }
85 } 85 }
86 86
87 /** Caches a set of enumerated histogram samples. */
88 public static class EnumeratedHistogramSample extends CachedHistogram {
89 private final List<Integer> mSamples = new ArrayList<Integer>();
90 private final int mMaxValue;
91
92 public EnumeratedHistogramSample(String histogramName, int maxValue) {
93 super(histogramName);
94 mMaxValue = maxValue;
95 }
96
97 public void record(int sample) {
98 mSamples.add(sample);
99 }
100
101 @Override
102 protected void commitAndClear() {
103 for (Integer sample : mSamples) {
104 RecordHistogram.recordEnumeratedHistogram(mHistogramName, sample , mMaxValue);
105 }
106 mSamples.clear();
107 }
108 }
109
87 // Each list item is a pair of the url and where it was added from e.g. from the add to 110 // Each list item is a pair of the url and where it was added from e.g. from the add to
88 // homescreen menu item, an app banner, or unknown. The mapping of int sourc e values to 111 // homescreen menu item, an app banner, or unknown. The mapping of int sourc e values to
89 // their string names is found in the C++ ShortcutInfo struct. 112 // their string names is found in the C++ ShortcutInfo struct.
90 private static final List<Pair<String, Integer>> sActivityUrls = 113 private static final List<Pair<String, Integer>> sActivityUrls =
91 new ArrayList<Pair<String, Integer>>(); 114 new ArrayList<Pair<String, Integer>>();
92 private static final List<Pair<String, Integer>> sTabUrls = 115 private static final List<Pair<String, Integer>> sTabUrls =
93 new ArrayList<Pair<String, Integer>>(); 116 new ArrayList<Pair<String, Integer>>();
94 117
95 private static final List<Long> sWebappHistogramTimes = new ArrayList<Long>( ); 118 private static final List<Long> sWebappHistogramTimes = new ArrayList<Long>( );
96 119
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
144 } 167 }
145 sWebappHistogramTimes.clear(); 168 sWebappHistogramTimes.clear();
146 169
147 // Record generic cached events. 170 // Record generic cached events.
148 for (CachedHistogram event : CachedHistogram.sEvents) event.commitAndCle ar(); 171 for (CachedHistogram event : CachedHistogram.sEvents) event.commitAndCle ar();
149 } 172 }
150 173
151 private static native void nativeRecordLaunch( 174 private static native void nativeRecordLaunch(
152 boolean standalone, String url, int source, WebContents webContents) ; 175 boolean standalone, String url, int source, WebContents webContents) ;
153 } 176 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698