Index: ios/chrome/browser/reading_list/offline_url_utils.cc |
diff --git a/ios/chrome/browser/reading_list/offline_url_utils.cc b/ios/chrome/browser/reading_list/offline_url_utils.cc |
index e2ceb6c0c1b448ce785d8e2e9175a1f81e98db1e..a31130a51b21b9cc579bef7cea04ab543cec0161 100644 |
--- a/ios/chrome/browser/reading_list/offline_url_utils.cc |
+++ b/ios/chrome/browser/reading_list/offline_url_utils.cc |
@@ -4,8 +4,11 @@ |
#include "ios/chrome/browser/reading_list/offline_url_utils.h" |
+#include "base/logging.h" |
#include "base/md5.h" |
+#include "base/strings/string_util.h" |
#include "base/strings/stringprintf.h" |
+#include "base/strings/utf_string_conversions.h" |
#include "components/reading_list/ios/offline_url_utils.h" |
#include "ios/chrome/browser/chrome_url_constants.h" |
#include "net/base/url_util.h" |
@@ -63,4 +66,20 @@ GURL FileURLForDistilledURL(const GURL& distilled_url, |
bool IsOfflineURL(const GURL& url) { |
return url.SchemeIs(kChromeUIScheme) && url.host() == kChromeUIOfflineHost; |
} |
+ |
+base::string16 StripSchemeFromOnlineUrl(base::string16 online_url) { |
+ base::string16 https_scheme = base::UTF8ToUTF16(base::StringPrintf( |
+ "%s%s", url::kHttpsScheme, url::kStandardSchemeSeparator)); |
+ if (base::StartsWith(online_url, https_scheme, |
+ base::CompareCase::SENSITIVE)) { |
+ return online_url.substr(https_scheme.length()); |
+ } |
+ // http:// scheme should already have been trimmed at this point. |
+ // DCHECK to detect formatting changes in omnibox. |
+ DCHECK(!base::StartsWith( |
+ online_url, base::UTF8ToUTF16(base::StringPrintf( |
Eugene But (OOO till 7-30)
2016/12/28 17:02:59
Optional nit: For the purpose of your DCHECK this
Olivier
2016/12/29 12:37:20
This would DCHECK on http://http.com.
I will keep
|
+ "%s%s", url::kHttpScheme, url::kStandardSchemeSeparator)), |
+ base::CompareCase::SENSITIVE)); |
+ return online_url; |
+} |
} |