| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/intranet_redirect_detector.h" | 8 #include "chrome/browser/intranet_redirect_detector.h" |
| 9 #include "chrome/browser/profiles/profile.h" | 9 #include "chrome/browser/profiles/profile.h" |
| 10 #include "content/browser/tab_contents/navigation_controller.h" | 10 #include "content/browser/tab_contents/navigation_controller.h" |
| (...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 124 // Pretend the user typed this URL, so that navigating to | 124 // Pretend the user typed this URL, so that navigating to |
| 125 // it will be the default action when it's typed again in | 125 // it will be the default action when it's typed again in |
| 126 // the future. | 126 // the future. |
| 127 PageTransition::TYPED); | 127 PageTransition::TYPED); |
| 128 | 128 |
| 129 // We should always close, even if the navigation did not occur within this | 129 // We should always close, even if the navigation did not occur within this |
| 130 // TabContents. | 130 // TabContents. |
| 131 return true; | 131 return true; |
| 132 } | 132 } |
| 133 | 133 |
| 134 void AlternateNavURLFetcher::InfoBarClosed() { | |
| 135 delete this; | |
| 136 } | |
| 137 | |
| 138 void AlternateNavURLFetcher::SetStatusFromURLFetch( | 134 void AlternateNavURLFetcher::SetStatusFromURLFetch( |
| 139 const GURL& url, | 135 const GURL& url, |
| 140 const net::URLRequestStatus& status, | 136 const net::URLRequestStatus& status, |
| 141 int response_code) { | 137 int response_code) { |
| 142 if (!status.is_success() || | 138 if (!status.is_success() || |
| 143 // HTTP 2xx, 401, and 407 all indicate that the target address exists. | 139 // HTTP 2xx, 401, and 407 all indicate that the target address exists. |
| 144 (((response_code / 100) != 2) && | 140 (((response_code / 100) != 2) && |
| 145 (response_code != 401) && (response_code != 407)) || | 141 (response_code != 401) && (response_code != 407)) || |
| 146 // Fail if we're redirected to a common location. | 142 // Fail if we're redirected to a common location. |
| 147 // This happens for ISPs/DNS providers/etc. who return | 143 // This happens for ISPs/DNS providers/etc. who return |
| (...skipping 16 matching lines...) Expand all Loading... |
| 164 if (!navigated_to_entry_ || state_ != SUCCEEDED) { | 160 if (!navigated_to_entry_ || state_ != SUCCEEDED) { |
| 165 if (state_ == FAILED) | 161 if (state_ == FAILED) |
| 166 delete this; | 162 delete this; |
| 167 return; | 163 return; |
| 168 } | 164 } |
| 169 | 165 |
| 170 infobar_contents_ = controller_->tab_contents(); | 166 infobar_contents_ = controller_->tab_contents(); |
| 171 StoreActiveEntryUniqueID(infobar_contents_); | 167 StoreActiveEntryUniqueID(infobar_contents_); |
| 172 infobar_contents_->AddInfoBar(this); | 168 infobar_contents_->AddInfoBar(this); |
| 173 } | 169 } |
| OLD | NEW |