OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2006, 2007, 2008, 2009, 2011 Apple Inc. All rights reserved. | 2 * Copyright (C) 2006, 2007, 2008, 2009, 2011 Apple Inc. All rights reserved. |
3 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. (http://www.t
orchmobile.com/) | 3 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. (http://www.t
orchmobile.com/) |
4 * Copyright (C) Research In Motion Limited 2009. All rights reserved. | 4 * Copyright (C) Research In Motion Limited 2009. All rights reserved. |
5 * Copyright (C) 2011 Google Inc. All rights reserved. | 5 * Copyright (C) 2011 Google Inc. All rights reserved. |
6 * | 6 * |
7 * Redistribution and use in source and binary forms, with or without | 7 * Redistribution and use in source and binary forms, with or without |
8 * modification, are permitted provided that the following conditions | 8 * modification, are permitted provided that the following conditions |
9 * are met: | 9 * are met: |
10 * | 10 * |
(...skipping 23 matching lines...) Expand all Loading... |
34 | 34 |
35 #include "core/dom/IconURL.h" | 35 #include "core/dom/IconURL.h" |
36 #include "core/dom/SandboxFlags.h" | 36 #include "core/dom/SandboxFlags.h" |
37 #include "core/dom/SecurityContext.h" | 37 #include "core/dom/SecurityContext.h" |
38 #include "core/fetch/ResourceLoaderOptions.h" | 38 #include "core/fetch/ResourceLoaderOptions.h" |
39 #include "core/loader/FrameLoaderStateMachine.h" | 39 #include "core/loader/FrameLoaderStateMachine.h" |
40 #include "core/loader/FrameLoaderTypes.h" | 40 #include "core/loader/FrameLoaderTypes.h" |
41 #include "core/loader/HistoryItem.h" | 41 #include "core/loader/HistoryItem.h" |
42 #include "core/loader/MixedContentChecker.h" | 42 #include "core/loader/MixedContentChecker.h" |
43 #include "platform/Timer.h" | 43 #include "platform/Timer.h" |
| 44 #include "platform/heap/Handle.h" |
44 #include "platform/network/ResourceRequest.h" | 45 #include "platform/network/ResourceRequest.h" |
45 #include "wtf/Forward.h" | 46 #include "wtf/Forward.h" |
46 #include "wtf/HashSet.h" | 47 #include "wtf/HashSet.h" |
47 #include "wtf/OwnPtr.h" | 48 #include "wtf/OwnPtr.h" |
48 | 49 |
49 namespace blink { | 50 namespace blink { |
50 | 51 |
51 class Chrome; | 52 class Chrome; |
52 class DOMWrapperWorld; | 53 class DOMWrapperWorld; |
53 class DocumentLoader; | 54 class DocumentLoader; |
(...skipping 11 matching lines...) Expand all Loading... |
65 class ResourceResponse; | 66 class ResourceResponse; |
66 class SecurityOrigin; | 67 class SecurityOrigin; |
67 class SerializedScriptValue; | 68 class SerializedScriptValue; |
68 class SubstituteData; | 69 class SubstituteData; |
69 | 70 |
70 struct FrameLoadRequest; | 71 struct FrameLoadRequest; |
71 struct WindowFeatures; | 72 struct WindowFeatures; |
72 | 73 |
73 bool isBackForwardLoadType(FrameLoadType); | 74 bool isBackForwardLoadType(FrameLoadType); |
74 | 75 |
75 class FrameLoader { | 76 class FrameLoader FINAL { |
76 WTF_MAKE_NONCOPYABLE(FrameLoader); | 77 WTF_MAKE_NONCOPYABLE(FrameLoader); |
| 78 ALLOW_ONLY_INLINE_ALLOCATION(); |
77 public: | 79 public: |
78 static ResourceRequest requestFromHistoryItem(HistoryItem*, ResourceRequestC
achePolicy); | 80 static ResourceRequest requestFromHistoryItem(HistoryItem*, ResourceRequestC
achePolicy); |
79 | 81 |
80 FrameLoader(LocalFrame*); | 82 FrameLoader(LocalFrame*); |
81 ~FrameLoader(); | 83 ~FrameLoader(); |
82 | 84 |
83 void init(); | 85 void init(); |
84 | 86 |
85 LocalFrame* frame() const { return m_frame; } | 87 LocalFrame* frame() const { return m_frame; } |
86 | 88 |
87 MixedContentChecker* mixedContentChecker() const { return &m_mixedContentChe
cker; } | 89 MixedContentChecker* mixedContentChecker() const { return &m_mixedContentChe
cker; } |
88 ProgressTracker& progress() const { return *m_progressTracker; } | 90 ProgressTracker& progress() const { return *m_progressTracker; } |
89 | 91 |
90 // These functions start a load. All eventually call into loadWithNavigation
Action() or loadInSameDocument(). | 92 // These functions start a load. All eventually call into loadWithNavigation
Action() or loadInSameDocument(). |
91 void load(const FrameLoadRequest&); // The entry point for non-reload, non-h
istory loads. | 93 void load(const FrameLoadRequest&); // The entry point for non-reload, non-h
istory loads. |
92 void reload(ReloadPolicy = NormalReload, const KURL& overrideURL = KURL(), c
onst AtomicString& overrideEncoding = nullAtom, ClientRedirectPolicy = NotClient
Redirect); | 94 void reload(ReloadPolicy = NormalReload, const KURL& overrideURL = KURL(), c
onst AtomicString& overrideEncoding = nullAtom, ClientRedirectPolicy = NotClient
Redirect); |
93 void loadHistoryItem(HistoryItem*, HistoryLoadType = HistoryDifferentDocumen
tLoad, ResourceRequestCachePolicy = UseProtocolCachePolicy); // The entry point
for all back/forward loads | 95 void loadHistoryItem(HistoryItem*, HistoryLoadType = HistoryDifferentDocumen
tLoad, ResourceRequestCachePolicy = UseProtocolCachePolicy); // The entry point
for all back/forward loads |
94 | 96 |
95 static void reportLocalLoadFailed(LocalFrame*, const String& url); | 97 static void reportLocalLoadFailed(LocalFrame*, const String& url); |
96 | 98 |
97 // FIXME: These are all functions which stop loads. We have too many. | 99 // FIXME: These are all functions which stop loads. We have too many. |
98 // Warning: stopAllLoaders can and will detach the LocalFrame out from under
you. All callers need to either protect the LocalFrame | 100 // Warning: stopAllLoaders can and will detach the LocalFrame out from under
you. All callers need to either protect the LocalFrame |
99 // or guarantee they won't in any way access the LocalFrame after stopAllLoa
ders returns. | 101 // or guarantee they won't in any way access the LocalFrame after stopAllLoa
ders returns. |
100 void stopAllLoaders(); | 102 void stopAllLoaders(); |
101 void stopLoading(); | 103 void stopLoading(); |
102 bool closeURL(); | 104 bool closeURL(); |
103 // FIXME: clear() is trying to do too many things. We should break it down i
nto smaller functions. | 105 |
104 void clear(); | 106 // FIXME: dispose() is trying to do too many things. We should break it down
into smaller functions. |
| 107 enum DisposeFrameContents { |
| 108 DoNotDisposeFrameContents, |
| 109 DoDisposeFrameContents |
| 110 }; |
| 111 |
| 112 void dispose(DisposeFrameContents); |
| 113 |
105 void replaceDocumentWhileExecutingJavaScriptURL(const String& source, Docume
nt* ownerDocument); | 114 void replaceDocumentWhileExecutingJavaScriptURL(const String& source, Docume
nt* ownerDocument); |
106 | 115 |
107 // Sets a timer to notify the client that the initial empty document has | 116 // Sets a timer to notify the client that the initial empty document has |
108 // been accessed, and thus it is no longer safe to show a provisional URL | 117 // been accessed, and thus it is no longer safe to show a provisional URL |
109 // above the document without risking a URL spoof. | 118 // above the document without risking a URL spoof. |
110 void didAccessInitialDocument(); | 119 void didAccessInitialDocument(); |
111 | 120 |
112 // If the initial empty document is showing and has been accessed, this | 121 // If the initial empty document is showing and has been accessed, this |
113 // cancels the timer and immediately notifies the client in cases that | 122 // cancels the timer and immediately notifies the client in cases that |
114 // waiting to notify would allow a URL spoof. | 123 // waiting to notify would allow a URL spoof. |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
180 bool allowPlugins(ReasonForCallingAllowPlugins); | 189 bool allowPlugins(ReasonForCallingAllowPlugins); |
181 | 190 |
182 void updateForSameDocumentNavigation(const KURL&, SameDocumentNavigationSour
ce, PassRefPtr<SerializedScriptValue>, FrameLoadType); | 191 void updateForSameDocumentNavigation(const KURL&, SameDocumentNavigationSour
ce, PassRefPtr<SerializedScriptValue>, FrameLoadType); |
183 | 192 |
184 HistoryItem* currentItem() const { return m_currentItem.get(); } | 193 HistoryItem* currentItem() const { return m_currentItem.get(); } |
185 void saveScrollState(); | 194 void saveScrollState(); |
186 void clearScrollPositionAndViewState(); | 195 void clearScrollPositionAndViewState(); |
187 | 196 |
188 void restoreScrollPositionAndViewState(); | 197 void restoreScrollPositionAndViewState(); |
189 | 198 |
| 199 void trace(Visitor*); |
| 200 |
190 private: | 201 private: |
191 bool allChildrenAreComplete() const; // immediate children, not all descenda
nts | 202 bool allChildrenAreComplete() const; // immediate children, not all descenda
nts |
192 | 203 |
193 void completed(); | 204 void completed(); |
194 | 205 |
195 void checkTimerFired(Timer<FrameLoader>*); | 206 void checkTimerFired(Timer<FrameLoader>*); |
196 void didAccessInitialDocumentTimerFired(Timer<FrameLoader>*); | 207 void didAccessInitialDocumentTimerFired(Timer<FrameLoader>*); |
197 | 208 |
198 bool prepareRequestForThisFrame(FrameLoadRequest&); | 209 bool prepareRequestForThisFrame(FrameLoadRequest&); |
199 void setReferrerForFrameRequest(ResourceRequest&, ShouldSendReferrer, Docume
nt*); | 210 void setReferrerForFrameRequest(ResourceRequest&, ShouldSendReferrer, Docume
nt*); |
(...skipping 14 matching lines...) Expand all Loading... |
214 bool validateTransitionNavigationMode(); | 225 bool validateTransitionNavigationMode(); |
215 bool dispatchNavigationTransitionData(); | 226 bool dispatchNavigationTransitionData(); |
216 void detachClient(); | 227 void detachClient(); |
217 | 228 |
218 void setHistoryItemStateForCommit(HistoryCommitType, bool isPushOrReplaceSta
te = false, PassRefPtr<SerializedScriptValue> = nullptr); | 229 void setHistoryItemStateForCommit(HistoryCommitType, bool isPushOrReplaceSta
te = false, PassRefPtr<SerializedScriptValue> = nullptr); |
219 | 230 |
220 void loadInSameDocument(const KURL&, PassRefPtr<SerializedScriptValue> state
Object, FrameLoadType, ClientRedirectPolicy); | 231 void loadInSameDocument(const KURL&, PassRefPtr<SerializedScriptValue> state
Object, FrameLoadType, ClientRedirectPolicy); |
221 | 232 |
222 void scheduleCheckCompleted(); | 233 void scheduleCheckCompleted(); |
223 | 234 |
224 LocalFrame* m_frame; | 235 RawPtrWillBeMember<LocalFrame> m_frame; |
225 | 236 |
226 // FIXME: These should be OwnPtr<T> to reduce build times and simplify | 237 // FIXME: These should be OwnPtr<T> to reduce build times and simplify |
227 // header dependencies unless performance testing proves otherwise. | 238 // header dependencies unless performance testing proves otherwise. |
228 // Some of these could be lazily created for memory savings on devices. | 239 // Some of these could be lazily created for memory savings on devices. |
229 mutable FrameLoaderStateMachine m_stateMachine; | 240 mutable FrameLoaderStateMachine m_stateMachine; |
230 mutable MixedContentChecker m_mixedContentChecker; | 241 mutable MixedContentChecker m_mixedContentChecker; |
231 | 242 |
232 OwnPtr<ProgressTracker> m_progressTracker; | 243 OwnPtr<ProgressTracker> m_progressTracker; |
233 | 244 |
234 FrameState m_state; | 245 FrameState m_state; |
235 FrameLoadType m_loadType; | 246 FrameLoadType m_loadType; |
236 | 247 |
237 // Document loaders for the three phases of frame loading. Note that while | 248 // Document loaders for the three phases of frame loading. Note that while |
238 // a new request is being loaded, the old document loader may still be refer
enced. | 249 // a new request is being loaded, the old document loader may still be refer
enced. |
239 // E.g. while a new request is in the "policy" state, the old document loade
r may | 250 // E.g. while a new request is in the "policy" state, the old document loade
r may |
240 // be consulted in particular as it makes sense to imply certain settings on
the new loader. | 251 // be consulted in particular as it makes sense to imply certain settings on
the new loader. |
241 RefPtr<DocumentLoader> m_documentLoader; | 252 RefPtr<DocumentLoader> m_documentLoader; |
242 RefPtr<DocumentLoader> m_provisionalDocumentLoader; | 253 RefPtr<DocumentLoader> m_provisionalDocumentLoader; |
243 RefPtr<DocumentLoader> m_policyDocumentLoader; | 254 RefPtr<DocumentLoader> m_policyDocumentLoader; |
244 OwnPtr<FetchContext> m_fetchContext; | 255 OwnPtrWillBeMember<FetchContext> m_fetchContext; |
245 | 256 |
246 RefPtr<HistoryItem> m_currentItem; | 257 RefPtr<HistoryItem> m_currentItem; |
247 RefPtr<HistoryItem> m_provisionalItem; | 258 RefPtr<HistoryItem> m_provisionalItem; |
248 struct DeferredHistoryLoad { | 259 struct DeferredHistoryLoad { |
249 DeferredHistoryLoad(HistoryItem* item, HistoryLoadType type, ResourceReq
uestCachePolicy cachePolicy) | 260 DeferredHistoryLoad(HistoryItem* item, HistoryLoadType type, ResourceReq
uestCachePolicy cachePolicy) |
250 : m_item(item) | 261 : m_item(item) |
251 , m_type(type) | 262 , m_type(type) |
252 , m_cachePolicy(cachePolicy) | 263 , m_cachePolicy(cachePolicy) |
253 { | 264 { |
254 } | 265 } |
(...skipping 14 matching lines...) Expand all Loading... |
269 | 280 |
270 bool m_didAccessInitialDocument; | 281 bool m_didAccessInitialDocument; |
271 Timer<FrameLoader> m_didAccessInitialDocumentTimer; | 282 Timer<FrameLoader> m_didAccessInitialDocumentTimer; |
272 | 283 |
273 SandboxFlags m_forcedSandboxFlags; | 284 SandboxFlags m_forcedSandboxFlags; |
274 }; | 285 }; |
275 | 286 |
276 } // namespace blink | 287 } // namespace blink |
277 | 288 |
278 #endif // FrameLoader_h | 289 #endif // FrameLoader_h |
OLD | NEW |