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

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

Issue 1755613003: [Offline pages] Making sure http:// scheme is stripped from OIB (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@2661
Patch Set: 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 d46b3a9168eb6b8ec64043f9aa6c16f70348b9ce..9fbede7db21ecd7a6d392380e3435dac80f1227c 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
@@ -139,6 +139,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