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.offlinepages; | 5 package org.chromium.chrome.browser.offlinepages; |
6 | 6 |
7 import android.os.AsyncTask; | 7 import android.os.AsyncTask; |
8 | 8 |
9 import org.chromium.base.ObserverList; | 9 import org.chromium.base.ObserverList; |
10 import org.chromium.base.ThreadUtils; | 10 import org.chromium.base.ThreadUtils; |
(...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
178 | 178 |
179 /** | 179 /** |
180 * Called by the native OfflinePageBridge so that it can cache the new Java
OfflinePageBridge. | 180 * Called by the native OfflinePageBridge so that it can cache the new Java
OfflinePageBridge. |
181 */ | 181 */ |
182 @CalledByNative | 182 @CalledByNative |
183 private static OfflinePageBridge create(long nativeOfflinePageBridge) { | 183 private static OfflinePageBridge create(long nativeOfflinePageBridge) { |
184 return new OfflinePageBridge(nativeOfflinePageBridge); | 184 return new OfflinePageBridge(nativeOfflinePageBridge); |
185 } | 185 } |
186 | 186 |
187 /** | 187 /** |
188 * @return The mode of the offline pages feature. Uses | |
189 * {@see org.chromium.components.offlinepages.FeatureMode} enum. | |
190 */ | |
191 public static int getFeatureMode() { | |
192 ThreadUtils.assertOnUiThread(); | |
193 if (sFeatureMode == null) sFeatureMode = nativeGetFeatureMode(); | |
194 return sFeatureMode; | |
195 } | |
196 | |
197 /** | |
198 * @return True if the offline pages feature is enabled, regardless whether
bookmark or saved | 188 * @return True if the offline pages feature is enabled, regardless whether
bookmark or saved |
199 * page shown in UI strings. | 189 * page shown in UI strings. |
200 */ | 190 */ |
201 public static boolean isEnabled() { | 191 public static boolean isEnabled() { |
202 ThreadUtils.assertOnUiThread(); | 192 ThreadUtils.assertOnUiThread(); |
203 return getFeatureMode() != FeatureMode.DISABLED; | 193 return nativeGetFeatureMode() != FeatureMode.DISABLED; |
204 } | 194 } |
205 | 195 |
206 /** | 196 /** |
207 * @return True if the offline pages feature is enabled, regardless whether
bookmark or saved | 197 * @return True if the offline pages feature is enabled, regardless whether
bookmark or saved |
208 * page shown in UI strings. | 198 * page shown in UI strings. |
209 */ | 199 */ |
210 @VisibleForTesting | 200 @VisibleForTesting |
211 public static boolean isBackgroundLoadingEnabled() { | 201 public static boolean isBackgroundLoadingEnabled() { |
212 return ChromeFeatureList.isEnabled(OFFLINE_PAGES_BACKGROUND_LOADING_FEAT
URE_NAME); | 202 return ChromeFeatureList.isEnabled(OFFLINE_PAGES_BACKGROUND_LOADING_FEAT
URE_NAME); |
213 } | 203 } |
(...skipping 457 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
671 private native void nativeDeletePages( | 661 private native void nativeDeletePages( |
672 long nativeOfflinePageBridge, DeletePageCallback callback, long[] of
flineIds); | 662 long nativeOfflinePageBridge, DeletePageCallback callback, long[] of
flineIds); |
673 private native void nativeGetPagesToCleanUp( | 663 private native void nativeGetPagesToCleanUp( |
674 long nativeOfflinePageBridge, List<OfflinePageItem> offlinePages); | 664 long nativeOfflinePageBridge, List<OfflinePageItem> offlinePages); |
675 private native void nativeCheckMetadataConsistency(long nativeOfflinePageBri
dge); | 665 private native void nativeCheckMetadataConsistency(long nativeOfflinePageBri
dge); |
676 private native String nativeGetOfflineUrlForOnlineUrl( | 666 private native String nativeGetOfflineUrlForOnlineUrl( |
677 long nativeOfflinePageBridge, String onlineUrl); | 667 long nativeOfflinePageBridge, String onlineUrl); |
678 private native void nativeRecordStorageHistograms(long nativeOfflinePageBrid
ge, | 668 private native void nativeRecordStorageHistograms(long nativeOfflinePageBrid
ge, |
679 long totalSpaceInBytes, long freeSpaceInBytes, boolean reportingAfte
rDelete); | 669 long totalSpaceInBytes, long freeSpaceInBytes, boolean reportingAfte
rDelete); |
680 } | 670 } |
OLD | NEW |