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 14 matching lines...) Expand all Loading... |
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 LinkResource_h |
32 #define LinkResource_h | 32 #define LinkResource_h |
33 | 33 |
34 #include "core/CoreExport.h" | 34 #include "core/CoreExport.h" |
35 #include "core/fetch/FetchRequest.h" | |
36 #include "platform/heap/Handle.h" | 35 #include "platform/heap/Handle.h" |
37 #include "platform/weborigin/KURL.h" | |
38 #include "wtf/text/WTFString.h" | |
39 | 36 |
40 namespace blink { | 37 namespace blink { |
41 | 38 |
42 class HTMLLinkElement; | 39 class HTMLLinkElement; |
43 class LocalFrame; | |
44 | 40 |
45 class CORE_EXPORT LinkResource | 41 class CORE_EXPORT LinkResource |
46 : public GarbageCollectedFinalized<LinkResource> { | 42 : public GarbageCollectedFinalized<LinkResource> { |
47 WTF_MAKE_NONCOPYABLE(LinkResource); | 43 WTF_MAKE_NONCOPYABLE(LinkResource); |
48 | 44 |
49 public: | 45 public: |
50 enum LinkResourceType { Style, Import, Manifest, Other }; | 46 enum LinkResourceType { Style, Import, Manifest, Other }; |
51 | 47 |
52 explicit LinkResource(HTMLLinkElement*); | 48 explicit LinkResource(HTMLLinkElement*); |
53 virtual ~LinkResource(); | 49 virtual ~LinkResource(); |
54 | 50 |
55 bool shouldLoadResource() const; | |
56 LocalFrame* loadingFrame() const; | |
57 | |
58 virtual LinkResourceType type() const = 0; | 51 virtual LinkResourceType type() const = 0; |
59 virtual void process() = 0; | 52 virtual void process() = 0; |
60 virtual void ownerRemoved() {} | 53 virtual void ownerRemoved() {} |
61 virtual void ownerInserted() {} | 54 virtual void ownerInserted() {} |
62 virtual bool hasLoaded() const = 0; | 55 virtual bool hasLoaded() const = 0; |
63 | 56 |
64 DECLARE_VIRTUAL_TRACE(); | 57 DECLARE_VIRTUAL_TRACE(); |
65 | 58 |
66 protected: | 59 protected: |
67 Member<HTMLLinkElement> m_owner; | 60 Member<HTMLLinkElement> m_owner; |
68 }; | 61 }; |
69 | 62 |
70 class LinkRequestBuilder { | |
71 STACK_ALLOCATED(); | |
72 | |
73 public: | |
74 explicit LinkRequestBuilder(HTMLLinkElement* owner); | |
75 | |
76 bool isValid() const { return !m_url.isEmpty() && m_url.isValid(); } | |
77 const KURL& url() const { return m_url; } | |
78 const AtomicString& charset() const { return m_charset; } | |
79 FetchRequest build(bool lowPriority) const; | |
80 | |
81 private: | |
82 Member<HTMLLinkElement> m_owner; | |
83 KURL m_url; | |
84 AtomicString m_charset; | |
85 }; | |
86 | |
87 } // namespace blink | 63 } // namespace blink |
88 | 64 |
89 #endif // LinkResource_h | 65 #endif // LinkResource_h |
OLD | NEW |