Index: chrome/browser/content_settings/permission_queue_controller.cc |
diff --git a/chrome/browser/content_settings/permission_queue_controller.cc b/chrome/browser/content_settings/permission_queue_controller.cc |
index d084210ad65417493ee6ece243f82078f0a61c17..4716be26259a70f0611223047feff30bdcac6f82 100644 |
--- a/chrome/browser/content_settings/permission_queue_controller.cc |
+++ b/chrome/browser/content_settings/permission_queue_controller.cc |
@@ -153,12 +153,6 @@ void PermissionQueueController::CreateInfoBarRequest( |
PermissionDecidedCallback callback) { |
DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)); |
- // We shouldn't get duplicate requests. |
- for (PendingInfobarRequests::const_iterator i( |
- pending_infobar_requests_.begin()); |
- i != pending_infobar_requests_.end(); ++i) |
- DCHECK(!i->id().Equals(id)); |
- |
pending_infobar_requests_.push_back(PendingInfobarRequest( |
type_, id, requesting_frame, embedder, |
accept_button_label, callback)); |
@@ -189,7 +183,6 @@ void PermissionQueueController::OnPermissionSet( |
bool update_content_setting, |
bool allowed) { |
DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)); |
- |
if (update_content_setting) |
UpdateContentSetting(requesting_frame, embedder, allowed); |
@@ -201,20 +194,25 @@ void PermissionQueueController::OnPermissionSet( |
i != pending_infobar_requests_.end(); ) { |
if (i->IsForPair(requesting_frame, embedder)) { |
xhwang
2014/06/10 21:48:39
nit: See below about using a normal for loop. If y
|
requests_to_notify.push_back(*i); |
+ bool infobar_created = false; |
if (i->id().Equals(id)) { |
// The infobar that called us is i->infobar(), and its delegate is |
// currently in either Accept() or Cancel(). This means that |
// RemoveInfoBar() will be called later on, and that will trigger a |
// notification we're observing. |
- ++i; |
- } else if (i->has_infobar()) { |
- // This infobar is for the same frame/embedder pair, but in a different |
- // tab. We should remove it now that we've got an answer for it. |
+ infobar_created = true; |
+ } |
+ if (i->has_infobar()) { |
+ // This infobar is for the same frame/embedder pair. We should remove |
+ // it now that we've got an answer for it. |
infobars_to_remove.push_back(*i); |
- ++i; |
- } else { |
+ infobar_created = true; |
+ } |
+ if (!infobar_created) { |
// We haven't created an infobar yet, just remove the pending request. |
i = pending_infobar_requests_.erase(i); |
+ } else { |
+ ++i; |
} |
} else { |
++i; |