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.ContextUtils; | 10 import org.chromium.base.ContextUtils; |
(...skipping 26 matching lines...) Expand all Loading... |
37 | 37 |
38 /** Pointer to the native side AppBannerManager. */ | 38 /** Pointer to the native side AppBannerManager. */ |
39 private long mNativePointer; | 39 private long mNativePointer; |
40 | 40 |
41 /** | 41 /** |
42 * Checks if the add to home screen intent is supported. | 42 * Checks if the add to home screen intent is supported. |
43 * @return true if add to home screen is supported, false otherwise. | 43 * @return true if add to home screen is supported, false otherwise. |
44 */ | 44 */ |
45 public static boolean isSupported() { | 45 public static boolean isSupported() { |
46 if (sIsSupported == null) { | 46 if (sIsSupported == null) { |
47 Context context = ContextUtils.getApplicationContext(); | 47 sIsSupported = ShortcutHelper.isAddToHomeIntentSupported(); |
48 sIsSupported = ShortcutHelper.isAddToHomeIntentSupported(context); | |
49 } | 48 } |
50 return sIsSupported; | 49 return sIsSupported; |
51 } | 50 } |
52 | 51 |
53 /** | 52 /** |
54 * Checks if app banners are enabled for the tab which this manager is attac
hed to. | 53 * Checks if app banners are enabled for the tab which this manager is attac
hed to. |
55 * @return true if app banners can be shown for this tab, false otherwise. | 54 * @return true if app banners can be shown for this tab, false otherwise. |
56 */ | 55 */ |
57 @CalledByNative | 56 @CalledByNative |
58 private boolean isEnabledForTab() { | 57 private boolean isEnabledForTab() { |
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
192 private native boolean nativeOnAppDetailsRetrieved(long nativeAppBannerManag
erAndroid, | 191 private native boolean nativeOnAppDetailsRetrieved(long nativeAppBannerManag
erAndroid, |
193 AppData data, String title, String packageName, String imageUrl); | 192 AppData data, String title, String packageName, String imageUrl); |
194 | 193 |
195 // Testing methods. | 194 // Testing methods. |
196 private native boolean nativeIsActiveForTesting(long nativeAppBannerManagerA
ndroid); | 195 private native boolean nativeIsActiveForTesting(long nativeAppBannerManagerA
ndroid); |
197 private static native void nativeSetDaysAfterDismissAndIgnoreToTrigger( | 196 private static native void nativeSetDaysAfterDismissAndIgnoreToTrigger( |
198 int dismissDays, int ignoreDays); | 197 int dismissDays, int ignoreDays); |
199 private static native void nativeSetTimeDeltaForTesting(int days); | 198 private static native void nativeSetTimeDeltaForTesting(int days); |
200 private static native void nativeSetTotalEngagementToTrigger(double engageme
nt); | 199 private static native void nativeSetTotalEngagementToTrigger(double engageme
nt); |
201 } | 200 } |
OLD | NEW |