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 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
42 | 42 |
43 namespace WebCore { | 43 namespace WebCore { |
44 | 44 |
45 class FetchRequest; | 45 class FetchRequest; |
46 class ExecutionContext; | 46 class ExecutionContext; |
47 class ResourceFetcher; | 47 class ResourceFetcher; |
48 class HTMLImportChild; | 48 class HTMLImportChild; |
49 class HTMLImportChildClient; | 49 class HTMLImportChildClient; |
50 class HTMLImportLoader; | 50 class HTMLImportLoader; |
51 | 51 |
52 class HTMLImportsController FINAL : public HTMLImportRoot, public DocumentSupple
ment { | 52 class HTMLImportsController FINAL : public HTMLImport, public DocumentSupplement
{ |
53 WTF_MAKE_FAST_ALLOCATED; | 53 WTF_MAKE_FAST_ALLOCATED; |
54 public: | 54 public: |
55 static void provideTo(Document&); | 55 static void provideTo(Document&); |
56 | 56 |
57 explicit HTMLImportsController(Document&); | 57 explicit HTMLImportsController(Document&); |
58 virtual ~HTMLImportsController(); | 58 virtual ~HTMLImportsController(); |
59 | 59 |
60 bool isMaster(const Document& document) const { return m_master == &document
; } | 60 bool isMaster(const Document& document) const { return m_master == &document
; } |
61 bool shouldBlockScriptExecution(const Document&) const; | 61 bool shouldBlockScriptExecution(const Document&) const; |
62 void wasDetachedFrom(const Document&); | 62 void wasDetachedFrom(const Document&); |
63 | 63 |
64 // HTMLImport | 64 // HTMLImport |
65 virtual HTMLImportRoot* root() OVERRIDE; | |
66 virtual Document* document() const OVERRIDE; | 65 virtual Document* document() const OVERRIDE; |
67 virtual bool isDone() const OVERRIDE; | 66 virtual bool isDone() const OVERRIDE; |
68 virtual bool hasLoader() const OVERRIDE; | 67 virtual bool hasLoader() const OVERRIDE; |
| 68 virtual void stateWillChange() OVERRIDE; |
69 virtual void stateDidChange() OVERRIDE; | 69 virtual void stateDidChange() OVERRIDE; |
70 | 70 |
71 // HTMLImportRoot | |
72 virtual void scheduleRecalcState() OVERRIDE; | |
73 virtual HTMLImportsController* toController() OVERRIDE { return this; } | |
74 virtual HTMLImportChild* findLinkFor(const KURL&, HTMLImport* excluding = 0)
const OVERRIDE; | |
75 | |
76 HTMLImportChild* load(HTMLImport* parent, HTMLImportChildClient*, FetchReque
st); | 71 HTMLImportChild* load(HTMLImport* parent, HTMLImportChildClient*, FetchReque
st); |
77 void showSecurityErrorMessage(const String&); | 72 void showSecurityErrorMessage(const String&); |
78 | 73 |
79 SecurityOrigin* securityOrigin() const; | 74 SecurityOrigin* securityOrigin() const; |
80 ResourceFetcher* fetcher() const; | 75 ResourceFetcher* fetcher() const; |
81 LocalFrame* frame() const; | 76 LocalFrame* frame() const; |
82 Document* master() const { return m_master; } | 77 Document* master() const { return m_master; } |
83 | 78 |
84 void recalcTimerFired(Timer<HTMLImportsController>*); | 79 void recalcTimerFired(Timer<HTMLImportsController>*); |
85 | 80 |
86 | 81 |
87 virtual void trace(Visitor*) OVERRIDE { } | 82 virtual void trace(Visitor*) OVERRIDE { } |
88 HTMLImportLoader* createLoader(); | 83 HTMLImportLoader* createLoader(); |
89 | 84 |
90 size_t loaderCount() const { return m_loaders.size(); } | 85 size_t loaderCount() const { return m_loaders.size(); } |
91 HTMLImportLoader* loaderAt(size_t i) const { return m_loaders[i].get(); } | 86 HTMLImportLoader* loaderAt(size_t i) const { return m_loaders[i].get(); } |
92 HTMLImportLoader* loaderFor(const Document&) const; | 87 HTMLImportLoader* loaderFor(const Document&) const; |
93 | 88 |
| 89 void scheduleRecalcState(); |
| 90 HTMLImportChild* findLinkFor(const KURL&, HTMLImport* excluding = 0) const; |
94 | 91 |
95 private: | 92 private: |
96 HTMLImportChild* createChild(const KURL&, HTMLImport* parent, HTMLImportChil
dClient*); | 93 HTMLImportChild* createChild(const KURL&, HTMLImport* parent, HTMLImportChil
dClient*); |
97 void clear(); | 94 void clear(); |
98 | 95 |
99 Document* m_master; | 96 Document* m_master; |
100 Timer<HTMLImportsController> m_recalcTimer; | 97 Timer<HTMLImportsController> m_recalcTimer; |
101 | 98 |
102 // List of import which has been loaded or being loaded. | 99 // List of import which has been loaded or being loaded. |
103 typedef Vector<OwnPtr<HTMLImportChild> > ImportList; | 100 typedef Vector<OwnPtr<HTMLImportChild> > ImportList; |
104 ImportList m_imports; | 101 ImportList m_imports; |
105 | 102 |
106 typedef Vector<RefPtr<HTMLImportLoader> > LoaderList; | 103 typedef Vector<RefPtr<HTMLImportLoader> > LoaderList; |
107 LoaderList m_loaders; | 104 LoaderList m_loaders; |
108 }; | 105 }; |
109 | 106 |
| 107 DEFINE_TYPE_CASTS(HTMLImportsController, HTMLImport, import, import->isRoot(), i
mport.isRoot()); |
| 108 |
110 } // namespace WebCore | 109 } // namespace WebCore |
111 | 110 |
112 #endif // HTMLImportsController_h | 111 #endif // HTMLImportsController_h |
OLD | NEW |