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

Unified Diff: content/browser/download/save_package.cc

Issue 23022006: Remove GetActiveEntry usage from content. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fixing Save Page As code and test. Created 7 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
Index: content/browser/download/save_package.cc
diff --git a/content/browser/download/save_package.cc b/content/browser/download/save_package.cc
index f38f9cdb1e4f7a074f10b251024d58e9ab8a6b69..056d9b65cdd954fc071ae962ac1e37f49ef58e16 100644
--- a/content/browser/download/save_package.cc
+++ b/content/browser/download/save_package.cc
@@ -255,13 +255,12 @@ SavePackage::~SavePackage() {
}
GURL SavePackage::GetUrlToBeSaved() {
- // Instead of using web_contents_.GetURL here, we use url() (which is the
- // "real" url of the page) from the NavigationEntry because it reflects its
- // origin rather than the displayed one (returned by GetURL) which may be
- // different (like having "view-source:" on the front).
- NavigationEntry* active_entry =
- web_contents()->GetController().GetActiveEntry();
- return active_entry->GetURL();
+ // The URL to be saved is the real resource URL, not the one displayed to
+ // the user, which can be a friendly format one. Use the NavigationEntry
+ // URL instead of WebContents, since the latter gives us the user visible URL.
+ NavigationEntry* last_committed_entry =
+ web_contents()->GetController().GetLastCommittedEntry();
+ return last_committed_entry ? last_committed_entry->GetURL() : GURL();
}
void SavePackage::Cancel(bool user_action) {

Powered by Google App Engine
This is Rietveld 408576698