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

Side by Side Diff: chrome/browser/alternate_nav_url_fetcher.cc

Issue 6166010: net: Remove typedef net::URLRequestStatus URLRequestStatus; (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years, 11 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | chrome/browser/autocomplete/search_provider.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2010 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 "app/l10n_util.h" 7 #include "app/l10n_util.h"
8 #include "app/resource_bundle.h" 8 #include "app/resource_bundle.h"
9 #include "base/utf_string_conversions.h" 9 #include "base/utf_string_conversions.h"
10 #include "chrome/browser/intranet_redirect_detector.h" 10 #include "chrome/browser/intranet_redirect_detector.h"
11 #include "chrome/browser/profiles/profile.h" 11 #include "chrome/browser/profiles/profile.h"
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
79 // access the controller that will be invalid, we delete ourselves. 79 // access the controller that will be invalid, we delete ourselves.
80 // This deletes the URLFetcher and insures its callback won't be called. 80 // This deletes the URLFetcher and insures its callback won't be called.
81 delete this; 81 delete this;
82 break; 82 break;
83 83
84 default: 84 default:
85 NOTREACHED(); 85 NOTREACHED();
86 } 86 }
87 } 87 }
88 88
89 void AlternateNavURLFetcher::OnURLFetchComplete(const URLFetcher* source, 89 void AlternateNavURLFetcher::OnURLFetchComplete(
90 const GURL& url, 90 const URLFetcher* source,
91 const URLRequestStatus& status, 91 const GURL& url,
92 int response_code, 92 const net::URLRequestStatus& status,
93 const ResponseCookies& cookies, 93 int response_code,
94 const std::string& data) { 94 const ResponseCookies& cookies,
95 const std::string& data) {
95 DCHECK(fetcher_.get() == source); 96 DCHECK(fetcher_.get() == source);
96 SetStatusFromURLFetch(url, status, response_code); 97 SetStatusFromURLFetch(url, status, response_code);
97 ShowInfobarIfPossible(); 98 ShowInfobarIfPossible();
98 } 99 }
99 100
100 string16 AlternateNavURLFetcher::GetMessageTextWithOffset( 101 string16 AlternateNavURLFetcher::GetMessageTextWithOffset(
101 size_t* link_offset) const { 102 size_t* link_offset) const {
102 const string16 label = l10n_util::GetStringFUTF16( 103 const string16 label = l10n_util::GetStringFUTF16(
103 IDS_ALTERNATE_NAV_URL_VIEW_LABEL, string16(), link_offset); 104 IDS_ALTERNATE_NAV_URL_VIEW_LABEL, string16(), link_offset);
104 DCHECK(*link_offset != string16::npos); 105 DCHECK(*link_offset != string16::npos);
(...skipping 21 matching lines...) Expand all
126 // TabContents. 127 // TabContents.
127 return true; 128 return true;
128 } 129 }
129 130
130 void AlternateNavURLFetcher::InfoBarClosed() { 131 void AlternateNavURLFetcher::InfoBarClosed() {
131 delete this; 132 delete this;
132 } 133 }
133 134
134 void AlternateNavURLFetcher::SetStatusFromURLFetch( 135 void AlternateNavURLFetcher::SetStatusFromURLFetch(
135 const GURL& url, 136 const GURL& url,
136 const URLRequestStatus& status, 137 const net::URLRequestStatus& status,
137 int response_code) { 138 int response_code) {
138 if (!status.is_success() || 139 if (!status.is_success() ||
139 // HTTP 2xx, 401, and 407 all indicate that the target address exists. 140 // HTTP 2xx, 401, and 407 all indicate that the target address exists.
140 (((response_code / 100) != 2) && 141 (((response_code / 100) != 2) &&
141 (response_code != 401) && (response_code != 407)) || 142 (response_code != 401) && (response_code != 407)) ||
142 // Fail if we're redirected to a common location. 143 // Fail if we're redirected to a common location.
143 // This happens for ISPs/DNS providers/etc. who return 144 // This happens for ISPs/DNS providers/etc. who return
144 // provider-controlled pages to arbitrary user navigation attempts. 145 // provider-controlled pages to arbitrary user navigation attempts.
145 // Because this can result in infobars on large fractions of user 146 // Because this can result in infobars on large fractions of user
146 // searches, we don't show automatic infobars for these. Note that users 147 // searches, we don't show automatic infobars for these. Note that users
(...skipping 14 matching lines...) Expand all
161 if (state_ == FAILED) 162 if (state_ == FAILED)
162 delete this; 163 delete this;
163 return; 164 return;
164 } 165 }
165 166
166 infobar_contents_ = controller_->tab_contents(); 167 infobar_contents_ = controller_->tab_contents();
167 StoreActiveEntryUniqueID(infobar_contents_); 168 StoreActiveEntryUniqueID(infobar_contents_);
168 // We will be deleted when the InfoBar is destroyed. (See InfoBarClosed). 169 // We will be deleted when the InfoBar is destroyed. (See InfoBarClosed).
169 infobar_contents_->AddInfoBar(this); 170 infobar_contents_->AddInfoBar(this);
170 } 171 }
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/autocomplete/search_provider.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698