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

Unified Diff: chrome/browser/alternate_nav_url_fetcher.cc

Issue 10890023: Miscellaneous cleanups from several months ago I never got around to landing. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 8 years, 4 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
Index: chrome/browser/alternate_nav_url_fetcher.cc
===================================================================
--- chrome/browser/alternate_nav_url_fetcher.cc (revision 153800)
+++ chrome/browser/alternate_nav_url_fetcher.cc (working copy)
@@ -184,15 +184,14 @@
void AlternateNavURLFetcher::StartFetch(NavigationController* controller) {
controller_ = controller;
- registrar_.Add(
- this,
- content::NOTIFICATION_WEB_CONTENTS_DESTROYED,
- content::Source<content::WebContents>(controller_->GetWebContents()));
+ content::WebContents* web_contents = controller_->GetWebContents();
+ registrar_.Add(this, content::NOTIFICATION_WEB_CONTENTS_DESTROYED,
+ content::Source<content::WebContents>(web_contents));
DCHECK_EQ(NOT_STARTED, state_);
state_ = IN_PROGRESS;
- fetcher_.reset(net::URLFetcher::Create(
- GURL(alternate_nav_url_), net::URLFetcher::HEAD, this));
+ fetcher_.reset(net::URLFetcher::Create(GURL(alternate_nav_url_),
+ net::URLFetcher::HEAD, this));
fetcher_->SetLoadFlags(net::LOAD_DO_NOT_SAVE_COOKIES);
fetcher_->SetRequestContext(
controller_->GetBrowserContext()->GetRequestContext());
@@ -221,16 +220,14 @@
}
void AlternateNavURLFetcher::ShowInfobarIfPossible() {
- if (!navigated_to_entry_ || state_ != SUCCEEDED) {
- if (state_ == FAILED)
- delete this;
+ if (navigated_to_entry_ && (state_ == SUCCEEDED)) {
+ InfoBarTabHelper* infobar_helper =
+ TabContents::FromWebContents(controller_->GetWebContents())->
+ infobar_tab_helper();
+ infobar_helper->AddInfoBar(
+ new AlternateNavInfoBarDelegate(infobar_helper, alternate_nav_url_));
+ } else if (state_ != FAILED) {
return;
}
-
- InfoBarTabHelper* infobar_helper =
- TabContents::FromWebContents(controller_->GetWebContents())->
- infobar_tab_helper();
- infobar_helper->AddInfoBar(
- new AlternateNavInfoBarDelegate(infobar_helper, alternate_nav_url_));
delete this;
}

Powered by Google App Engine
This is Rietveld 408576698