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

Side by Side Diff: chrome/browser/download/download_request_limiter.cc

Issue 257153003: We have a problem in the process on destroying WebContentsImpl because (Closed) Base URL: https://git.chromium.org/chromium/src.git@master
Patch Set: Rebased onto origin/master again, resolved conflicts Created 6 years, 7 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/download/download_request_limiter.h" 5 #include "chrome/browser/download/download_request_limiter.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/stl_util.h" 8 #include "base/stl_util.h"
9 #include "chrome/browser/content_settings/host_content_settings_map.h" 9 #include "chrome/browser/content_settings/host_content_settings_map.h"
10 #include "chrome/browser/content_settings/tab_specific_content_settings.h" 10 #include "chrome/browser/content_settings/tab_specific_content_settings.h"
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
103 // DOWNLOADS_NOT_ALLOWED is functionally equivalent to PROMPT_BEFORE_DOWNLOAD. 103 // DOWNLOADS_NOT_ALLOWED is functionally equivalent to PROMPT_BEFORE_DOWNLOAD.
104 if ((status_ != DownloadRequestLimiter::ALLOW_ALL_DOWNLOADS) && 104 if ((status_ != DownloadRequestLimiter::ALLOW_ALL_DOWNLOADS) &&
105 (!promptable || 105 (!promptable ||
106 (status_ != DownloadRequestLimiter::DOWNLOADS_NOT_ALLOWED))) { 106 (status_ != DownloadRequestLimiter::DOWNLOADS_NOT_ALLOWED))) {
107 // Revert to default status. 107 // Revert to default status.
108 host_->Remove(this, web_contents()); 108 host_->Remove(this, web_contents());
109 // WARNING: We've been deleted. 109 // WARNING: We've been deleted.
110 } 110 }
111 } 111 }
112 112
113 void DownloadRequestLimiter::TabDownloadState::WebContentsDestroyed( 113 void DownloadRequestLimiter::TabDownloadState::WebContentsDestroyed() {
114 content::WebContents* web_contents) {
115 // Tab closed, no need to handle closing the dialog as it's owned by the 114 // Tab closed, no need to handle closing the dialog as it's owned by the
116 // WebContents. 115 // WebContents.
117 116
118 NotifyCallbacks(false); 117 NotifyCallbacks(false);
119 // Note that web_contents() is NULL at this point. 118 host_->Remove(this, web_contents());
120 host_->Remove(this, web_contents);
121 // WARNING: We've been deleted. 119 // WARNING: We've been deleted.
122 } 120 }
123 121
124 void DownloadRequestLimiter::TabDownloadState::PromptUserForDownload( 122 void DownloadRequestLimiter::TabDownloadState::PromptUserForDownload(
125 const DownloadRequestLimiter::Callback& callback) { 123 const DownloadRequestLimiter::Callback& callback) {
126 callbacks_.push_back(callback); 124 callbacks_.push_back(callback);
127 DCHECK(web_contents_); 125 DCHECK(web_contents_);
128 if (is_showing_prompt()) 126 if (is_showing_prompt())
129 return; 127 return;
130 128
(...skipping 331 matching lines...) Expand 10 before | Expand all | Expand 10 after
462 BrowserThread::PostTask( 460 BrowserThread::PostTask(
463 BrowserThread::IO, FROM_HERE, base::Bind(callback, allow)); 461 BrowserThread::IO, FROM_HERE, base::Bind(callback, allow));
464 } 462 }
465 463
466 void DownloadRequestLimiter::Remove(TabDownloadState* state, 464 void DownloadRequestLimiter::Remove(TabDownloadState* state,
467 content::WebContents* contents) { 465 content::WebContents* contents) {
468 DCHECK(ContainsKey(state_map_, contents)); 466 DCHECK(ContainsKey(state_map_, contents));
469 state_map_.erase(contents); 467 state_map_.erase(contents);
470 delete state; 468 delete state;
471 } 469 }
OLDNEW
« no previous file with comments | « chrome/browser/download/download_request_limiter.h ('k') | chrome/browser/extensions/active_tab_permission_granter.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698