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

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

Issue 2006023002: Log some information about the state of the homepage on Android. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Nits Created 4 years, 6 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 172 matching lines...) Expand 10 before | Expand all | Expand 10 after
183 */ 183 */
184 public static void recordWebappHistogramTimes(long time) { 184 public static void recordWebappHistogramTimes(long time) {
185 sWebappHistogramTimes.add(time); 185 sWebappHistogramTimes.add(time);
186 } 186 }
187 187
188 /** 188 /**
189 * Calls out to native code to record URLs that have been launched via the H ome screen. 189 * Calls out to native code to record URLs that have been launched via the H ome screen.
190 * This intermediate step is necessary because Activity.onCreate() may be ca lled when 190 * This intermediate step is necessary because Activity.onCreate() may be ca lled when
191 * the native library has not yet been loaded. 191 * the native library has not yet been loaded.
192 * @param webContents WebContents for the current Tab. 192 * @param webContents WebContents for the current Tab.
193 * @param application The ChromeApplication object.
194 */ 193 */
195 public static void commitLaunchMetrics(WebContents webContents) { 194 public static void commitLaunchMetrics(WebContents webContents) {
196 for (Pair<String, Integer> item : sActivityUrls) { 195 for (Pair<String, Integer> item : sActivityUrls) {
197 nativeRecordLaunch(true, item.first, item.second, webContents); 196 nativeRecordLaunch(true, item.first, item.second, webContents);
198 } 197 }
199 sActivityUrls.clear(); 198 sActivityUrls.clear();
200 199
201 for (Pair<String, Integer> item : sTabUrls) { 200 for (Pair<String, Integer> item : sTabUrls) {
202 nativeRecordLaunch(false, item.first, item.second, webContents); 201 nativeRecordLaunch(false, item.first, item.second, webContents);
203 } 202 }
204 sTabUrls.clear(); 203 sTabUrls.clear();
205 204
206 // Record generic cached events. 205 // Record generic cached events.
207 for (CachedHistogram event : CachedHistogram.sEvents) event.commitAndCle ar(); 206 for (CachedHistogram event : CachedHistogram.sEvents) event.commitAndCle ar();
208 } 207 }
209 208
209 /**
210 * Records metrics about the state of the homepage on launch.
211 * @param showHomeButton Whether the home button is shown.
212 * @param homepageIsNtp Whether the homepage is set to the NTP.
213 * @param homepageUrl The value of the homepage URL.
214 */
215 public static void recordHomePageLaunchMetrics(
216 boolean showHomeButton, boolean homepageIsNtp, String homepageUrl) {
217 nativeRecordHomePageLaunchMetrics(showHomeButton, homepageIsNtp, homepag eUrl);
218 }
219
210 private static native void nativeRecordLaunch( 220 private static native void nativeRecordLaunch(
211 boolean standalone, String url, int source, WebContents webContents) ; 221 boolean standalone, String url, int source, WebContents webContents) ;
222 private static native void nativeRecordHomePageLaunchMetrics(
223 boolean showHomeButton, boolean homepageIsNtp, String homepageUrl);
212 } 224 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698