| 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 179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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_), content::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 fetcher_->AssociateWithRenderView( | 200 content::AssociateWithRenderView( |
| 201 fetcher_.get(), |
| 201 web_contents->GetURL(), | 202 web_contents->GetURL(), |
| 202 web_contents->GetRenderProcessHost()->GetID(), | 203 web_contents->GetRenderProcessHost()->GetID(), |
| 203 web_contents->GetRenderViewHost()->GetRoutingID()); | 204 web_contents->GetRenderViewHost()->GetRoutingID()); |
| 204 fetcher_->Start(); | 205 fetcher_->Start(); |
| 205 } | 206 } |
| 206 | 207 |
| 207 void AlternateNavURLFetcher::SetStatusFromURLFetch( | 208 void AlternateNavURLFetcher::SetStatusFromURLFetch( |
| 208 const GURL& url, | 209 const GURL& url, |
| 209 const net::URLRequestStatus& status, | 210 const net::URLRequestStatus& status, |
| 210 int response_code) { | 211 int response_code) { |
| (...skipping 25 matching lines...) Expand all Loading... |
| 236 return; | 237 return; |
| 237 } | 238 } |
| 238 | 239 |
| 239 InfoBarTabHelper* infobar_helper = | 240 InfoBarTabHelper* infobar_helper = |
| 240 TabContentsWrapper::GetCurrentWrapperForContents( | 241 TabContentsWrapper::GetCurrentWrapperForContents( |
| 241 controller_->GetWebContents())->infobar_tab_helper(); | 242 controller_->GetWebContents())->infobar_tab_helper(); |
| 242 infobar_helper->AddInfoBar( | 243 infobar_helper->AddInfoBar( |
| 243 new AlternateNavInfoBarDelegate(infobar_helper, alternate_nav_url_)); | 244 new AlternateNavInfoBarDelegate(infobar_helper, alternate_nav_url_)); |
| 244 delete this; | 245 delete this; |
| 245 } | 246 } |
| OLD | NEW |