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

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

Issue 2548013002: Remove redundant field initialization in Java code. (Closed)
Patch Set: rebase Created 4 years 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.content.ComponentCallbacks; 7 import android.content.ComponentCallbacks;
8 import android.content.Context; 8 import android.content.Context;
9 import android.content.res.Configuration; 9 import android.content.res.Configuration;
10 10
11 import org.chromium.base.ContextUtils; 11 import org.chromium.base.ContextUtils;
12 import org.chromium.chrome.browser.preferences.privacy.PrivacyPreferencesManager ; 12 import org.chromium.chrome.browser.preferences.privacy.PrivacyPreferencesManager ;
13 import org.chromium.chrome.browser.tab.Tab; 13 import org.chromium.chrome.browser.tab.Tab;
14 import org.chromium.chrome.browser.tabmodel.TabModel; 14 import org.chromium.chrome.browser.tabmodel.TabModel;
15 import org.chromium.chrome.browser.tabmodel.TabModelSelector; 15 import org.chromium.chrome.browser.tabmodel.TabModelSelector;
16 import org.chromium.chrome.browser.tabmodel.TabModelSelectorTabObserver; 16 import org.chromium.chrome.browser.tabmodel.TabModelSelectorTabObserver;
17 import org.chromium.content_public.browser.WebContents; 17 import org.chromium.content_public.browser.WebContents;
18 18
19 /** 19 /**
20 * Mainly sets up session stats for chrome. A session is defined as the duration when the 20 * Mainly sets up session stats for chrome. A session is defined as the duration when the
21 * application is in the foreground. Also used to communicate information betwe en Chrome 21 * application is in the foreground. Also used to communicate information betwe en Chrome
22 * and the framework's MetricService. 22 * and the framework's MetricService.
23 */ 23 */
24 public class UmaSessionStats { 24 public class UmaSessionStats {
25 public static final String LAST_USED_TIME_PREF = "umasessionstats.lastusedti me"; 25 public static final String LAST_USED_TIME_PREF = "umasessionstats.lastusedti me";
26 26
27 private static final String SAMSUNG_MULTWINDOW_PACKAGE = "com.sec.feature.mu ltiwindow"; 27 private static final String SAMSUNG_MULTWINDOW_PACKAGE = "com.sec.feature.mu ltiwindow";
28 28
29 private static long sNativeUmaSessionStats = 0; 29 private static long sNativeUmaSessionStats;
30 30
31 // TabModelSelector is needed to get the count of open tabs. We want to log the number of open 31 // TabModelSelector is needed to get the count of open tabs. We want to log the number of open
32 // tabs on every page load. 32 // tabs on every page load.
33 private TabModelSelector mTabModelSelector; 33 private TabModelSelector mTabModelSelector;
34 private TabModelSelectorTabObserver mTabModelSelectorTabObserver; 34 private TabModelSelectorTabObserver mTabModelSelectorTabObserver;
35 35
36 private final Context mContext; 36 private final Context mContext;
37 private final boolean mIsMultiWindowCapable; 37 private final boolean mIsMultiWindowCapable;
38 private ComponentCallbacks mComponentCallbacks; 38 private ComponentCallbacks mComponentCallbacks;
39 39
40 private boolean mKeyboardConnected = false; 40 private boolean mKeyboardConnected;
41 41
42 public UmaSessionStats(Context context) { 42 public UmaSessionStats(Context context) {
43 mContext = context; 43 mContext = context;
44 mIsMultiWindowCapable = context.getPackageManager().hasSystemFeature( 44 mIsMultiWindowCapable = context.getPackageManager().hasSystemFeature(
45 SAMSUNG_MULTWINDOW_PACKAGE); 45 SAMSUNG_MULTWINDOW_PACKAGE);
46 } 46 }
47 47
48 private void recordPageLoadStats(Tab tab) { 48 private void recordPageLoadStats(Tab tab) {
49 WebContents webContents = tab.getWebContents(); 49 WebContents webContents = tab.getWebContents();
50 boolean isDesktopUserAgent = webContents != null 50 boolean isDesktopUserAgent = webContents != null
(...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after
207 private static native void nativeRegisterExternalExperiment( 207 private static native void nativeRegisterExternalExperiment(
208 String studyName, int[] experimentIds); 208 String studyName, int[] experimentIds);
209 private static native void nativeRegisterSyntheticFieldTrial( 209 private static native void nativeRegisterSyntheticFieldTrial(
210 String trialName, String groupName); 210 String trialName, String groupName);
211 private static native void nativeRecordMultiWindowSession(int areaPercent, i nt instanceCount); 211 private static native void nativeRecordMultiWindowSession(int areaPercent, i nt instanceCount);
212 private static native void nativeRecordTabCountPerLoad(int numTabsOpen); 212 private static native void nativeRecordTabCountPerLoad(int numTabsOpen);
213 private static native void nativeRecordPageLoaded(boolean isDesktopUserAgent ); 213 private static native void nativeRecordPageLoaded(boolean isDesktopUserAgent );
214 private static native void nativeRecordPageLoadedWithKeyboard(); 214 private static native void nativeRecordPageLoadedWithKeyboard();
215 215
216 } 216 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698