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

Side by Side Diff: Source/core/loader/PingLoader.cpp

Issue 1311923004: Rename FormData/FormDataBuilder to EncodedFormData/FormDataEncoder respectively. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: update comments Created 5 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 | Annotate | Revision Log
« no previous file with comments | « Source/core/loader/PingLoader.h ('k') | Source/core/xmlhttprequest/XMLHttpRequest.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 /* 1 /*
2 * Copyright (C) 2010 Google Inc. All rights reserved. 2 * Copyright (C) 2010 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
81 initiatorInfo.name = FetchInitiatorTypeNames::ping; 81 initiatorInfo.name = FetchInitiatorTypeNames::ping;
82 PingLoader::start(frame, request, initiatorInfo); 82 PingLoader::start(frame, request, initiatorInfo);
83 } 83 }
84 84
85 // http://www.whatwg.org/specs/web-apps/current-work/multipage/links.html#hyperl ink-auditing 85 // http://www.whatwg.org/specs/web-apps/current-work/multipage/links.html#hyperl ink-auditing
86 void PingLoader::sendLinkAuditPing(LocalFrame* frame, const KURL& pingURL, const KURL& destinationURL) 86 void PingLoader::sendLinkAuditPing(LocalFrame* frame, const KURL& pingURL, const KURL& destinationURL)
87 { 87 {
88 ResourceRequest request(pingURL); 88 ResourceRequest request(pingURL);
89 request.setHTTPMethod("POST"); 89 request.setHTTPMethod("POST");
90 request.setHTTPContentType("text/ping"); 90 request.setHTTPContentType("text/ping");
91 request.setHTTPBody(FormData::create("PING")); 91 request.setHTTPBody(EncodedFormData::create("PING"));
92 request.setHTTPHeaderField("Cache-Control", "max-age=0"); 92 request.setHTTPHeaderField("Cache-Control", "max-age=0");
93 finishPingRequestInitialization(request, frame); 93 finishPingRequestInitialization(request, frame);
94 94
95 RefPtr<SecurityOrigin> pingOrigin = SecurityOrigin::create(pingURL); 95 RefPtr<SecurityOrigin> pingOrigin = SecurityOrigin::create(pingURL);
96 // addAdditionalRequestHeaders() will have added a referrer for same origin requests, 96 // addAdditionalRequestHeaders() will have added a referrer for same origin requests,
97 // but the spec omits the referrer for same origin. 97 // but the spec omits the referrer for same origin.
98 if (frame->document()->securityOrigin()->isSameSchemeHostPort(pingOrigin.get ())) 98 if (frame->document()->securityOrigin()->isSameSchemeHostPort(pingOrigin.get ()))
99 request.clearHTTPReferrer(); 99 request.clearHTTPReferrer();
100 100
101 request.setHTTPHeaderField("Ping-To", AtomicString(destinationURL.string())) ; 101 request.setHTTPHeaderField("Ping-To", AtomicString(destinationURL.string())) ;
102 102
103 // Ping-From follows the same rules as the default referrer beahavior for su bresource requests. 103 // Ping-From follows the same rules as the default referrer beahavior for su bresource requests.
104 // FIXME: Should Ping-From obey ReferrerPolicy? 104 // FIXME: Should Ping-From obey ReferrerPolicy?
105 if (!SecurityPolicy::shouldHideReferrer(pingURL, frame->document()->url().st ring())) 105 if (!SecurityPolicy::shouldHideReferrer(pingURL, frame->document()->url().st ring()))
106 request.setHTTPHeaderField("Ping-From", AtomicString(frame->document()-> url().string())); 106 request.setHTTPHeaderField("Ping-From", AtomicString(frame->document()-> url().string()));
107 107
108 FetchInitiatorInfo initiatorInfo; 108 FetchInitiatorInfo initiatorInfo;
109 initiatorInfo.name = FetchInitiatorTypeNames::ping; 109 initiatorInfo.name = FetchInitiatorTypeNames::ping;
110 PingLoader::start(frame, request, initiatorInfo); 110 PingLoader::start(frame, request, initiatorInfo);
111 } 111 }
112 112
113 void PingLoader::sendViolationReport(LocalFrame* frame, const KURL& reportURL, P assRefPtr<FormData> report, ViolationReportType type) 113 void PingLoader::sendViolationReport(LocalFrame* frame, const KURL& reportURL, P assRefPtr<EncodedFormData> report, ViolationReportType type)
114 { 114 {
115 ResourceRequest request(reportURL); 115 ResourceRequest request(reportURL);
116 request.setHTTPMethod("POST"); 116 request.setHTTPMethod("POST");
117 request.setHTTPContentType(type == ContentSecurityPolicyViolationReport ? "a pplication/csp-report" : "application/json"); 117 request.setHTTPContentType(type == ContentSecurityPolicyViolationReport ? "a pplication/csp-report" : "application/json");
118 request.setHTTPBody(report); 118 request.setHTTPBody(report);
119 finishPingRequestInitialization(request, frame); 119 finishPingRequestInitialization(request, frame);
120 120
121 FetchInitiatorInfo initiatorInfo; 121 FetchInitiatorInfo initiatorInfo;
122 initiatorInfo.name = FetchInitiatorTypeNames::violationreport; 122 initiatorInfo.name = FetchInitiatorTypeNames::violationreport;
123 PingLoader::start(frame, request, initiatorInfo, SecurityOrigin::create(repo rtURL)->isSameSchemeHostPort(frame->document()->securityOrigin()) ? AllowStoredC redentials : DoNotAllowStoredCredentials); 123 PingLoader::start(frame, request, initiatorInfo, SecurityOrigin::create(repo rtURL)->isSameSchemeHostPort(frame->document()->securityOrigin()) ? AllowStoredC redentials : DoNotAllowStoredCredentials);
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
222 InspectorInstrumentation::didFailLoading(frame, m_identifier, ResourceError: :cancelledError(m_url)); 222 InspectorInstrumentation::didFailLoading(frame, m_identifier, ResourceError: :cancelledError(m_url));
223 frame->console().didFailLoading(m_identifier, ResourceError::cancelledError( m_url)); 223 frame->console().didFailLoading(m_identifier, ResourceError::cancelledError( m_url));
224 } 224 }
225 225
226 DEFINE_TRACE(PingLoader) 226 DEFINE_TRACE(PingLoader)
227 { 227 {
228 LocalFrameLifecycleObserver::trace(visitor); 228 LocalFrameLifecycleObserver::trace(visitor);
229 } 229 }
230 230
231 } // namespace blink 231 } // namespace blink
OLDNEW
« no previous file with comments | « Source/core/loader/PingLoader.h ('k') | Source/core/xmlhttprequest/XMLHttpRequest.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698