| Index: chrome/android/java/src/org/chromium/chrome/browser/ChromeActivity.java
|
| diff --git a/chrome/android/java/src/org/chromium/chrome/browser/ChromeActivity.java b/chrome/android/java/src/org/chromium/chrome/browser/ChromeActivity.java
|
| index a415606bd43b47f7e16bd0cf7b603d2f5789bdc1..21b0b2f8929606938fb273519276fed07cbac740 100644
|
| --- a/chrome/android/java/src/org/chromium/chrome/browser/ChromeActivity.java
|
| +++ b/chrome/android/java/src/org/chromium/chrome/browser/ChromeActivity.java
|
| @@ -85,6 +85,7 @@ import org.chromium.chrome.browser.metrics.UmaUtils;
|
| import org.chromium.chrome.browser.multiwindow.MultiWindowUtils;
|
| import org.chromium.chrome.browser.nfc.BeamController;
|
| import org.chromium.chrome.browser.nfc.BeamProvider;
|
| +import org.chromium.chrome.browser.offlinepages.OfflinePageBridge;
|
| import org.chromium.chrome.browser.offlinepages.OfflinePageUtils;
|
| import org.chromium.chrome.browser.omaha.UpdateMenuItemHelper;
|
| import org.chromium.chrome.browser.pageinfo.WebsiteSettingsPopup;
|
| @@ -960,26 +961,37 @@ public abstract class ChromeActivity extends AsyncInitializationActivity
|
|
|
| final Activity mainActivity = this;
|
| ContentBitmapCallback callback = new ContentBitmapCallback() {
|
| - @Override
|
| - public void onFinishGetBitmap(Bitmap bitmap, int response) {
|
| - // Check whether this page is an offline page, and use its online URL if so.
|
| - String url = currentTab.getOriginalUrl();
|
| - RecordHistogram.recordBooleanHistogram(
|
| - "OfflinePages.SharedPageWasOffline", url != null);
|
| -
|
| - // If there is no entry in the offline pages DB for this tab, use the tab's
|
| - // URL directly.
|
| - if (url == null) url = currentTab.getUrl();
|
| -
|
| - ShareHelper.share(
|
| - shareDirectly, mainActivity, currentTab.getTitle(), url, bitmap);
|
| - if (shareDirectly) {
|
| - RecordUserAction.record("MobileMenuDirectShare");
|
| - } else {
|
| - RecordUserAction.record("MobileMenuShare");
|
| - }
|
| + @Override
|
| + public void onFinishGetBitmap(Bitmap bitmap, int response) {
|
| + // Check whether this page is an offline page, and use its online URL if so.
|
| + String url = currentTab.getOfflinePageOriginalUrl();
|
| + RecordHistogram.recordBooleanHistogram(
|
| + "OfflinePages.SharedPageWasOffline", url != null);
|
| + boolean canShareOfflinePage =
|
| + (url != null && OfflinePageBridge.isPageSharingEnabled());
|
| +
|
| + if (!canShareOfflinePage) {
|
| + // If there is no entry in the offline pages DB for this tab, use the
|
| + // tab's URL directly.
|
| + if (url == null) url = currentTab.getUrl();
|
| +
|
| + ShareHelper.share(
|
| + shareDirectly, mainActivity, currentTab.getTitle(), url, null, bitmap);
|
| + if (shareDirectly) {
|
| + RecordUserAction.record("MobileMenuDirectShare");
|
| + } else {
|
| + RecordUserAction.record("MobileMenuShare");
|
| }
|
| - };
|
| + } else {
|
| + // This is for experienmental feature Offline Page Sharing.
|
| + // If this page is an offline page, and the share the offline page
|
| + // instead of url.
|
| + Context mContext = getApplicationContext();
|
| + OfflinePageUtils.shareOfflinePage(
|
| + shareDirectly, mainActivity, url, bitmap, mContext, currentTab);
|
| + }
|
| + }
|
| + };
|
| if (isIncognito || currentTab.getWebContents() == null) {
|
| callback.onFinishGetBitmap(null, ReadbackResponse.SURFACE_UNAVAILABLE);
|
| } else {
|
|
|