| 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 426 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 437 CheckPagesExistOfflineCallbackInternal callbackInternal = | 437 CheckPagesExistOfflineCallbackInternal callbackInternal = |
| 438 new CheckPagesExistOfflineCallbackInternal(callback); | 438 new CheckPagesExistOfflineCallbackInternal(callback); |
| 439 nativeCheckPagesExistOffline(mNativeOfflinePageBridge, urlArray, callbac
kInternal); | 439 nativeCheckPagesExistOffline(mNativeOfflinePageBridge, urlArray, callbac
kInternal); |
| 440 } | 440 } |
| 441 | 441 |
| 442 /** Tells the native side that a new tab has been added for this profile. */ | 442 /** Tells the native side that a new tab has been added for this profile. */ |
| 443 void registerRecentTab(int tabId) { | 443 void registerRecentTab(int tabId) { |
| 444 nativeRegisterRecentTab(mNativeOfflinePageBridge, tabId); | 444 nativeRegisterRecentTab(mNativeOfflinePageBridge, tabId); |
| 445 } | 445 } |
| 446 | 446 |
| 447 /** Tells the native side that the tab of |webContents| will be closed. */ |
| 448 void willCloseTab(WebContents webContents) { |
| 449 nativeWillCloseTab(mNativeOfflinePageBridge, webContents); |
| 450 } |
| 451 |
| 447 /** Tells the native side that a new tab has been removed for this profile.
*/ | 452 /** Tells the native side that a new tab has been removed for this profile.
*/ |
| 448 void unregisterRecentTab(int tabId) { | 453 void unregisterRecentTab(int tabId) { |
| 449 nativeUnregisterRecentTab(mNativeOfflinePageBridge, tabId); | 454 nativeUnregisterRecentTab(mNativeOfflinePageBridge, tabId); |
| 450 } | 455 } |
| 451 | 456 |
| 452 @VisibleForTesting | 457 @VisibleForTesting |
| 453 static void setOfflineBookmarksEnabledForTesting(boolean enabled) { | 458 static void setOfflineBookmarksEnabledForTesting(boolean enabled) { |
| 454 sOfflineBookmarksEnabled = enabled; | 459 sOfflineBookmarksEnabled = enabled; |
| 455 } | 460 } |
| 456 | 461 |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 515 private static native boolean nativeIsOfflineBookmarksEnabled(); | 520 private static native boolean nativeIsOfflineBookmarksEnabled(); |
| 516 private static native boolean nativeIsPageSharingEnabled(); | 521 private static native boolean nativeIsPageSharingEnabled(); |
| 517 private static native boolean nativeCanSavePage(String url); | 522 private static native boolean nativeCanSavePage(String url); |
| 518 private static native OfflinePageBridge nativeGetOfflinePageBridgeForProfile
(Profile profile); | 523 private static native OfflinePageBridge nativeGetOfflinePageBridgeForProfile
(Profile profile); |
| 519 @VisibleForTesting | 524 @VisibleForTesting |
| 520 native void nativeGetAllPages(long nativeOfflinePageBridge, List<OfflinePage
Item> offlinePages, | 525 native void nativeGetAllPages(long nativeOfflinePageBridge, List<OfflinePage
Item> offlinePages, |
| 521 final Callback<List<OfflinePageItem>> callback); | 526 final Callback<List<OfflinePageItem>> callback); |
| 522 private native void nativeCheckPagesExistOffline(long nativeOfflinePageBridg
e, Object[] urls, | 527 private native void nativeCheckPagesExistOffline(long nativeOfflinePageBridg
e, Object[] urls, |
| 523 CheckPagesExistOfflineCallbackInternal callback); | 528 CheckPagesExistOfflineCallbackInternal callback); |
| 524 private native void nativeRegisterRecentTab(long nativeOfflinePageBridge, in
t tabId); | 529 private native void nativeRegisterRecentTab(long nativeOfflinePageBridge, in
t tabId); |
| 530 private native void nativeWillCloseTab(long nativeOfflinePageBridge, WebCont
ents webContents); |
| 525 private native void nativeUnregisterRecentTab(long nativeOfflinePageBridge,
int tabId); | 531 private native void nativeUnregisterRecentTab(long nativeOfflinePageBridge,
int tabId); |
| 526 @VisibleForTesting | 532 @VisibleForTesting |
| 527 native void nativeGetRequestsInQueue( | 533 native void nativeGetRequestsInQueue( |
| 528 long nativeOfflinePageBridge, Callback<SavePageRequest[]> callback); | 534 long nativeOfflinePageBridge, Callback<SavePageRequest[]> callback); |
| 529 @VisibleForTesting | 535 @VisibleForTesting |
| 530 native void nativeRemoveRequestsFromQueue( | 536 native void nativeRemoveRequestsFromQueue( |
| 531 long nativeOfflinePageBridge, long[] requestIds, RequestsRemovedCall
back callback); | 537 long nativeOfflinePageBridge, long[] requestIds, RequestsRemovedCall
back callback); |
| 532 @VisibleForTesting | 538 @VisibleForTesting |
| 533 native void nativeGetPageByOfflineId( | 539 native void nativeGetPageByOfflineId( |
| 534 long nativeOfflinePageBridge, long offlineId, Callback<OfflinePageIt
em> callback); | 540 long nativeOfflinePageBridge, long offlineId, Callback<OfflinePageIt
em> callback); |
| (...skipping 10 matching lines...) Expand all Loading... |
| 545 WebContents webContents, String clientNamespace, String clientId); | 551 WebContents webContents, String clientNamespace, String clientId); |
| 546 private native void nativeSavePageLater(long nativeOfflinePageBridge, String
url, | 552 private native void nativeSavePageLater(long nativeOfflinePageBridge, String
url, |
| 547 String clientNamespace, String clientId, boolean userRequested); | 553 String clientNamespace, String clientId, boolean userRequested); |
| 548 private native String nativeGetOfflinePageHeaderForReload( | 554 private native String nativeGetOfflinePageHeaderForReload( |
| 549 long nativeOfflinePageBridge, WebContents webContents); | 555 long nativeOfflinePageBridge, WebContents webContents); |
| 550 private native boolean nativeIsShowingOfflinePreview( | 556 private native boolean nativeIsShowingOfflinePreview( |
| 551 long nativeOfflinePageBridge, WebContents webContents); | 557 long nativeOfflinePageBridge, WebContents webContents); |
| 552 private native boolean nativeIsShowingDownloadButtonInErrorPage( | 558 private native boolean nativeIsShowingDownloadButtonInErrorPage( |
| 553 long nativeOfflinePageBridge, WebContents webContents); | 559 long nativeOfflinePageBridge, WebContents webContents); |
| 554 } | 560 } |
| OLD | NEW |