OLD | NEW |
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 | 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 10 matching lines...) Expand all Loading... |
21 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | 21 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
22 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH | 22 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH |
23 * DAMAGE. | 23 * DAMAGE. |
24 */ | 24 */ |
25 | 25 |
26 #ifndef SecurityPolicyViolationEvent_h | 26 #ifndef SecurityPolicyViolationEvent_h |
27 #define SecurityPolicyViolationEvent_h | 27 #define SecurityPolicyViolationEvent_h |
28 | 28 |
29 #include "core/events/Event.h" | 29 #include "core/events/Event.h" |
30 #include "core/events/SecurityPolicyViolationEventInit.h" | 30 #include "core/events/SecurityPolicyViolationEventInit.h" |
| 31 #include "platform/network/ContentSecurityPolicyParsers.h" |
31 | 32 |
32 namespace blink { | 33 namespace blink { |
33 | 34 |
34 class SecurityPolicyViolationEvent final : public Event { | 35 class SecurityPolicyViolationEvent final : public Event { |
35 DEFINE_WRAPPERTYPEINFO(); | 36 DEFINE_WRAPPERTYPEINFO(); |
36 | 37 |
37 public: | 38 public: |
38 static SecurityPolicyViolationEvent* create( | 39 static SecurityPolicyViolationEvent* create( |
39 const AtomicString& type, | 40 const AtomicString& type, |
40 const SecurityPolicyViolationEventInit& initializer) { | 41 const SecurityPolicyViolationEventInit& initializer) { |
41 return new SecurityPolicyViolationEvent(type, initializer); | 42 return new SecurityPolicyViolationEvent(type, initializer); |
42 } | 43 } |
43 | 44 |
44 const String& documentURI() const { return m_documentURI; } | 45 const String& documentURI() const { return m_documentURI; } |
45 const String& referrer() const { return m_referrer; } | 46 const String& referrer() const { return m_referrer; } |
46 const String& blockedURI() const { return m_blockedURI; } | 47 const String& blockedURI() const { return m_blockedURI; } |
47 const String& violatedDirective() const { return m_violatedDirective; } | 48 const String& violatedDirective() const { return m_violatedDirective; } |
48 const String& effectiveDirective() const { return m_effectiveDirective; } | 49 const String& effectiveDirective() const { return m_effectiveDirective; } |
49 const String& originalPolicy() const { return m_originalPolicy; } | 50 const String& originalPolicy() const { return m_originalPolicy; } |
| 51 const String& disposition() const; |
50 const String& sourceFile() const { return m_sourceFile; } | 52 const String& sourceFile() const { return m_sourceFile; } |
51 int lineNumber() const { return m_lineNumber; } | 53 int lineNumber() const { return m_lineNumber; } |
52 int columnNumber() const { return m_columnNumber; } | 54 int columnNumber() const { return m_columnNumber; } |
53 uint16_t statusCode() const { return m_statusCode; } | 55 uint16_t statusCode() const { return m_statusCode; } |
54 | 56 |
55 const AtomicString& interfaceName() const override { | 57 const AtomicString& interfaceName() const override { |
56 return EventNames::SecurityPolicyViolationEvent; | 58 return EventNames::SecurityPolicyViolationEvent; |
57 } | 59 } |
58 | 60 |
59 DEFINE_INLINE_VIRTUAL_TRACE() { Event::trace(visitor); } | 61 DEFINE_INLINE_VIRTUAL_TRACE() { Event::trace(visitor); } |
60 | 62 |
61 private: | 63 private: |
62 SecurityPolicyViolationEvent( | 64 SecurityPolicyViolationEvent( |
63 const AtomicString& type, | 65 const AtomicString& type, |
64 const SecurityPolicyViolationEventInit& initializer) | 66 const SecurityPolicyViolationEventInit& initializer); |
65 : Event(type, initializer), | |
66 m_lineNumber(0), | |
67 m_columnNumber(0), | |
68 m_statusCode(0) { | |
69 if (initializer.hasDocumentURI()) | |
70 m_documentURI = initializer.documentURI(); | |
71 if (initializer.hasReferrer()) | |
72 m_referrer = initializer.referrer(); | |
73 if (initializer.hasBlockedURI()) | |
74 m_blockedURI = initializer.blockedURI(); | |
75 if (initializer.hasViolatedDirective()) | |
76 m_violatedDirective = initializer.violatedDirective(); | |
77 if (initializer.hasEffectiveDirective()) | |
78 m_effectiveDirective = initializer.effectiveDirective(); | |
79 if (initializer.hasOriginalPolicy()) | |
80 m_originalPolicy = initializer.originalPolicy(); | |
81 if (initializer.hasSourceFile()) | |
82 m_sourceFile = initializer.sourceFile(); | |
83 if (initializer.hasLineNumber()) | |
84 m_lineNumber = initializer.lineNumber(); | |
85 if (initializer.hasColumnNumber()) | |
86 m_columnNumber = initializer.columnNumber(); | |
87 if (initializer.hasStatusCode()) | |
88 m_statusCode = initializer.statusCode(); | |
89 } | |
90 | 67 |
91 String m_documentURI; | 68 String m_documentURI; |
92 String m_referrer; | 69 String m_referrer; |
93 String m_blockedURI; | 70 String m_blockedURI; |
94 String m_violatedDirective; | 71 String m_violatedDirective; |
95 String m_effectiveDirective; | 72 String m_effectiveDirective; |
96 String m_originalPolicy; | 73 String m_originalPolicy; |
| 74 ContentSecurityPolicyHeaderType m_disposition; |
97 String m_sourceFile; | 75 String m_sourceFile; |
98 int m_lineNumber; | 76 int m_lineNumber; |
99 int m_columnNumber; | 77 int m_columnNumber; |
100 int m_statusCode; | 78 int m_statusCode; |
101 }; | 79 }; |
102 | 80 |
103 } // namespace blink | 81 } // namespace blink |
104 | 82 |
105 #endif // SecurityPolicyViolationEvent_h | 83 #endif // SecurityPolicyViolationEvent_h |
OLD | NEW |