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

Unified Diff: components/offline_pages/offline_page_model_impl.cc

Issue 2353813002: Match offline page url with fragment identifier stripped (Closed)
Patch Set: Created 4 years, 3 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 | components/offline_pages/offline_page_model_impl_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/offline_pages/offline_page_model_impl.cc
diff --git a/components/offline_pages/offline_page_model_impl.cc b/components/offline_pages/offline_page_model_impl.cc
index cfb67fc33925267e49eabbd588ec40d6ad2eda6f..70ccc3a96447d9bb7e793ecb47191b76dee36750 100644
--- a/components/offline_pages/offline_page_model_impl.cc
+++ b/components/offline_pages/offline_page_model_impl.cc
@@ -636,9 +636,23 @@ void OfflinePageModelImpl::GetPagesByOnlineURLWhenLoadDone(
const MultipleOfflinePageItemCallback& callback) const {
std::vector<OfflinePageItem> result;
+ GURL::Replacements remove_params;
+ remove_params.ClearRef();
+
+ GURL online_url_without_fragment =
+ online_url.ReplaceComponents(remove_params);
+
for (const auto& id_page_pair : offline_pages_) {
- if (id_page_pair.second.url == online_url &&
- !id_page_pair.second.IsExpired()) {
+ if (id_page_pair.second.IsExpired())
+ continue;
+ if (online_url == id_page_pair.second.url) {
+ result.push_back(id_page_pair.second);
+ continue;
+ }
+ // If the full URL does not match, try with the fragment identifier
+ // stripped.
+ if (online_url_without_fragment ==
+ id_page_pair.second.url.ReplaceComponents(remove_params)) {
result.push_back(id_page_pair.second);
}
}
« no previous file with comments | « no previous file | components/offline_pages/offline_page_model_impl_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698