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

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

Issue 1749233003: [Offline pages] Making sure http:// scheme is stripped from OIB (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Addressing CR feedback Created 4 years, 10 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 | chrome/android/java/src/org/chromium/chrome/browser/pageinfo/WebsiteSettingsPopup.java » ('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/offlinepages/OfflinePageUtils.java
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/offlinepages/OfflinePageUtils.java b/chrome/android/java/src/org/chromium/chrome/browser/offlinepages/OfflinePageUtils.java
index 74073f24b852310b800db13edc4d8689c80b3f56..c4187256442e535276f7a8ba6437c4bdfb230d1e 100644
--- a/chrome/android/java/src/org/chromium/chrome/browser/offlinepages/OfflinePageUtils.java
+++ b/chrome/android/java/src/org/chromium/chrome/browser/offlinepages/OfflinePageUtils.java
@@ -135,6 +135,22 @@ public class OfflinePageUtils {
}
/**
+ * Strips scheme from the original URL of the offline page. This is meant to be used by UI.
+ * @param onlineUrl an online URL to from which the scheme is removed
+ * @return onlineUrl without the scheme
+ */
+ public static String stripSchemeFromOnlineUrl(String onlineUrl) {
+ // Offline pages are only saved for https:// and http:// schemes.
+ if (onlineUrl.startsWith("https://")) {
+ return onlineUrl.substring(8);
+ } else if (onlineUrl.startsWith("http://")) {
+ return onlineUrl.substring(7);
+ } else {
+ return onlineUrl;
+ }
+ }
+
+ /**
* Shows the snackbar for the current tab to provide offline specific information if needed.
* @param activity The activity owning the tab.
* @param tab The current tab.
« no previous file with comments | « no previous file | chrome/android/java/src/org/chromium/chrome/browser/pageinfo/WebsiteSettingsPopup.java » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698