Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(110)

Side by Side Diff: Source/core/html/HTMLImportsController.h

Issue 19940002: [HTML Import] Respect Content Security Policy Model (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Fix Mac build failure Created 7 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « Source/core/html/HTMLImport.cpp ('k') | Source/core/html/HTMLImportsController.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
68 Document* importedDocument() const; 68 Document* importedDocument() const;
69 69
70 private: 70 private:
71 RefPtr<HTMLImportLoader> m_loader; 71 RefPtr<HTMLImportLoader> m_loader;
72 }; 72 };
73 73
74 class HTMLImportLoader : public RefCounted<HTMLImportLoader>, public HTMLImport, public CachedRawResourceClient { 74 class HTMLImportLoader : public RefCounted<HTMLImportLoader>, public HTMLImport, public CachedRawResourceClient {
75 public: 75 public:
76 enum State { 76 enum State {
77 StateLoading, 77 StateLoading,
78 StateWritten,
78 StateError, 79 StateError,
79 StateReady 80 StateReady
80 }; 81 };
81 82
82 static PassRefPtr<HTMLImportLoader> create(HTMLImport* parent, const KURL&, const CachedResourceHandle<CachedScript>&); 83 static PassRefPtr<HTMLImportLoader> create(HTMLImport* parent, const KURL&, const CachedResourceHandle<CachedScript>&);
83 virtual ~HTMLImportLoader(); 84 virtual ~HTMLImportLoader();
84 85
85 Document* importedDocument() const; 86 Document* importedDocument() const;
86 const KURL& url() const { return m_url; } 87 const KURL& url() const { return m_url; }
87 88
88 void importDestroyed(); 89 void importDestroyed();
89 bool isDone() const { return m_state == StateReady || m_state == StateError; } 90 bool isDone() const { return m_state == StateReady || m_state == StateError; }
90 91
91 // HTMLImport 92 // HTMLImport
92 virtual HTMLImportsController* controller() OVERRIDE; 93 virtual HTMLImportsController* controller() OVERRIDE;
93 virtual HTMLImport* parent() OVERRIDE; 94 virtual HTMLImport* parent() OVERRIDE;
94 virtual Document* document() OVERRIDE; 95 virtual Document* document() OVERRIDE;
95 virtual void wasDetachedFromDocument() OVERRIDE; 96 virtual void wasDetachedFromDocument() OVERRIDE;
97 virtual void didFinishParsing() OVERRIDE;
96 98
97 private: 99 private:
98 HTMLImportLoader(HTMLImport*, const KURL&, const CachedResourceHandle<Cached Script>&); 100 HTMLImportLoader(HTMLImport*, const KURL&, const CachedResourceHandle<Cached Script>&);
99 101
100 // CachedRawResourceClient 102 // CachedRawResourceClient
101 virtual void responseReceived(CachedResource*, const ResourceResponse&) OVER RIDE; 103 virtual void responseReceived(CachedResource*, const ResourceResponse&) OVER RIDE;
102 virtual void dataReceived(CachedResource*, const char* data, int length) OVE RRIDE; 104 virtual void dataReceived(CachedResource*, const char* data, int length) OVE RRIDE;
103 virtual void notifyFinished(CachedResource*) OVERRIDE; 105 virtual void notifyFinished(CachedResource*) OVERRIDE;
104 106
105 State startParsing(const ResourceResponse&); 107 State startWritingAndParsing(const ResourceResponse&);
106 State finish(); 108 State finishWriting();
109 State finishParsing();
110
107 void setState(State); 111 void setState(State);
108 void dispose(); 112 void dispose();
109 113
110 HTMLImport* m_parent; 114 HTMLImport* m_parent;
111 State m_state; 115 State m_state;
112 KURL m_url; 116 KURL m_url;
113 CachedResourceHandle<CachedRawResource> m_resource; 117 CachedResourceHandle<CachedRawResource> m_resource;
114 RefPtr<Document> m_importedDocument; 118 RefPtr<Document> m_importedDocument;
115 RefPtr<DocumentWriter> m_writer; 119 RefPtr<DocumentWriter> m_writer;
116 }; 120 };
117 121
118 class HTMLImportsController : public HTMLImport, public Supplement<ScriptExecuti onContext> { 122 class HTMLImportsController : public HTMLImport, public Supplement<ScriptExecuti onContext> {
119 WTF_MAKE_FAST_ALLOCATED; 123 WTF_MAKE_FAST_ALLOCATED;
120 public: 124 public:
121 static void provideTo(Document*); 125 static void provideTo(Document*);
122 126
123 explicit HTMLImportsController(Document*); 127 explicit HTMLImportsController(Document*);
124 virtual ~HTMLImportsController(); 128 virtual ~HTMLImportsController();
125 129
126 // HTMLImport 130 // HTMLImport
127 virtual HTMLImportsController* controller() OVERRIDE; 131 virtual HTMLImportsController* controller() OVERRIDE;
128 virtual HTMLImport* parent() OVERRIDE; 132 virtual HTMLImport* parent() OVERRIDE;
129 virtual Document* document() OVERRIDE; 133 virtual Document* document() OVERRIDE;
130 virtual void wasDetachedFromDocument() OVERRIDE; 134 virtual void wasDetachedFromDocument() OVERRIDE;
135 virtual void didFinishParsing() OVERRIDE;
131 136
132 void addImport(PassRefPtr<HTMLImportLoader>); 137 void addImport(PassRefPtr<HTMLImportLoader>);
133 void showSecurityErrorMessage(const String&); 138 void showSecurityErrorMessage(const String&);
134 PassRefPtr<HTMLImportLoader> findLinkFor(const KURL&) const; 139 PassRefPtr<HTMLImportLoader> findLinkFor(const KURL&) const;
135 SecurityOrigin* securityOrigin() const; 140 SecurityOrigin* securityOrigin() const;
136 ResourceFetcher* fetcher() const; 141 ResourceFetcher* fetcher() const;
137 bool haveChildrenLoaded(HTMLImport* parent) const; 142 bool haveChildrenLoaded(HTMLImport* parent) const;
138 void didLoad(HTMLImportLoader*); 143 void didLoad(HTMLImportLoader*);
139 144
140 private: 145 private:
141 void clear(); 146 void clear();
142 147
143 Document* m_master; 148 Document* m_master;
144 149
145 // List of import which has been loaded or being loaded. 150 // List of import which has been loaded or being loaded.
146 typedef Vector<RefPtr<HTMLImportLoader> > ImportList; 151 typedef Vector<RefPtr<HTMLImportLoader> > ImportList;
147 ImportList m_imports; 152 ImportList m_imports;
148 }; 153 };
149 154
150 } // namespace WebCore 155 } // namespace WebCore
151 156
152 #endif // HTMLImportsController_h 157 #endif // HTMLImportsController_h
OLDNEW
« no previous file with comments | « Source/core/html/HTMLImport.cpp ('k') | Source/core/html/HTMLImportsController.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698