| 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 385 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 396 | 396 |
| 397 /** | 397 /** |
| 398 * Retrieves the extra request header to reload the offline page. | 398 * Retrieves the extra request header to reload the offline page. |
| 399 * @param webContents Contents of the page to reload. | 399 * @param webContents Contents of the page to reload. |
| 400 * @return The extra request header string. | 400 * @return The extra request header string. |
| 401 */ | 401 */ |
| 402 public String getOfflinePageHeaderForReload(WebContents webContents) { | 402 public String getOfflinePageHeaderForReload(WebContents webContents) { |
| 403 return nativeGetOfflinePageHeaderForReload(mNativeOfflinePageBridge, web
Contents); | 403 return nativeGetOfflinePageHeaderForReload(mNativeOfflinePageBridge, web
Contents); |
| 404 } | 404 } |
| 405 | 405 |
| 406 /** | |
| 407 * @return True if an offline preview is being shown. | |
| 408 * @param webContents Contents of the page to check. | |
| 409 */ | |
| 410 public boolean isShowingOfflinePreview(WebContents webContents) { | |
| 411 return nativeIsShowingOfflinePreview(mNativeOfflinePageBridge, webConten
ts); | |
| 412 } | |
| 413 | |
| 414 private static class CheckPagesExistOfflineCallbackInternal { | 406 private static class CheckPagesExistOfflineCallbackInternal { |
| 415 private Callback<Set<String>> mCallback; | 407 private Callback<Set<String>> mCallback; |
| 416 | 408 |
| 417 CheckPagesExistOfflineCallbackInternal(Callback<Set<String>> callback) { | 409 CheckPagesExistOfflineCallbackInternal(Callback<Set<String>> callback) { |
| 418 mCallback = callback; | 410 mCallback = callback; |
| 419 } | 411 } |
| 420 | 412 |
| 421 @CalledByNative("CheckPagesExistOfflineCallbackInternal") | 413 @CalledByNative("CheckPagesExistOfflineCallbackInternal") |
| 422 public void onResult(String[] results) { | 414 public void onResult(String[] results) { |
| 423 Set<String> resultSet = new HashSet<>(); | 415 Set<String> resultSet = new HashSet<>(); |
| (...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 530 String[] ids, Callback<Integer> callback); | 522 String[] ids, Callback<Integer> callback); |
| 531 private native void nativeSelectPageForOnlineUrl( | 523 private native void nativeSelectPageForOnlineUrl( |
| 532 long nativeOfflinePageBridge, String onlineUrl, int tabId, | 524 long nativeOfflinePageBridge, String onlineUrl, int tabId, |
| 533 Callback<OfflinePageItem> callback); | 525 Callback<OfflinePageItem> callback); |
| 534 private native void nativeSavePage(long nativeOfflinePageBridge, SavePageCal
lback callback, | 526 private native void nativeSavePage(long nativeOfflinePageBridge, SavePageCal
lback callback, |
| 535 WebContents webContents, String clientNamespace, String clientId); | 527 WebContents webContents, String clientNamespace, String clientId); |
| 536 private native void nativeSavePageLater(long nativeOfflinePageBridge, String
url, | 528 private native void nativeSavePageLater(long nativeOfflinePageBridge, String
url, |
| 537 String clientNamespace, String clientId, boolean userRequested); | 529 String clientNamespace, String clientId, boolean userRequested); |
| 538 private native String nativeGetOfflinePageHeaderForReload( | 530 private native String nativeGetOfflinePageHeaderForReload( |
| 539 long nativeOfflinePageBridge, WebContents webContents); | 531 long nativeOfflinePageBridge, WebContents webContents); |
| 540 private native boolean nativeIsShowingOfflinePreview( | |
| 541 long nativeOfflinePageBridge, WebContents webContents); | |
| 542 } | 532 } |
| OLD | NEW |