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

Unified Diff: chrome/browser/content_settings/permission_queue_controller.cc

Issue 322203003: Allow duplicate infobar requests (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 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/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;
« 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