| 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 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 10 matching lines...) Expand all Loading... |
| 21 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT | 21 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT |
| 22 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | 22 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
| 23 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | 23 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
| 24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | 24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
| 25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | 25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
| 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 29 */ | 29 */ |
| 30 | 30 |
| 31 #ifndef LinkResource_h | 31 #ifndef ExceptionStatePlaceholder_h |
| 32 #define LinkResource_h | 32 #define ExceptionStatePlaceholder_h |
| 33 | 33 |
| 34 #include "core/loader/cache/CachedResourceRequest.h" | 34 #include "bindings/v8/ExceptionState.h" |
| 35 #include "weborigin/KURL.h" | 35 #include "wtf/Assertions.h" |
| 36 #include "wtf/RefCounted.h" | |
| 37 #include "wtf/text/WTFString.h" | |
| 38 | 36 |
| 39 namespace WebCore { | 37 namespace WebCore { |
| 40 | 38 |
| 41 class HTMLLinkElement; | 39 class ExceptionState; |
| 42 | 40 |
| 43 class LinkResource : public RefCounted<LinkResource> { | 41 class IgnorableExceptionState : public ExceptionState { |
| 44 public: | 42 public: |
| 45 enum Type { | 43 IgnorableExceptionState(); |
| 46 Style, | 44 ExceptionState& returnThis() { return *this; } |
| 47 Import | 45 virtual void throwDOMException(const ExceptionCode&, const char* = 0) OVERRI
DE; |
| 48 }; | |
| 49 | |
| 50 explicit LinkResource(HTMLLinkElement*); | |
| 51 virtual ~LinkResource(); | |
| 52 | |
| 53 virtual Type type() const = 0; | |
| 54 virtual void process() = 0; | |
| 55 virtual void ownerRemoved() = 0; | |
| 56 | |
| 57 protected: | |
| 58 HTMLLinkElement* m_owner; | |
| 59 }; | 46 }; |
| 60 | 47 |
| 61 class LinkRequestBuilder { | 48 #define IGNORE_EXCEPTION_STATE (::WebCore::IgnorableExceptionState().returnThis(
)) |
| 49 |
| 50 #if ASSERT_DISABLED |
| 51 |
| 52 #define ASSERT_NO_EXCEPTION_STATE (::WebCore::IgnorableExceptionState().returnTh
is()) |
| 53 |
| 54 #else |
| 55 |
| 56 class NoExceptionStateAssertionChecker : public ExceptionState { |
| 62 public: | 57 public: |
| 63 explicit LinkRequestBuilder(HTMLLinkElement* owner); | 58 NoExceptionStateAssertionChecker(const char* file, int line); |
| 64 | 59 ExceptionState& returnThis() { return *this; } |
| 65 bool isValid() const { return !m_url.isEmpty() && m_url.isValid(); } | 60 virtual void throwDOMException(const ExceptionCode&) OVERRIDE; |
| 66 const KURL& url() const { return m_url; } | |
| 67 const String& charset() const { return m_charset; } | |
| 68 CachedResourceRequest build(bool blocking) const; | |
| 69 | 61 |
| 70 private: | 62 private: |
| 71 HTMLLinkElement* m_owner; | 63 const char* m_file; |
| 72 KURL m_url; | 64 int m_line; |
| 73 String m_charset; | |
| 74 }; | 65 }; |
| 75 | 66 |
| 67 #define ASSERT_NO_EXCEPTION_STATE (::WebCore::NoExceptionStateAssertionChecker(_
_FILE__, __LINE__).returnThis()) |
| 68 |
| 69 #endif |
| 70 |
| 76 } // namespace WebCore | 71 } // namespace WebCore |
| 77 | 72 |
| 78 #endif // LinkResource_h | 73 #endif // ExceptionStatePlaceholder_h |
| OLD | NEW |