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

Unified Diff: chrome/browser/alternate_nav_url_fetcher.cc

Issue 2747006: Change notification handling to prevent multiple 'Do you mean...?' infobars f... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 10 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/alternate_nav_url_fetcher.cc
===================================================================
--- chrome/browser/alternate_nav_url_fetcher.cc (revision 49029)
+++ chrome/browser/alternate_nav_url_fetcher.cc (working copy)
@@ -35,26 +35,33 @@
const NotificationDetails& details) {
switch (type.value) {
case NotificationType::NAV_ENTRY_PENDING:
- controller_ = Source<NavigationController>(source).ptr();
- DCHECK(controller_->pending_entry());
+ // If we've already received a notification for the same controller, we
+ // should delete ourselves as that indicates that the page is being
+ // re-loaded so this instance is now stale.
+ // http://crbug.com/43378
+ if (!infobar_contents_ &&
+ controller_ == Source<NavigationController>(source).ptr()) {
+ delete this;
+ } else if (!controller_) {
Evan Stade 2010/06/09 19:46:11 can the hypothetical else be reached (where contro
csilv 2010/06/09 20:09:22 Yes, that can happen if some other tab sends a NAV
+ controller_ = Source<NavigationController>(source).ptr();
+ DCHECK(controller_->pending_entry());
- // Unregister for this notification now that we're pending, and start
- // listening for the corresponding commit. We also need to listen for the
- // tab close command since that means the load will never commit!
- registrar_.Remove(this, NotificationType::NAV_ENTRY_PENDING,
- NotificationService::AllSources());
- registrar_.Add(this, NotificationType::NAV_ENTRY_COMMITTED,
- Source<NavigationController>(controller_));
- registrar_.Add(this, NotificationType::TAB_CLOSED,
- Source<NavigationController>(controller_));
+ // Start listening for the commit notification. We also need to listen
+ // for the tab close command since that means the load will never
+ // commit!
+ registrar_.Add(this, NotificationType::NAV_ENTRY_COMMITTED,
+ Source<NavigationController>(controller_));
+ registrar_.Add(this, NotificationType::TAB_CLOSED,
+ Source<NavigationController>(controller_));
- DCHECK_EQ(NOT_STARTED, state_);
- state_ = IN_PROGRESS;
- fetcher_.reset(new URLFetcher(GURL(alternate_nav_url_), URLFetcher::HEAD,
- this));
- fetcher_->set_request_context(
- controller_->profile()->GetRequestContext());
- fetcher_->Start();
+ DCHECK_EQ(NOT_STARTED, state_);
+ state_ = IN_PROGRESS;
+ fetcher_.reset(new URLFetcher(GURL(alternate_nav_url_),
+ URLFetcher::HEAD, this));
+ fetcher_->set_request_context(
+ controller_->profile()->GetRequestContext());
+ fetcher_->Start();
+ }
break;
case NotificationType::NAV_ENTRY_COMMITTED:
« 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