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

Side by Side Diff: chrome/android/java/src/org/chromium/chrome/browser/banners/AppBannerManager.java

Issue 2553013004: Remove the app banner navigation heuristic. (Closed)
Patch Set: Add comments 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
« no previous file with comments | « no previous file | chrome/android/javatests/src/org/chromium/chrome/browser/banners/AppBannerManagerTest.java » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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.ContextUtils; 10 import org.chromium.base.ContextUtils;
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after
150 } 150 }
151 return R.string.menu_add_to_homescreen; 151 return R.string.menu_add_to_homescreen;
152 } 152 }
153 153
154 /** Overrides whether the system supports add to home screen. Used in testin g. */ 154 /** Overrides whether the system supports add to home screen. Used in testin g. */
155 @VisibleForTesting 155 @VisibleForTesting
156 public static void setIsSupported(boolean state) { 156 public static void setIsSupported(boolean state) {
157 sIsSupported = state; 157 sIsSupported = state;
158 } 158 }
159 159
160 /** Returns whether the native AppBannerManager is working. */
161 @VisibleForTesting
162 public boolean isActiveForTesting() {
163 return nativeIsActiveForTesting(mNativePointer);
164 }
165
166 /** Sets constants (in days) the banner should be blocked for after dismissi ng and ignoring. */
167 @VisibleForTesting
168 static void setDaysAfterDismissAndIgnoreForTesting(int dismissDays, int igno reDays) {
169 nativeSetDaysAfterDismissAndIgnoreToTrigger(dismissDays, ignoreDays);
170 }
171
160 /** Sets a constant (in days) that gets added to the time when the current t ime is requested. */ 172 /** Sets a constant (in days) that gets added to the time when the current t ime is requested. */
161 @VisibleForTesting 173 @VisibleForTesting
162 static void setTimeDeltaForTesting(int days) { 174 static void setTimeDeltaForTesting(int days) {
163 nativeSetTimeDeltaForTesting(days); 175 nativeSetTimeDeltaForTesting(days);
164 } 176 }
165 177
166 /** Sets the weights of direct and indirect page navigations for testing. */ 178 /** Sets the total required engagement to trigger the banner. */
167 @VisibleForTesting 179 @VisibleForTesting
168 static void setEngagementWeights(double directEngagement, double indirectEng agement) { 180 static void setTotalEngagementForTesting(double engagement) {
169 nativeSetEngagementWeights(directEngagement, indirectEngagement); 181 nativeSetTotalEngagementToTrigger(engagement);
170 }
171
172 /** Returns whether the native AppBannerManager is working. */
173 @VisibleForTesting
174 public boolean isActiveForTesting() {
175 return nativeIsActiveForTesting(mNativePointer);
176 } 182 }
177 183
178 /** Returns the AppBannerManager object. This is owned by the C++ banner man ager. */ 184 /** Returns the AppBannerManager object. This is owned by the C++ banner man ager. */
179 public static AppBannerManager getAppBannerManagerForWebContents(WebContents webContents) { 185 public static AppBannerManager getAppBannerManagerForWebContents(WebContents webContents) {
180 return nativeGetJavaBannerManagerForWebContents(webContents); 186 return nativeGetJavaBannerManagerForWebContents(webContents);
181 } 187 }
182 188
183 private static native int nativeGetHomescreenLanguageOption(); 189 private static native int nativeGetHomescreenLanguageOption();
184 private static native AppBannerManager nativeGetJavaBannerManagerForWebConte nts( 190 private static native AppBannerManager nativeGetJavaBannerManagerForWebConte nts(
185 WebContents webContents); 191 WebContents webContents);
186 private native boolean nativeOnAppDetailsRetrieved(long nativeAppBannerManag erAndroid, 192 private native boolean nativeOnAppDetailsRetrieved(long nativeAppBannerManag erAndroid,
187 AppData data, String title, String packageName, String imageUrl); 193 AppData data, String title, String packageName, String imageUrl);
188 194
189 // Testing methods. 195 // Testing methods.
196 private native boolean nativeIsActiveForTesting(long nativeAppBannerManagerA ndroid);
197 private static native void nativeSetDaysAfterDismissAndIgnoreToTrigger(
198 int dismissDays, int ignoreDays);
190 private static native void nativeSetTimeDeltaForTesting(int days); 199 private static native void nativeSetTimeDeltaForTesting(int days);
191 private static native void nativeSetEngagementWeights(double directEngagemen t, 200 private static native void nativeSetTotalEngagementToTrigger(double engageme nt);
192 double indirectEngagement);
193 private native boolean nativeIsActiveForTesting(long nativeAppBannerManagerA ndroid);
194 } 201 }
OLDNEW
« no previous file with comments | « no previous file | chrome/android/javatests/src/org/chromium/chrome/browser/banners/AppBannerManagerTest.java » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698