| OLD | NEW |
| 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/alternate_nav_url_fetcher.h" | 5 #include "chrome/browser/alternate_nav_url_fetcher.h" |
| 6 | 6 |
| 7 #include "base/utf_string_conversions.h" | 7 #include "base/utf_string_conversions.h" |
| 8 #include "chrome/browser/infobars/infobar_tab_helper.h" | 8 #include "chrome/browser/infobars/infobar_tab_helper.h" |
| 9 #include "chrome/browser/intranet_redirect_detector.h" | 9 #include "chrome/browser/intranet_redirect_detector.h" |
| 10 #include "chrome/browser/profiles/profile.h" | 10 #include "chrome/browser/profiles/profile.h" |
| (...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 185 void AlternateNavURLFetcher::StartFetch(NavigationController* controller) { | 185 void AlternateNavURLFetcher::StartFetch(NavigationController* controller) { |
| 186 controller_ = controller; | 186 controller_ = controller; |
| 187 registrar_.Add( | 187 registrar_.Add( |
| 188 this, | 188 this, |
| 189 content::NOTIFICATION_WEB_CONTENTS_DESTROYED, | 189 content::NOTIFICATION_WEB_CONTENTS_DESTROYED, |
| 190 content::Source<content::WebContents>(controller_->GetWebContents())); | 190 content::Source<content::WebContents>(controller_->GetWebContents())); |
| 191 | 191 |
| 192 DCHECK_EQ(NOT_STARTED, state_); | 192 DCHECK_EQ(NOT_STARTED, state_); |
| 193 state_ = IN_PROGRESS; | 193 state_ = IN_PROGRESS; |
| 194 fetcher_.reset(content::URLFetcher::Create( | 194 fetcher_.reset(content::URLFetcher::Create( |
| 195 GURL(alternate_nav_url_), content::URLFetcher::HEAD, this)); | 195 GURL(alternate_nav_url_), net::URLFetcher::HEAD, this)); |
| 196 fetcher_->SetRequestContext( | 196 fetcher_->SetRequestContext( |
| 197 controller_->GetBrowserContext()->GetRequestContext()); | 197 controller_->GetBrowserContext()->GetRequestContext()); |
| 198 | 198 |
| 199 content::WebContents* web_contents = controller_->GetWebContents(); | 199 content::WebContents* web_contents = controller_->GetWebContents(); |
| 200 content::AssociateURLFetcherWithRenderView( | 200 content::AssociateURLFetcherWithRenderView( |
| 201 fetcher_.get(), | 201 fetcher_.get(), |
| 202 web_contents->GetURL(), | 202 web_contents->GetURL(), |
| 203 web_contents->GetRenderProcessHost()->GetID(), | 203 web_contents->GetRenderProcessHost()->GetID(), |
| 204 web_contents->GetRenderViewHost()->GetRoutingID()); | 204 web_contents->GetRenderViewHost()->GetRoutingID()); |
| 205 fetcher_->Start(); | 205 fetcher_->Start(); |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 237 return; | 237 return; |
| 238 } | 238 } |
| 239 | 239 |
| 240 InfoBarTabHelper* infobar_helper = | 240 InfoBarTabHelper* infobar_helper = |
| 241 TabContentsWrapper::GetCurrentWrapperForContents( | 241 TabContentsWrapper::GetCurrentWrapperForContents( |
| 242 controller_->GetWebContents())->infobar_tab_helper(); | 242 controller_->GetWebContents())->infobar_tab_helper(); |
| 243 infobar_helper->AddInfoBar( | 243 infobar_helper->AddInfoBar( |
| 244 new AlternateNavInfoBarDelegate(infobar_helper, alternate_nav_url_)); | 244 new AlternateNavInfoBarDelegate(infobar_helper, alternate_nav_url_)); |
| 245 delete this; | 245 delete this; |
| 246 } | 246 } |
| OLD | NEW |