| 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.content.Context; | 7 import android.content.Context; |
| 8 import android.text.TextUtils; | 8 import android.text.TextUtils; |
| 9 | 9 |
| 10 import org.chromium.base.ApplicationStatus; | 10 import org.chromium.base.ApplicationStatus; |
| (...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 150 } | 150 } |
| 151 | 151 |
| 152 /** Disables the HTTPS scheme requirement for testing. */ | 152 /** Disables the HTTPS scheme requirement for testing. */ |
| 153 @VisibleForTesting | 153 @VisibleForTesting |
| 154 static void disableSecureSchemeCheckForTesting() { | 154 static void disableSecureSchemeCheckForTesting() { |
| 155 nativeDisableSecureSchemeCheckForTesting(); | 155 nativeDisableSecureSchemeCheckForTesting(); |
| 156 } | 156 } |
| 157 | 157 |
| 158 /** Sets the weights of direct and indirect page navigations for testing. */ | 158 /** Sets the weights of direct and indirect page navigations for testing. */ |
| 159 @VisibleForTesting | 159 @VisibleForTesting |
| 160 static void forceEngagementWeightsForTesting(double directEngagement, | 160 static void setEngagementWeights(double directEngagement, double indirectEng
agement) { |
| 161 double indirectEngagement) { | 161 nativeSetEngagementWeights(directEngagement, indirectEngagement); |
| 162 nativeForceEngagementWeightsForTesting(directEngagement, indirectEngagem
ent); | |
| 163 } | 162 } |
| 164 | 163 |
| 165 /** Returns whether a AppBannerDataFetcher is actively retrieving data. */ | 164 /** Returns whether a AppBannerDataFetcher is actively retrieving data. */ |
| 166 @VisibleForTesting | 165 @VisibleForTesting |
| 167 public boolean isFetcherActiveForTesting() { | 166 public boolean isFetcherActiveForTesting() { |
| 168 return nativeIsFetcherActive(mNativePointer); | 167 return nativeIsFetcherActive(mNativePointer); |
| 169 } | 168 } |
| 170 | 169 |
| 171 private static native boolean nativeIsEnabled(); | 170 private static native boolean nativeIsEnabled(); |
| 172 private native long nativeInit(int iconSize); | 171 private native long nativeInit(int iconSize); |
| 173 private native void nativeDestroy(long nativeAppBannerManagerAndroid); | 172 private native void nativeDestroy(long nativeAppBannerManagerAndroid); |
| 174 private native void nativeReplaceWebContents(long nativeAppBannerManagerAndr
oid, | 173 private native void nativeReplaceWebContents(long nativeAppBannerManagerAndr
oid, |
| 175 WebContents webContents); | 174 WebContents webContents); |
| 176 private native boolean nativeOnAppDetailsRetrieved(long nativeAppBannerManag
erAndroid, | 175 private native boolean nativeOnAppDetailsRetrieved(long nativeAppBannerManag
erAndroid, |
| 177 AppData data, String title, String packageName, String imageUrl); | 176 AppData data, String title, String packageName, String imageUrl); |
| 178 | 177 |
| 179 // Testing methods. | 178 // Testing methods. |
| 180 private static native void nativeSetTimeDeltaForTesting(int days); | 179 private static native void nativeSetTimeDeltaForTesting(int days); |
| 181 private static native void nativeDisableSecureSchemeCheckForTesting(); | 180 private static native void nativeDisableSecureSchemeCheckForTesting(); |
| 182 private static native void nativeForceEngagementWeightsForTesting( | 181 private static native void nativeSetEngagementWeights(double directEngagemen
t, |
| 183 double directEngagement, double indirectEngagement); | 182 double indirectEngagement); |
| 184 private native boolean nativeIsFetcherActive(long nativeAppBannerManagerAndr
oid); | 183 private native boolean nativeIsFetcherActive(long nativeAppBannerManagerAndr
oid); |
| 185 } | 184 } |
| OLD | NEW |