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

Side by Side Diff: Source/core/frame/csp/ContentSecurityPolicy.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 | « no previous file | Source/core/html/FormDataList.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) 2011 Google, Inc. All rights reserved. 2 * Copyright (C) 2011 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 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 1. Redistributions of source code must retain the above copyright 7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright 9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
43 #include "core/inspector/ConsoleMessage.h" 43 #include "core/inspector/ConsoleMessage.h"
44 #include "core/inspector/InspectorInstrumentation.h" 44 #include "core/inspector/InspectorInstrumentation.h"
45 #include "core/inspector/ScriptCallStack.h" 45 #include "core/inspector/ScriptCallStack.h"
46 #include "core/loader/DocumentLoader.h" 46 #include "core/loader/DocumentLoader.h"
47 #include "core/loader/PingLoader.h" 47 #include "core/loader/PingLoader.h"
48 #include "platform/JSONValues.h" 48 #include "platform/JSONValues.h"
49 #include "platform/ParsingUtilities.h" 49 #include "platform/ParsingUtilities.h"
50 #include "platform/RuntimeEnabledFeatures.h" 50 #include "platform/RuntimeEnabledFeatures.h"
51 #include "platform/network/ContentSecurityPolicyParsers.h" 51 #include "platform/network/ContentSecurityPolicyParsers.h"
52 #include "platform/network/ContentSecurityPolicyResponseHeaders.h" 52 #include "platform/network/ContentSecurityPolicyResponseHeaders.h"
53 #include "platform/network/FormData.h" 53 #include "platform/network/EncodedFormData.h"
54 #include "platform/network/ResourceRequest.h" 54 #include "platform/network/ResourceRequest.h"
55 #include "platform/network/ResourceResponse.h" 55 #include "platform/network/ResourceResponse.h"
56 #include "platform/weborigin/KURL.h" 56 #include "platform/weborigin/KURL.h"
57 #include "platform/weborigin/KnownPorts.h" 57 #include "platform/weborigin/KnownPorts.h"
58 #include "platform/weborigin/SchemeRegistry.h" 58 #include "platform/weborigin/SchemeRegistry.h"
59 #include "platform/weborigin/SecurityOrigin.h" 59 #include "platform/weborigin/SecurityOrigin.h"
60 #include "public/platform/Platform.h" 60 #include "public/platform/Platform.h"
61 #include "public/platform/WebURLRequest.h" 61 #include "public/platform/WebURLRequest.h"
62 #include "wtf/StringHasher.h" 62 #include "wtf/StringHasher.h"
63 #include "wtf/text/StringBuilder.h" 63 #include "wtf/text/StringBuilder.h"
(...skipping 703 matching lines...) Expand 10 before | Expand all | Expand 10 after
767 } 767 }
768 cspReport->setNumber("status-code", violationData.statusCode()); 768 cspReport->setNumber("status-code", violationData.statusCode());
769 769
770 RefPtr<JSONObject> reportObject = JSONObject::create(); 770 RefPtr<JSONObject> reportObject = JSONObject::create();
771 reportObject->setObject("csp-report", cspReport.release()); 771 reportObject->setObject("csp-report", cspReport.release());
772 String stringifiedReport = reportObject->toJSONString(); 772 String stringifiedReport = reportObject->toJSONString();
773 773
774 if (!shouldSendViolationReport(stringifiedReport)) 774 if (!shouldSendViolationReport(stringifiedReport))
775 return; 775 return;
776 776
777 RefPtr<FormData> report = FormData::create(stringifiedReport.utf8()); 777 RefPtr<EncodedFormData> report = EncodedFormData::create(stringifiedReport.u tf8());
778 778
779 for (const String& endpoint : reportEndpoints) { 779 for (const String& endpoint : reportEndpoints) {
780 // If we have a context frame we're dealing with 'frame-ancestors' and w e don't have our 780 // If we have a context frame we're dealing with 'frame-ancestors' and w e don't have our
781 // own execution context. Use the frame's document to complete the endpo int URL, overriding 781 // own execution context. Use the frame's document to complete the endpo int URL, overriding
782 // its URL with the blocked document's URL. 782 // its URL with the blocked document's URL.
783 ASSERT(!contextFrame || !m_executionContext); 783 ASSERT(!contextFrame || !m_executionContext);
784 ASSERT(!contextFrame || equalIgnoringCase(effectiveDirective, FrameAnces tors)); 784 ASSERT(!contextFrame || equalIgnoringCase(effectiveDirective, FrameAnces tors));
785 KURL url = contextFrame ? frame->document()->completeURLWithOverride(end point, blockedURL) : completeURL(endpoint); 785 KURL url = contextFrame ? frame->document()->completeURLWithOverride(end point, blockedURL) : completeURL(endpoint);
786 PingLoader::sendViolationReport(frame, url, report, PingLoader::ContentS ecurityPolicyViolationReport); 786 PingLoader::sendViolationReport(frame, url, report, PingLoader::ContentS ecurityPolicyViolationReport);
787 } 787 }
(...skipping 220 matching lines...) Expand 10 before | Expand all | Expand 10 after
1008 // Collisions have no security impact, so we can save space by storing only the string's hash rather than the whole report. 1008 // Collisions have no security impact, so we can save space by storing only the string's hash rather than the whole report.
1009 return !m_violationReportsSent.contains(report.impl()->hash()); 1009 return !m_violationReportsSent.contains(report.impl()->hash());
1010 } 1010 }
1011 1011
1012 void ContentSecurityPolicy::didSendViolationReport(const String& report) 1012 void ContentSecurityPolicy::didSendViolationReport(const String& report)
1013 { 1013 {
1014 m_violationReportsSent.add(report.impl()->hash()); 1014 m_violationReportsSent.add(report.impl()->hash());
1015 } 1015 }
1016 1016
1017 } // namespace blink 1017 } // namespace blink
OLDNEW
« no previous file with comments | « no previous file | Source/core/html/FormDataList.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698