| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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.banners; | 5 package org.chromium.chrome.browser.banners; |
| 6 | 6 |
| 7 import android.text.TextUtils; | 7 import android.text.TextUtils; |
| 8 | 8 |
| 9 import org.chromium.base.ApplicationStatus; | 9 import org.chromium.base.ApplicationStatus; |
| 10 import org.chromium.base.CalledByNative; | 10 import org.chromium.base.CalledByNative; |
| (...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 139 static void setIsEnabledForTesting() { | 139 static void setIsEnabledForTesting() { |
| 140 sIsEnabled = true; | 140 sIsEnabled = true; |
| 141 } | 141 } |
| 142 | 142 |
| 143 /** Sets a constant (in days) that gets added to the time when the current t
ime is requested. */ | 143 /** Sets a constant (in days) that gets added to the time when the current t
ime is requested. */ |
| 144 @VisibleForTesting | 144 @VisibleForTesting |
| 145 static void setTimeDeltaForTesting(int days) { | 145 static void setTimeDeltaForTesting(int days) { |
| 146 nativeSetTimeDeltaForTesting(days); | 146 nativeSetTimeDeltaForTesting(days); |
| 147 } | 147 } |
| 148 | 148 |
| 149 /** Records how many native BitmapFetchers are actively retrieving app icons
. */ | 149 /** Returns whether a BitmapFetcher is actively retrieving an app icon. */ |
| 150 @VisibleForTesting | 150 @VisibleForTesting |
| 151 public int getNumActiveFetchersForTesting() { | 151 public boolean isFetcherActiveForTesting() { |
| 152 return nativeGetNumActiveFetchers(mNativePointer); | 152 return nativeIsFetcherActive(mNativePointer); |
| 153 } | 153 } |
| 154 | 154 |
| 155 private static native boolean nativeIsEnabled(); | 155 private static native boolean nativeIsEnabled(); |
| 156 private native long nativeInit(); | 156 private native long nativeInit(); |
| 157 private native void nativeDestroy(long nativeAppBannerManager); | 157 private native void nativeDestroy(long nativeAppBannerManager); |
| 158 private native void nativeReplaceWebContents(long nativeAppBannerManager, | 158 private native void nativeReplaceWebContents(long nativeAppBannerManager, |
| 159 WebContents webContents); | 159 WebContents webContents); |
| 160 private native boolean nativeOnAppDetailsRetrieved(long nativeAppBannerManag
er, AppData data, | 160 private native boolean nativeOnAppDetailsRetrieved(long nativeAppBannerManag
er, AppData data, |
| 161 String title, String packageName, String imageUrl); | 161 String title, String packageName, String imageUrl); |
| 162 | 162 |
| 163 // Testing methods. | 163 // Testing methods. |
| 164 private static native void nativeSetTimeDeltaForTesting(int days); | 164 private static native void nativeSetTimeDeltaForTesting(int days); |
| 165 private native int nativeGetNumActiveFetchers(long nativeAppBannerManager); | 165 private native boolean nativeIsFetcherActive(long nativeAppBannerManager); |
| 166 | 166 |
| 167 // UMA tracking. | 167 // UMA tracking. |
| 168 private static native void nativeRecordDismissEvent(int metric); | 168 private static native void nativeRecordDismissEvent(int metric); |
| 169 private static native void nativeRecordInstallEvent(int metric); | 169 private static native void nativeRecordInstallEvent(int metric); |
| 170 } | 170 } |
| OLD | NEW |