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

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

Issue 22573005: [HTML Imports] Implement "load" and "error" events. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: For landing Created 7 years, 4 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/core.gypi ('k') | Source/core/html/HTMLImportLoader.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 23 matching lines...) Expand all
34 #include "core/html/HTMLImport.h" 34 #include "core/html/HTMLImport.h"
35 #include "core/loader/cache/CachedRawResource.h" 35 #include "core/loader/cache/CachedRawResource.h"
36 #include "core/loader/cache/ResourcePtr.h" 36 #include "core/loader/cache/ResourcePtr.h"
37 #include "weborigin/KURL.h" 37 #include "weborigin/KURL.h"
38 #include "wtf/RefCounted.h" 38 #include "wtf/RefCounted.h"
39 #include "wtf/Vector.h" 39 #include "wtf/Vector.h"
40 40
41 namespace WebCore { 41 namespace WebCore {
42 42
43 class DocumentWriter; 43 class DocumentWriter;
44 class HTMLImportLoaderClient;
44 45
45 class HTMLImportLoader : public RefCounted<HTMLImportLoader>, public HTMLImport, public CachedRawResourceClient { 46 class HTMLImportLoader : public RefCounted<HTMLImportLoader>, public HTMLImport, public CachedRawResourceClient {
46 public: 47 public:
47 enum State { 48 enum State {
48 StateLoading, 49 StateLoading,
49 StateWritten, 50 StateWritten,
50 StateError, 51 StateError,
51 StateReady 52 StateReady
52 }; 53 };
53 54
54 HTMLImportLoader(HTMLImport*, const KURL&, const ResourcePtr<CachedRawResour ce>&); 55 HTMLImportLoader(HTMLImport*, const KURL&, const ResourcePtr<CachedRawResour ce>&);
55 virtual ~HTMLImportLoader(); 56 virtual ~HTMLImportLoader();
56 57
57 Document* importedDocument() const; 58 Document* importedDocument() const;
58 const KURL& url() const { return m_url; } 59 const KURL& url() const { return m_url; }
59 60
61 void addClient(HTMLImportLoaderClient*);
62 void removeClient(HTMLImportLoaderClient*);
60 void importDestroyed(); 63 void importDestroyed();
61 bool isDone() const { return m_state == StateReady || m_state == StateError; } 64 bool isDone() const { return m_state == StateReady || m_state == StateError; }
65 bool isLoaded() const { return m_state == StateReady; }
62 66
63 // HTMLImport 67 // HTMLImport
64 virtual HTMLImportRoot* root() OVERRIDE; 68 virtual HTMLImportRoot* root() OVERRIDE;
65 virtual HTMLImport* parent() const OVERRIDE; 69 virtual HTMLImport* parent() const OVERRIDE;
66 virtual Document* document() const OVERRIDE; 70 virtual Document* document() const OVERRIDE;
67 virtual void wasDetachedFromDocument() OVERRIDE; 71 virtual void wasDetachedFromDocument() OVERRIDE;
68 virtual void didFinishParsing() OVERRIDE; 72 virtual void didFinishParsing() OVERRIDE;
69 virtual bool isProcessing() const OVERRIDE; 73 virtual bool isProcessing() const OVERRIDE;
70 74
71 private: 75 private:
72 76
73 // CachedRawResourceClient 77 // CachedRawResourceClient
74 virtual void responseReceived(Resource*, const ResourceResponse&) OVERRIDE; 78 virtual void responseReceived(Resource*, const ResourceResponse&) OVERRIDE;
75 virtual void dataReceived(Resource*, const char* data, int length) OVERRIDE; 79 virtual void dataReceived(Resource*, const char* data, int length) OVERRIDE;
76 virtual void notifyFinished(Resource*) OVERRIDE; 80 virtual void notifyFinished(Resource*) OVERRIDE;
77 81
78 State startWritingAndParsing(const ResourceResponse&); 82 State startWritingAndParsing(const ResourceResponse&);
79 State finishWriting(); 83 State finishWriting();
80 State finishParsing(); 84 State finishParsing();
81 85
82 void setState(State); 86 void setState(State);
83 void dispose(); 87 void didFinish();
84 88
85 HTMLImport* m_parent; 89 HTMLImport* m_parent;
90 Vector<HTMLImportLoaderClient*> m_clients;
86 State m_state; 91 State m_state;
87 KURL m_url; 92 KURL m_url;
88 ResourcePtr<CachedRawResource> m_resource; 93 ResourcePtr<CachedRawResource> m_resource;
89 RefPtr<Document> m_importedDocument; 94 RefPtr<Document> m_importedDocument;
90 RefPtr<DocumentWriter> m_writer; 95 RefPtr<DocumentWriter> m_writer;
91 }; 96 };
92 97
93 } // namespace WebCore 98 } // namespace WebCore
94 99
95 #endif // HTMLImportLoader_h 100 #endif // HTMLImportLoader_h
OLDNEW
« no previous file with comments | « Source/core/core.gypi ('k') | Source/core/html/HTMLImportLoader.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698