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

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

Issue 532773002: Implement ManifestFetcher, helper to fetch Web Manifests. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 3 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
« no previous file with comments | « no previous file | content/content_renderer.gypi » ('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/command_line.h" 9 #include "base/command_line.h"
10 #include "base/i18n/rtl.h" 10 #include "base/i18n/rtl.h"
(...skipping 246 matching lines...) Expand 10 before | Expand all | Expand 10 after
257 correction_fetcher_.reset( 257 correction_fetcher_.reset(
258 content::ResourceFetcher::Create(navigation_correction_url)); 258 content::ResourceFetcher::Create(navigation_correction_url));
259 correction_fetcher_->SetMethod("POST"); 259 correction_fetcher_->SetMethod("POST");
260 correction_fetcher_->SetBody(navigation_correction_request_body); 260 correction_fetcher_->SetBody(navigation_correction_request_body);
261 correction_fetcher_->SetHeader("Content-Type", "application/json"); 261 correction_fetcher_->SetHeader("Content-Type", "application/json");
262 262
263 correction_fetcher_->Start( 263 correction_fetcher_->Start(
264 frame, 264 frame,
265 blink::WebURLRequest::RequestContextInternal, 265 blink::WebURLRequest::RequestContextInternal,
266 blink::WebURLRequest::FrameTypeTopLevel, 266 blink::WebURLRequest::FrameTypeTopLevel,
267 content::ResourceFetcher::PLATFORM_LOADER,
267 base::Bind(&NetErrorHelper::OnNavigationCorrectionsFetched, 268 base::Bind(&NetErrorHelper::OnNavigationCorrectionsFetched,
268 base::Unretained(this))); 269 base::Unretained(this)));
269 270
270 correction_fetcher_->SetTimeout( 271 correction_fetcher_->SetTimeout(
271 base::TimeDelta::FromSeconds(kNavigationCorrectionFetchTimeoutSec)); 272 base::TimeDelta::FromSeconds(kNavigationCorrectionFetchTimeoutSec));
272 } 273 }
273 274
274 void NetErrorHelper::CancelFetchNavigationCorrections() { 275 void NetErrorHelper::CancelFetchNavigationCorrections() {
275 correction_fetcher_.reset(); 276 correction_fetcher_.reset();
276 } 277 }
277 278
278 void NetErrorHelper::SendTrackingRequest( 279 void NetErrorHelper::SendTrackingRequest(
279 const GURL& tracking_url, 280 const GURL& tracking_url,
280 const std::string& tracking_request_body) { 281 const std::string& tracking_request_body) {
281 blink::WebView* web_view = render_frame()->GetRenderView()->GetWebView(); 282 blink::WebView* web_view = render_frame()->GetRenderView()->GetWebView();
282 if (!web_view) 283 if (!web_view)
283 return; 284 return;
284 blink::WebFrame* frame = web_view->mainFrame(); 285 blink::WebFrame* frame = web_view->mainFrame();
285 286
286 // If there's already a pending tracking request, this will cancel it. 287 // If there's already a pending tracking request, this will cancel it.
287 tracking_fetcher_.reset(content::ResourceFetcher::Create(tracking_url)); 288 tracking_fetcher_.reset(content::ResourceFetcher::Create(tracking_url));
288 tracking_fetcher_->SetMethod("POST"); 289 tracking_fetcher_->SetMethod("POST");
289 tracking_fetcher_->SetBody(tracking_request_body); 290 tracking_fetcher_->SetBody(tracking_request_body);
290 tracking_fetcher_->SetHeader("Content-Type", "application/json"); 291 tracking_fetcher_->SetHeader("Content-Type", "application/json");
291 292
292 tracking_fetcher_->Start( 293 tracking_fetcher_->Start(
293 frame, 294 frame,
294 blink::WebURLRequest::RequestContextInternal, 295 blink::WebURLRequest::RequestContextInternal,
295 blink::WebURLRequest::FrameTypeTopLevel, 296 blink::WebURLRequest::FrameTypeTopLevel,
297 content::ResourceFetcher::PLATFORM_LOADER,
296 base::Bind(&NetErrorHelper::OnTrackingRequestComplete, 298 base::Bind(&NetErrorHelper::OnTrackingRequestComplete,
297 base::Unretained(this))); 299 base::Unretained(this)));
298 } 300 }
299 301
300 void NetErrorHelper::ReloadPage() { 302 void NetErrorHelper::ReloadPage() {
301 render_frame()->GetWebFrame()->reload(false); 303 render_frame()->GetWebFrame()->reload(false);
302 } 304 }
303 305
304 void NetErrorHelper::LoadPageFromCache(const GURL& page_url) { 306 void NetErrorHelper::LoadPageFromCache(const GURL& page_url) {
305 blink::WebFrame* web_frame = render_frame()->GetWebFrame(); 307 blink::WebFrame* web_frame = render_frame()->GetWebFrame();
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
341 success ? data : "", 343 success ? data : "",
342 render_frame()->GetRenderView()->GetAcceptLanguages(), 344 render_frame()->GetRenderView()->GetAcceptLanguages(),
343 base::i18n::IsRTL()); 345 base::i18n::IsRTL());
344 } 346 }
345 347
346 void NetErrorHelper::OnTrackingRequestComplete( 348 void NetErrorHelper::OnTrackingRequestComplete(
347 const blink::WebURLResponse& response, 349 const blink::WebURLResponse& response,
348 const std::string& data) { 350 const std::string& data) {
349 tracking_fetcher_.reset(); 351 tracking_fetcher_.reset();
350 } 352 }
OLDNEW
« no previous file with comments | « no previous file | content/content_renderer.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698