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

Unified Diff: chrome/browser/download/download_permission_request.cc

Issue 1052273005: Fix DownloadPermissionRequest crash when host_ disappears (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 8 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 | « chrome/browser/download/download_permission_request.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/download/download_permission_request.cc
diff --git a/chrome/browser/download/download_permission_request.cc b/chrome/browser/download/download_permission_request.cc
index 223165f3fae6f6a7b9e66544986cd6f5e0b00615..891664c570816ffdcd5741ca3a3cc29700e2c32f 100644
--- a/chrome/browser/download/download_permission_request.cc
+++ b/chrome/browser/download/download_permission_request.cc
@@ -11,7 +11,11 @@
DownloadPermissionRequest::DownloadPermissionRequest(
base::WeakPtr<DownloadRequestLimiter::TabDownloadState> host)
- : host_(host) {}
+ : host_(host) {
+ const content::WebContents* web_contents = host_->web_contents();
+ DCHECK(web_contents);
+ request_url_ = web_contents->GetURL();
+}
DownloadPermissionRequest::~DownloadPermissionRequest() {}
@@ -37,11 +41,7 @@ bool DownloadPermissionRequest::HasUserGesture() const {
}
GURL DownloadPermissionRequest::GetRequestingHostname() const {
- const content::WebContents* web_contents = host_->web_contents();
- if (web_contents) {
- return web_contents->GetURL();
- }
- return GURL();
+ return request_url_;
}
void DownloadPermissionRequest::PermissionGranted() {
« no previous file with comments | « chrome/browser/download/download_permission_request.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698