Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1841)

Unified Diff: chrome/android/java/src/org/chromium/chrome/browser/ChromeActivity.java

Issue 1645693002: When the user selects "Share" for an offline page, share the online URL. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add custom enum Created 4 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | tools/metrics/histograms/histograms.xml » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 0c1a139b05fcdf274a7524a697a33455fca543c7..562e7597b2d40f247530d35540a9ea1fdf7cd059 100644
--- a/chrome/android/java/src/org/chromium/chrome/browser/ChromeActivity.java
+++ b/chrome/android/java/src/org/chromium/chrome/browser/ChromeActivity.java
@@ -883,8 +883,17 @@ public abstract class ChromeActivity extends AsyncInitializationActivity
ContentBitmapCallback callback = new ContentBitmapCallback() {
@Override
public void onFinishGetBitmap(Bitmap bitmap, int response) {
- ShareHelper.share(shareDirectly, mainActivity, currentTab.getTitle(),
- currentTab.getUrl(), bitmap);
+ // 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);
+
+ // 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 {
« no previous file with comments | « no previous file | tools/metrics/histograms/histograms.xml » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698