| 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 30 matching lines...) Expand all Loading... |
| 41 #include "wtf/Vector.h" | 41 #include "wtf/Vector.h" |
| 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 class HTMLImportTreeRoot; |
| 51 | 52 |
| 52 class HTMLImportsController FINAL : public NoBaseWillBeGarbageCollectedFinalized
<HTMLImportsController>, public HTMLImport, public DocumentSupplement { | 53 class HTMLImportsController FINAL : public NoBaseWillBeGarbageCollectedFinalized
<HTMLImportsController>, public DocumentSupplement { |
| 53 WILL_BE_USING_GARBAGE_COLLECTED_MIXIN(HTMLImportsController); | 54 WILL_BE_USING_GARBAGE_COLLECTED_MIXIN(HTMLImportsController); |
| 54 WTF_MAKE_FAST_ALLOCATED_WILL_BE_REMOVED; | 55 WTF_MAKE_FAST_ALLOCATED_WILL_BE_REMOVED; |
| 55 public: | 56 public: |
| 56 static void provideTo(Document&); | 57 static void provideTo(Document&); |
| 57 | 58 |
| 58 explicit HTMLImportsController(Document&); | 59 explicit HTMLImportsController(Document&); |
| 59 virtual ~HTMLImportsController(); | 60 virtual ~HTMLImportsController(); |
| 60 | 61 |
| 62 HTMLImportTreeRoot* root() const { return m_root.get(); } |
| 63 |
| 61 bool isMaster(const Document& document) const { return m_master == &document
; } | 64 bool isMaster(const Document& document) const { return m_master == &document
; } |
| 62 bool shouldBlockScriptExecution(const Document&) const; | 65 bool shouldBlockScriptExecution(const Document&) const; |
| 63 void wasDetachedFrom(const Document&); | 66 void wasDetachedFrom(const Document&); |
| 64 | 67 |
| 65 // HTMLImport | |
| 66 virtual Document* document() const OVERRIDE; | |
| 67 virtual bool isDone() const OVERRIDE; | |
| 68 virtual void stateWillChange() OVERRIDE; | |
| 69 virtual void stateDidChange() OVERRIDE; | |
| 70 | |
| 71 HTMLImportChild* load(HTMLImport* parent, HTMLImportChildClient*, FetchReque
st); | 68 HTMLImportChild* load(HTMLImport* parent, HTMLImportChildClient*, FetchReque
st); |
| 72 void showSecurityErrorMessage(const String&); | 69 void showSecurityErrorMessage(const String&); |
| 73 | 70 |
| 74 SecurityOrigin* securityOrigin() const; | 71 SecurityOrigin* securityOrigin() const; |
| 75 ResourceFetcher* fetcher() const; | 72 ResourceFetcher* fetcher() const; |
| 76 LocalFrame* frame() const; | 73 LocalFrame* frame() const; |
| 77 Document* master() const { return m_master; } | 74 Document* master() const { return m_master; } |
| 78 | 75 |
| 79 void recalcTimerFired(Timer<HTMLImportsController>*); | |
| 80 | 76 |
| 81 HTMLImportLoader* createLoader(); | 77 HTMLImportLoader* createLoader(); |
| 82 | 78 |
| 83 size_t loaderCount() const { return m_loaders.size(); } | 79 size_t loaderCount() const { return m_loaders.size(); } |
| 84 HTMLImportLoader* loaderAt(size_t i) const { return m_loaders[i].get(); } | 80 HTMLImportLoader* loaderAt(size_t i) const { return m_loaders[i].get(); } |
| 85 HTMLImportLoader* loaderFor(const Document&) const; | 81 HTMLImportLoader* loaderFor(const Document&) const; |
| 86 | 82 |
| 87 void scheduleRecalcState(); | |
| 88 HTMLImportChild* findLinkFor(const KURL&) const; | 83 HTMLImportChild* findLinkFor(const KURL&) const; |
| 89 | 84 |
| 90 private: | 85 private: |
| 91 HTMLImportChild* createChild(const KURL&, HTMLImportLoader*, HTMLImport* par
ent, HTMLImportChildClient*); | 86 HTMLImportChild* createChild(const KURL&, HTMLImportLoader*, HTMLImport* par
ent, HTMLImportChildClient*); |
| 92 void clear(); | 87 void clear(); |
| 93 | 88 |
| 94 Document* m_master; | 89 Document* m_master; |
| 95 Timer<HTMLImportsController> m_recalcTimer; | 90 |
| 91 OwnPtr<HTMLImportTreeRoot> m_root; |
| 96 | 92 |
| 97 // List of import which has been loaded or being loaded. | 93 // List of import which has been loaded or being loaded. |
| 98 typedef Vector<OwnPtr<HTMLImportChild> > ImportList; | 94 typedef Vector<OwnPtr<HTMLImportChild> > ImportList; |
| 99 ImportList m_imports; | 95 ImportList m_imports; |
| 100 | 96 |
| 101 typedef Vector<RefPtr<HTMLImportLoader> > LoaderList; | 97 typedef Vector<RefPtr<HTMLImportLoader> > LoaderList; |
| 102 LoaderList m_loaders; | 98 LoaderList m_loaders; |
| 103 }; | 99 }; |
| 104 | 100 |
| 105 DEFINE_TYPE_CASTS(HTMLImportsController, HTMLImport, import, import->isRoot(), i
mport.isRoot()); | |
| 106 | |
| 107 } // namespace WebCore | 101 } // namespace WebCore |
| 108 | 102 |
| 109 #endif // HTMLImportsController_h | 103 #endif // HTMLImportsController_h |
| OLD | NEW |