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

Unified Diff: chrome/browser/android/offline_pages/prerendering_offliner.cc

Issue 2052913002: For Offliner, pass in the URL from WebContents to SavePage request instead of the request URL since… (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@moreturnon
Patch Set: Created 4 years, 6 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 | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/android/offline_pages/prerendering_offliner.cc
diff --git a/chrome/browser/android/offline_pages/prerendering_offliner.cc b/chrome/browser/android/offline_pages/prerendering_offliner.cc
index 35e2168398ffa4ea2da5a1a64509f29e9939d267..bab7d7fa6630b0794ed865cdf39d5ae6b0a2ed02 100644
--- a/chrome/browser/android/offline_pages/prerendering_offliner.cc
+++ b/chrome/browser/android/offline_pages/prerendering_offliner.cc
@@ -9,6 +9,7 @@
#include "components/offline_pages/background/save_page_request.h"
#include "components/offline_pages/offline_page_model.h"
#include "content/public/browser/browser_context.h"
+#include "content/public/browser/web_contents.h"
namespace offline_pages {
@@ -52,7 +53,13 @@ void PrerenderingOffliner::OnLoadPageDone(
DCHECK(web_contents);
std::unique_ptr<OfflinePageArchiver> archiver(
new OfflinePageMHTMLArchiver(web_contents));
- SavePage(request.url(), request.client_id(), std::move(archiver),
+ // Pass in the URL from the WebContents in case it is redirected from
+ // the requested URL. This is to work around a check in the
+ // OfflinePageModel implementation that ensures URL passed in here is
+ // same as LastCommittedURL from the snapshot.
+ // TODO(dougarnett): Raise issue of how to better deal with redirects.
+ SavePage(web_contents->GetLastCommittedURL(), request.client_id(),
+ std::move(archiver),
base::Bind(&PrerenderingOffliner::OnSavePageDone,
weak_ptr_factory_.GetWeakPtr(), request,
completion_callback));
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698