OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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.instantapps; | 5 package org.chromium.chrome.browser.instantapps; |
6 | 6 |
7 import android.content.Context; | 7 import android.content.Context; |
8 import android.content.Intent; | 8 import android.content.Intent; |
9 import android.net.Uri; | 9 import android.net.Uri; |
10 import android.os.StrictMode; | 10 import android.os.StrictMode; |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
45 | 45 |
46 protected static final String IS_REFERRER_TRUSTED_EXTRA = | 46 protected static final String IS_REFERRER_TRUSTED_EXTRA = |
47 "com.google.android.gms.instantapps.IS_REFERRER_TRUSTED"; | 47 "com.google.android.gms.instantapps.IS_REFERRER_TRUSTED"; |
48 | 48 |
49 protected static final String IS_USER_CONFIRMED_LAUNCH_EXTRA = | 49 protected static final String IS_USER_CONFIRMED_LAUNCH_EXTRA = |
50 "com.google.android.gms.instantapps.IS_USER_CONFIRMED_LAUNCH"; | 50 "com.google.android.gms.instantapps.IS_USER_CONFIRMED_LAUNCH"; |
51 | 51 |
52 protected static final String TRUSTED_REFERRER_PKG_EXTRA = | 52 protected static final String TRUSTED_REFERRER_PKG_EXTRA = |
53 "com.google.android.gms.instantapps.TRUSTED_REFERRER_PKG"; | 53 "com.google.android.gms.instantapps.TRUSTED_REFERRER_PKG"; |
54 | 54 |
| 55 public static final String IS_GOOGLE_SEARCH_REFERRER = |
| 56 "com.google.android.gms.instantapps.IS_GOOGLE_SEARCH_REFERRER"; |
| 57 |
55 /** Finch experiment name. */ | 58 /** Finch experiment name. */ |
56 private static final String INSTANT_APPS_EXPERIMENT_NAME = "InstantApps"; | 59 private static final String INSTANT_APPS_EXPERIMENT_NAME = "InstantApps"; |
57 | 60 |
58 /** Finch experiment group which is enabled for instant apps. */ | 61 /** Finch experiment group which is enabled for instant apps. */ |
59 private static final String INSTANT_APPS_ENABLED_ARM = "InstantAppsEnabled"; | 62 private static final String INSTANT_APPS_ENABLED_ARM = "InstantAppsEnabled"; |
60 | 63 |
61 /** Finch experiment group which is disabled for instant apps. */ | 64 /** Finch experiment group which is disabled for instant apps. */ |
62 private static final String INSTANT_APPS_DISABLED_ARM = "InstantAppsDisabled
"; | 65 private static final String INSTANT_APPS_DISABLED_ARM = "InstantAppsDisabled
"; |
63 | 66 |
64 /** A histogram to record how long each handleIntent() call took. */ | 67 /** A histogram to record how long each handleIntent() call took. */ |
(...skipping 18 matching lines...) Expand all Loading... |
83 } | 86 } |
84 return sInstance; | 87 return sInstance; |
85 } | 88 } |
86 | 89 |
87 /** | 90 /** |
88 * Check the cached value to figure out if the feature is enabled. We have t
o use the cached | 91 * Check the cached value to figure out if the feature is enabled. We have t
o use the cached |
89 * value because native library hasn't yet been loaded. | 92 * value because native library hasn't yet been loaded. |
90 * @param context The application context. | 93 * @param context The application context. |
91 * @return Whether the feature is enabled. | 94 * @return Whether the feature is enabled. |
92 */ | 95 */ |
93 private boolean isEnabled(Context context) { | 96 protected boolean isEnabled(Context context) { |
94 // Will go away once the feature is enabled for everyone by default. | 97 // Will go away once the feature is enabled for everyone by default. |
95 StrictMode.ThreadPolicy oldPolicy = StrictMode.allowThreadDiskReads(); | 98 StrictMode.ThreadPolicy oldPolicy = StrictMode.allowThreadDiskReads(); |
96 try { | 99 try { |
97 return ChromePreferenceManager.getInstance(context).getCachedInstant
AppsEnabled(); | 100 return ChromePreferenceManager.getInstance(context).getCachedInstant
AppsEnabled(); |
98 } finally { | 101 } finally { |
99 StrictMode.setThreadPolicy(oldPolicy); | 102 StrictMode.setThreadPolicy(oldPolicy); |
100 } | 103 } |
101 } | 104 } |
102 | 105 |
103 /** | 106 /** |
(...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
297 /** | 300 /** |
298 * Gets the instant app intent for the given URL if one exists. | 301 * Gets the instant app intent for the given URL if one exists. |
299 * | 302 * |
300 * @param url The URL whose instant app this is associated with. | 303 * @param url The URL whose instant app this is associated with. |
301 * @return An instant app intent for the URL if one exists. | 304 * @return An instant app intent for the URL if one exists. |
302 */ | 305 */ |
303 public Intent getInstantAppIntentForUrl(String url) { | 306 public Intent getInstantAppIntentForUrl(String url) { |
304 return null; | 307 return null; |
305 } | 308 } |
306 } | 309 } |
OLD | NEW |