Index: third_party/WebKit/Source/core/frame/csp/RemoteContentSecurityPolicy.cpp |
diff --git a/third_party/WebKit/Source/core/frame/csp/RemoteContentSecurityPolicy.cpp b/third_party/WebKit/Source/core/frame/csp/RemoteContentSecurityPolicy.cpp |
new file mode 100644 |
index 0000000000000000000000000000000000000000..af21f8eafca99a62a912042e735f676415489c9e |
--- /dev/null |
+++ b/third_party/WebKit/Source/core/frame/csp/RemoteContentSecurityPolicy.cpp |
@@ -0,0 +1,52 @@ |
+// Copyright 2016 The Chromium Authors. All rights reserved. |
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+#include "core/frame/csp/RemoteContentSecurityPolicy.h" |
+ |
+#include "core/frame/RemoteFrameClient.h" |
+#include "wtf/Assertions.h" |
+#include "wtf/Compiler.h" |
+ |
+namespace blink { |
+ |
+// static |
+RemoteContentSecurityPolicy* RemoteContentSecurityPolicy::create(RemoteFrameClient* remoteFrameClient) |
+{ |
+ return new RemoteContentSecurityPolicy(remoteFrameClient); |
+} |
+ |
+RemoteContentSecurityPolicy::RemoteContentSecurityPolicy(RemoteFrameClient* remoteFrameClient) |
+ : m_remoteFrameClient(remoteFrameClient) |
+{ |
+ DCHECK(remoteFrameClient); |
+} |
+ |
+RemoteContentSecurityPolicy::~RemoteContentSecurityPolicy() {} |
+ |
+DEFINE_TRACE(RemoteContentSecurityPolicy) |
+{ |
+ visitor->trace(m_remoteFrameClient); |
+ ContentSecurityPolicy::trace(visitor); |
+} |
+ |
+void RemoteContentSecurityPolicy::reportViolation(const String& directiveText, const String& effectiveDirective, const String& consoleMessage, const KURL& blockedURL, const Vector<String>& reportEndpoints, const String& header, ViolationType violationType, LocalFrame* contextFrame, RedirectStatus redirectStatus, int contextLine) |
+{ |
+ DCHECK(violationType == URLViolation || blockedURL.isEmpty()); |
+ DCHECK(!contextFrame); |
+ |
+ // We don't want to disclose line numbers to a remote frame. |
+ ALLOW_UNUSED_LOCAL(contextLine); |
+ |
+ m_remoteFrameClient->forwardContentSecurityPolicyViolation( |
+ directiveText, |
+ effectiveDirective, |
+ consoleMessage, |
+ blockedURL, |
+ reportEndpoints, |
+ header, |
+ violationType, |
+ redirectStatus == RedirectStatus::FollowedRedirect); |
+} |
+ |
+} // namespace blink |