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

Side by Side Diff: chrome/renderer/net/net_error_helper.cc

Issue 140823010: ResourceFetcher: Add POST support and the ability to set headers (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Gack Created 6 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 | content/public/renderer/resource_fetcher.h » ('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) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 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/renderer/net/net_error_helper.h" 5 #include "chrome/renderer/net/net_error_helper.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "base/json/json_writer.h" 9 #include "base/json/json_writer.h"
10 #include "base/metrics/histogram.h" 10 #include "base/metrics/histogram.h"
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after
166 } 166 }
167 167
168 void NetErrorHelper::FetchErrorPage(const GURL& url) { 168 void NetErrorHelper::FetchErrorPage(const GURL& url) {
169 DCHECK(!alt_error_page_fetcher_.get()); 169 DCHECK(!alt_error_page_fetcher_.get());
170 170
171 blink::WebView* web_view = render_view()->GetWebView(); 171 blink::WebView* web_view = render_view()->GetWebView();
172 if (!web_view) 172 if (!web_view)
173 return; 173 return;
174 blink::WebFrame* frame = web_view->mainFrame(); 174 blink::WebFrame* frame = web_view->mainFrame();
175 175
176 alt_error_page_fetcher_.reset( 176 alt_error_page_fetcher_.reset(content::ResourceFetcher::Create(url));
177 content::ResourceFetcher::Create( 177
178 url, frame, blink::WebURLRequest::TargetIsMainFrame, 178 alt_error_page_fetcher_->Start(
179 base::Bind(&NetErrorHelper::OnAlternateErrorPageRetrieved, 179 frame, blink::WebURLRequest::TargetIsMainFrame,
180 base::Unretained(this)))); 180 base::Bind(&NetErrorHelper::OnAlternateErrorPageRetrieved,
181 base::Unretained(this)));
181 182
182 alt_error_page_fetcher_->SetTimeout( 183 alt_error_page_fetcher_->SetTimeout(
183 base::TimeDelta::FromSeconds(kAlterErrorPageFetchTimeoutSec)); 184 base::TimeDelta::FromSeconds(kAlterErrorPageFetchTimeoutSec));
184 } 185 }
185 186
186 void NetErrorHelper::CancelFetchErrorPage() { 187 void NetErrorHelper::CancelFetchErrorPage() {
187 alt_error_page_fetcher_.reset(); 188 alt_error_page_fetcher_.reset();
188 } 189 }
189 190
190 void NetErrorHelper::OnNetErrorInfo(int status_num) { 191 void NetErrorHelper::OnNetErrorInfo(int status_num) {
(...skipping 14 matching lines...) Expand all
205 // The fetcher may only be deleted after |data| is passed to |core_|. Move 206 // The fetcher may only be deleted after |data| is passed to |core_|. Move
206 // it to a temporary to prevent any potential re-entrancy issues. 207 // it to a temporary to prevent any potential re-entrancy issues.
207 scoped_ptr<content::ResourceFetcher> fetcher( 208 scoped_ptr<content::ResourceFetcher> fetcher(
208 alt_error_page_fetcher_.release()); 209 alt_error_page_fetcher_.release());
209 if (!response.isNull() && response.httpStatusCode() == 200) { 210 if (!response.isNull() && response.httpStatusCode() == 200) {
210 core_.OnAlternateErrorPageFetched(data); 211 core_.OnAlternateErrorPageFetched(data);
211 } else { 212 } else {
212 core_.OnAlternateErrorPageFetched(""); 213 core_.OnAlternateErrorPageFetched("");
213 } 214 }
214 } 215 }
OLDNEW
« no previous file with comments | « no previous file | content/public/renderer/resource_fetcher.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698