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

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

Issue 650023003: Make generateReferrerHeader() return a Referrer instead of a String (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 2 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/frame/RemoteFrame.cpp ('k') | Source/core/loader/FrameLoader.cpp » ('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) 2013 Google Inc. All rights reserved. 2 * Copyright (C) 2013 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 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
66 if (request.httpReferrer().isNull()) { 66 if (request.httpReferrer().isNull()) {
67 outgoingReferrer = document->outgoingReferrer(); 67 outgoingReferrer = document->outgoingReferrer();
68 referrerPolicy = document->referrerPolicy(); 68 referrerPolicy = document->referrerPolicy();
69 outgoingOrigin = document->outgoingOrigin(); 69 outgoingOrigin = document->outgoingOrigin();
70 } else { 70 } else {
71 outgoingReferrer = request.httpReferrer(); 71 outgoingReferrer = request.httpReferrer();
72 referrerPolicy = request.referrerPolicy(); 72 referrerPolicy = request.referrerPolicy();
73 outgoingOrigin = SecurityOrigin::createFromString(outgoingReferrer)- >toString(); 73 outgoingOrigin = SecurityOrigin::createFromString(outgoingReferrer)- >toString();
74 } 74 }
75 75
76 outgoingReferrer = SecurityPolicy::generateReferrerHeader(referrerPolicy , request.url(), outgoingReferrer); 76 request.setHTTPReferrer(SecurityPolicy::generateReferrer(referrerPolicy, request.url(), outgoingReferrer));
77 if (outgoingReferrer.isEmpty())
78 request.clearHTTPReferrer();
79 else
80 request.setHTTPReferrer(Referrer(outgoingReferrer, referrerPolicy));
81
82 request.addHTTPOriginIfNeeded(AtomicString(outgoingOrigin)); 77 request.addHTTPOriginIfNeeded(AtomicString(outgoingOrigin));
83 } 78 }
84 79
85 // The remaining modifications are only necessary for HTTP and HTTPS. 80 // The remaining modifications are only necessary for HTTP and HTTPS.
86 if (!request.url().isEmpty() && !request.url().protocolIsInHTTPFamily()) 81 if (!request.url().isEmpty() && !request.url().protocolIsInHTTPFamily())
87 return; 82 return;
88 83
89 m_frame->loader().applyUserAgent(request); 84 m_frame->loader().applyUserAgent(request);
90 } 85 }
91 86
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after
209 dispatchDidFinishLoading(ensureLoader(loader), identifier, 0, 0); 204 dispatchDidFinishLoading(ensureLoader(loader), identifier, 0, 0);
210 } 205 }
211 206
212 void FrameFetchContext::trace(Visitor* visitor) 207 void FrameFetchContext::trace(Visitor* visitor)
213 { 208 {
214 visitor->trace(m_frame); 209 visitor->trace(m_frame);
215 FetchContext::trace(visitor); 210 FetchContext::trace(visitor);
216 } 211 }
217 212
218 } // namespace blink 213 } // namespace blink
OLDNEW
« no previous file with comments | « Source/core/frame/RemoteFrame.cpp ('k') | Source/core/loader/FrameLoader.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698