| 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 org.chromium.base.Callback; | 7 import org.chromium.base.Callback; |
| 8 import org.chromium.base.ObserverList; | 8 import org.chromium.base.ObserverList; |
| 9 import org.chromium.base.ThreadUtils; | 9 import org.chromium.base.ThreadUtils; |
| 10 import org.chromium.base.VisibleForTesting; | 10 import org.chromium.base.VisibleForTesting; |
| (...skipping 437 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 448 @CalledByNative | 448 @CalledByNative |
| 449 void offlinePageDeleted(long offlineId, ClientId clientId) { | 449 void offlinePageDeleted(long offlineId, ClientId clientId) { |
| 450 for (OfflinePageModelObserver observer : mObservers) { | 450 for (OfflinePageModelObserver observer : mObservers) { |
| 451 observer.offlinePageDeleted(offlineId, clientId); | 451 observer.offlinePageDeleted(offlineId, clientId); |
| 452 } | 452 } |
| 453 } | 453 } |
| 454 | 454 |
| 455 @CalledByNative | 455 @CalledByNative |
| 456 private static void createOfflinePageAndAddToList(List<OfflinePageItem> offl
inePagesList, | 456 private static void createOfflinePageAndAddToList(List<OfflinePageItem> offl
inePagesList, |
| 457 String url, long offlineId, String clientNamespace, String clientId,
String offlineUrl, | 457 String url, long offlineId, String clientNamespace, String clientId,
String offlineUrl, |
| 458 long fileSize, long creationTime, int accessCount, long lastAccessTi
meMs) { | 458 String filePath, long fileSize, long creationTime, int accessCount, |
| 459 long lastAccessTimeMs) { |
| 459 offlinePagesList.add(createOfflinePageItem(url, offlineId, clientNamespa
ce, clientId, | 460 offlinePagesList.add(createOfflinePageItem(url, offlineId, clientNamespa
ce, clientId, |
| 460 offlineUrl, fileSize, creationTime, accessCount, lastAccessTimeM
s)); | 461 offlineUrl, filePath, fileSize, creationTime, accessCount, lastA
ccessTimeMs)); |
| 461 } | 462 } |
| 462 | 463 |
| 463 @CalledByNative | 464 @CalledByNative |
| 464 private static OfflinePageItem createOfflinePageItem(String url, long offlin
eId, | 465 private static OfflinePageItem createOfflinePageItem(String url, long offlin
eId, |
| 465 String clientNamespace, String clientId, String offlineUrl, long fil
eSize, | 466 String clientNamespace, String clientId, String offlineUrl, String f
ilePath, |
| 466 long creationTime, int accessCount, long lastAccessTimeMs) { | 467 long fileSize, long creationTime, int accessCount, long lastAccessTi
meMs) { |
| 467 return new OfflinePageItem(url, offlineId, clientNamespace, clientId, of
flineUrl, fileSize, | 468 return new OfflinePageItem(url, offlineId, clientNamespace, clientId, of
flineUrl, filePath, |
| 468 creationTime, accessCount, lastAccessTimeMs); | 469 fileSize, creationTime, accessCount, lastAccessTimeMs); |
| 469 } | 470 } |
| 470 | 471 |
| 471 @CalledByNative | 472 @CalledByNative |
| 472 private static ClientId createClientId(String clientNamespace, String id) { | 473 private static ClientId createClientId(String clientNamespace, String id) { |
| 473 return new ClientId(clientNamespace, id); | 474 return new ClientId(clientNamespace, id); |
| 474 } | 475 } |
| 475 | 476 |
| 476 private static native boolean nativeIsOfflinePagesEnabled(); | 477 private static native boolean nativeIsOfflinePagesEnabled(); |
| 477 private static native boolean nativeIsOfflineBookmarksEnabled(); | 478 private static native boolean nativeIsOfflineBookmarksEnabled(); |
| 478 private static native boolean nativeIsBackgroundLoadingEnabled(); | 479 private static native boolean nativeIsBackgroundLoadingEnabled(); |
| (...skipping 20 matching lines...) Expand all Loading... |
| 499 private native void nativeGetPageByOfflineUrl( | 500 private native void nativeGetPageByOfflineUrl( |
| 500 long nativeOfflinePageBridge, String offlineUrl, Callback<OfflinePag
eItem> callback); | 501 long nativeOfflinePageBridge, String offlineUrl, Callback<OfflinePag
eItem> callback); |
| 501 private native void nativeSavePage(long nativeOfflinePageBridge, SavePageCal
lback callback, | 502 private native void nativeSavePage(long nativeOfflinePageBridge, SavePageCal
lback callback, |
| 502 WebContents webContents, String clientNamespace, String clientId); | 503 WebContents webContents, String clientNamespace, String clientId); |
| 503 private native void nativeSavePageLater( | 504 private native void nativeSavePageLater( |
| 504 long nativeOfflinePageBridge, String url, String clientNamespace, St
ring clientId); | 505 long nativeOfflinePageBridge, String url, String clientNamespace, St
ring clientId); |
| 505 private native void nativeDeletePages( | 506 private native void nativeDeletePages( |
| 506 long nativeOfflinePageBridge, Callback<Integer> callback, long[] off
lineIds); | 507 long nativeOfflinePageBridge, Callback<Integer> callback, long[] off
lineIds); |
| 507 private native void nativeCheckMetadataConsistency(long nativeOfflinePageBri
dge); | 508 private native void nativeCheckMetadataConsistency(long nativeOfflinePageBri
dge); |
| 508 } | 509 } |
| OLD | NEW |