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 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
59 static PassRefPtr<LinkImport> create(HTMLLinkElement* owner); | 59 static PassRefPtr<LinkImport> create(HTMLLinkElement* owner); |
60 | 60 |
61 explicit LinkImport(HTMLLinkElement* owner); | 61 explicit LinkImport(HTMLLinkElement* owner); |
62 virtual ~LinkImport(); | 62 virtual ~LinkImport(); |
63 | 63 |
64 // LinkResource | 64 // LinkResource |
65 virtual void process() OVERRIDE; | 65 virtual void process() OVERRIDE; |
66 virtual Type type() const OVERRIDE { return Import; } | 66 virtual Type type() const OVERRIDE { return Import; } |
67 virtual void ownerRemoved() OVERRIDE; | 67 virtual void ownerRemoved() OVERRIDE; |
68 | 68 |
69 DocumentFragment* importedFragment() const; | 69 Document* importedDocument() const; |
70 const KURL& url() const { return m_url; } | 70 const KURL& url() const { return m_url; } |
71 void importDestroyed(); | 71 void importDestroyed(); |
72 bool isDone() const { return m_state == StateReady || m_state == StateError;
} | 72 bool isDone() const { return m_state == StateReady || m_state == StateError;
} |
73 | 73 |
74 private: | 74 private: |
75 State startRequest(); | 75 State startRequest(); |
76 State finish(); | 76 State finish(); |
77 void setState(State); | 77 void setState(State); |
78 | 78 |
79 // CachedResourceClient | 79 // CachedResourceClient |
80 virtual void notifyFinished(CachedResource*) OVERRIDE; | 80 virtual void notifyFinished(CachedResource*) OVERRIDE; |
81 | 81 |
82 HTMLImportsController* m_controller; | 82 HTMLImportsController* m_controller; |
83 LinkImport* m_ofSameLocation; | 83 LinkImport* m_ofSameLocation; |
84 KURL m_url; | 84 KURL m_url; |
85 State m_state; | 85 State m_state; |
86 CachedResourceHandle<CachedScript> m_resource; | 86 CachedResourceHandle<CachedScript> m_resource; |
87 RefPtr<DocumentFragment> m_importedFragment; | 87 RefPtr<Document> m_importedDocument; |
88 }; | 88 }; |
89 | 89 |
90 | 90 |
91 class HTMLImportsController { | 91 class HTMLImportsController { |
92 WTF_MAKE_FAST_ALLOCATED; | 92 WTF_MAKE_FAST_ALLOCATED; |
93 public: | 93 public: |
94 static PassOwnPtr<HTMLImportsController> create(Document*); | 94 static PassOwnPtr<HTMLImportsController> create(Document*); |
95 | 95 |
96 explicit HTMLImportsController(Document*); | 96 explicit HTMLImportsController(Document*); |
97 virtual ~HTMLImportsController(); | 97 virtual ~HTMLImportsController(); |
98 | 98 |
99 void addImport(PassRefPtr<LinkImport>); | 99 void addImport(PassRefPtr<LinkImport>); |
100 void showSecurityErrorMessage(const String&); | 100 void showSecurityErrorMessage(const String&); |
101 PassRefPtr<DocumentFragment> createDocumentFragment() const; | |
102 PassRefPtr<LinkImport> findLinkFor(const KURL&) const; | 101 PassRefPtr<LinkImport> findLinkFor(const KURL&) const; |
103 SecurityOrigin* securityOrigin() const; | 102 SecurityOrigin* securityOrigin() const; |
104 bool haveLoaded() const; | 103 bool haveLoaded() const; |
105 void didLoad(); | 104 void didLoad(); |
106 | 105 |
107 private: | 106 private: |
108 | 107 |
109 Document* m_master; | 108 Document* m_master; |
110 RefPtr<Document> m_importedFragmentOwner; | |
111 | 109 |
112 // List of import which has been loaded or being loaded. | 110 // List of import which has been loaded or being loaded. |
113 typedef Vector<RefPtr<LinkImport> > ImportList; | 111 typedef Vector<RefPtr<LinkImport> > ImportList; |
114 ImportList m_imports; | 112 ImportList m_imports; |
115 }; | 113 }; |
116 | 114 |
117 } // namespace WebCore | 115 } // namespace WebCore |
118 | 116 |
119 #endif // HTMLImportsController_h | 117 #endif // HTMLImportsController_h |
OLD | NEW |