| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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.precache; | 5 package org.chromium.chrome.browser.precache; |
| 6 | 6 |
| 7 import android.content.Context; | 7 import android.content.Context; |
| 8 | 8 |
| 9 import org.chromium.base.Log; | 9 import org.chromium.base.Log; |
| 10 import org.chromium.base.ThreadUtils; | 10 import org.chromium.base.ThreadUtils; |
| (...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 110 * UI thread. | 110 * UI thread. |
| 111 * | 111 * |
| 112 * @param context any context within the application | 112 * @param context any context within the application |
| 113 */ | 113 */ |
| 114 private void updateEnabledSync(Context context) { | 114 private void updateEnabledSync(Context context) { |
| 115 // PrefServiceBridge.getInstance() and nativeShouldRun() can only be exe
cuted on the UI | 115 // PrefServiceBridge.getInstance() and nativeShouldRun() can only be exe
cuted on the UI |
| 116 // thread. | 116 // thread. |
| 117 ThreadUtils.assertOnUiThread(); | 117 ThreadUtils.assertOnUiThread(); |
| 118 | 118 |
| 119 boolean networkPredictionsAllowed = | 119 boolean networkPredictionsAllowed = |
| 120 PrefServiceBridge.getInstance().canPredictNetworkActions(); | 120 PrefServiceBridge.getInstance().canPrefetchAndPrerender(); |
| 121 boolean shouldRun = nativeShouldRun(); | 121 boolean shouldRun = nativeShouldRun(); |
| 122 | 122 |
| 123 mNetworkPredictionsAllowed = networkPredictionsAllowed; | 123 mNetworkPredictionsAllowed = networkPredictionsAllowed; |
| 124 mShouldRun = shouldRun; | 124 mShouldRun = shouldRun; |
| 125 | 125 |
| 126 PrecacheServiceLauncher.setIsPrecachingEnabled( | 126 PrecacheServiceLauncher.setIsPrecachingEnabled( |
| 127 context.getApplicationContext(), networkPredictionsAllowed && sh
ouldRun); | 127 context.getApplicationContext(), networkPredictionsAllowed && sh
ouldRun); |
| 128 Log.v(TAG, "updateEnabledSync complete"); | 128 Log.v(TAG, "updateEnabledSync complete"); |
| 129 } | 129 } |
| 130 | 130 |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 189 return reasons; | 189 return reasons; |
| 190 } | 190 } |
| 191 | 191 |
| 192 private native long nativeInit(); | 192 private native long nativeInit(); |
| 193 private native void nativeDestroy(long nativePrecacheLauncher); | 193 private native void nativeDestroy(long nativePrecacheLauncher); |
| 194 private native void nativeStart(long nativePrecacheLauncher); | 194 private native void nativeStart(long nativePrecacheLauncher); |
| 195 private native void nativeCancel(long nativePrecacheLauncher); | 195 private native void nativeCancel(long nativePrecacheLauncher); |
| 196 | 196 |
| 197 @VisibleForTesting native boolean nativeShouldRun(); | 197 @VisibleForTesting native boolean nativeShouldRun(); |
| 198 } | 198 } |
| OLD | NEW |