Torne (Richard Coles) | 53e740f | 2013-05-09 18:38:43 +0100 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2013 Google Inc. All rights reserved. |
| 3 | * |
| 4 | * Redistribution and use in source and binary forms, with or without |
| 5 | * modification, are permitted provided that the following conditions |
| 6 | * are met: |
| 7 | * 1. Redistributions of source code must retain the above copyright |
| 8 | * notice, this list of conditions and the following disclaimer. |
| 9 | * 2. Redistributions in binary form must reproduce the above copyright |
| 10 | * notice, this list of conditions and the following disclaimer in the |
| 11 | * documentation and/or other materials provided with the distribution. |
| 12 | * |
| 13 | * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND ANY |
| 14 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED |
| 15 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
| 16 | * DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY |
| 17 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES |
| 18 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; |
| 19 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON |
| 20 | * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 21 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS |
| 22 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 23 | */ |
| 24 | |
| 25 | #ifndef SecurityPolicyViolationEvent_h |
| 26 | #define SecurityPolicyViolationEvent_h |
| 27 | |
| 28 | #include "core/dom/Event.h" |
| 29 | #include "core/dom/EventNames.h" |
| 30 | |
| 31 | namespace WebCore { |
| 32 | |
| 33 | struct SecurityPolicyViolationEventInit : public EventInit { |
| 34 | SecurityPolicyViolationEventInit() |
| 35 | { |
| 36 | } |
| 37 | |
| 38 | String documentURI; |
| 39 | String referrer; |
| 40 | String blockedURI; |
| 41 | String violatedDirective; |
| 42 | String effectiveDirective; |
| 43 | String originalPolicy; |
| 44 | String sourceFile; |
| 45 | int lineNumber; |
| 46 | int columnNumber; |
Ben Murdoch | e69819b | 2013-07-17 14:56:49 +0100 | [diff] [blame] | 47 | int statusCode; |
Torne (Richard Coles) | 53e740f | 2013-05-09 18:38:43 +0100 | [diff] [blame] | 48 | }; |
| 49 | |
| 50 | class SecurityPolicyViolationEvent : public Event { |
| 51 | public: |
| 52 | static PassRefPtr<SecurityPolicyViolationEvent> create() |
| 53 | { |
| 54 | return adoptRef(new SecurityPolicyViolationEvent()); |
| 55 | } |
| 56 | |
| 57 | static PassRefPtr<SecurityPolicyViolationEvent> create(const AtomicString& type, const SecurityPolicyViolationEventInit& initializer) |
| 58 | { |
| 59 | return adoptRef(new SecurityPolicyViolationEvent(type, initializer)); |
| 60 | } |
| 61 | |
| 62 | const String& documentURI() const { return m_documentURI; } |
| 63 | const String& referrer() const { return m_referrer; } |
| 64 | const String& blockedURI() const { return m_blockedURI; } |
| 65 | const String& violatedDirective() const { return m_violatedDirective; } |
| 66 | const String& effectiveDirective() const { return m_effectiveDirective; } |
| 67 | const String& originalPolicy() const { return m_originalPolicy; } |
| 68 | const String& sourceFile() const { return m_sourceFile; } |
| 69 | int lineNumber() const { return m_lineNumber; } |
| 70 | int columnNumber() const { return m_columnNumber; } |
Ben Murdoch | e69819b | 2013-07-17 14:56:49 +0100 | [diff] [blame] | 71 | int statusCode() const { return m_statusCode; } |
Torne (Richard Coles) | 53e740f | 2013-05-09 18:38:43 +0100 | [diff] [blame] | 72 | |
| 73 | virtual const AtomicString& interfaceName() const { return eventNames().interfaceForSecurityPolicyViolationEvent; } |
| 74 | |
| 75 | private: |
| 76 | SecurityPolicyViolationEvent() |
| 77 | { |
| 78 | ScriptWrappable::init(this); |
| 79 | } |
| 80 | |
| 81 | SecurityPolicyViolationEvent(const AtomicString& type, const SecurityPolicyViolationEventInit& initializer) |
| 82 | : Event(type, initializer) |
| 83 | , m_documentURI(initializer.documentURI) |
| 84 | , m_referrer(initializer.referrer) |
| 85 | , m_blockedURI(initializer.blockedURI) |
| 86 | , m_violatedDirective(initializer.violatedDirective) |
| 87 | , m_effectiveDirective(initializer.effectiveDirective) |
| 88 | , m_originalPolicy(initializer.originalPolicy) |
| 89 | , m_sourceFile(initializer.sourceFile) |
| 90 | , m_lineNumber(initializer.lineNumber) |
| 91 | , m_columnNumber(initializer.columnNumber) |
Ben Murdoch | e69819b | 2013-07-17 14:56:49 +0100 | [diff] [blame] | 92 | , m_statusCode(initializer.statusCode) |
Torne (Richard Coles) | 53e740f | 2013-05-09 18:38:43 +0100 | [diff] [blame] | 93 | { |
| 94 | ScriptWrappable::init(this); |
| 95 | } |
| 96 | |
| 97 | String m_documentURI; |
| 98 | String m_referrer; |
| 99 | String m_blockedURI; |
| 100 | String m_violatedDirective; |
| 101 | String m_effectiveDirective; |
| 102 | String m_originalPolicy; |
| 103 | String m_sourceFile; |
| 104 | int m_lineNumber; |
| 105 | int m_columnNumber; |
Ben Murdoch | e69819b | 2013-07-17 14:56:49 +0100 | [diff] [blame] | 106 | int m_statusCode; |
Torne (Richard Coles) | 53e740f | 2013-05-09 18:38:43 +0100 | [diff] [blame] | 107 | }; |
| 108 | |
| 109 | } // namespace WebCore |
| 110 | |
| 111 | #endif // SecurityPolicyViolationEvent_h |