| 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 22 matching lines...) Expand all Loading... |
| 33 #define FrameLoader_h | 33 #define FrameLoader_h |
| 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 "platform/Timer.h" | 42 #include "platform/Timer.h" |
| 43 #include "platform/heap/Handle.h" |
| 43 #include "platform/network/ResourceRequest.h" | 44 #include "platform/network/ResourceRequest.h" |
| 44 #include "wtf/Forward.h" | 45 #include "wtf/Forward.h" |
| 45 #include "wtf/HashSet.h" | 46 #include "wtf/HashSet.h" |
| 46 #include "wtf/OwnPtr.h" | 47 #include "wtf/OwnPtr.h" |
| 47 | 48 |
| 48 namespace blink { | 49 namespace blink { |
| 49 | 50 |
| 50 class DocumentLoader; | 51 class DocumentLoader; |
| 51 class FetchContext; | 52 class FetchContext; |
| 52 class FormState; | 53 class FormState; |
| 53 class Frame; | 54 class Frame; |
| 54 class FrameLoaderClient; | 55 class FrameLoaderClient; |
| 55 class NavigationAction; | 56 class NavigationAction; |
| 56 class ProgressTracker; | 57 class ProgressTracker; |
| 57 class ResourceError; | 58 class ResourceError; |
| 58 class SerializedScriptValue; | 59 class SerializedScriptValue; |
| 59 class SubstituteData; | 60 class SubstituteData; |
| 60 | 61 |
| 61 struct FrameLoadRequest; | 62 struct FrameLoadRequest; |
| 62 | 63 |
| 63 bool isBackForwardLoadType(FrameLoadType); | 64 bool isBackForwardLoadType(FrameLoadType); |
| 64 | 65 |
| 65 class FrameLoader { | 66 class FrameLoader FINAL { |
| 66 WTF_MAKE_NONCOPYABLE(FrameLoader); | 67 WTF_MAKE_NONCOPYABLE(FrameLoader); |
| 68 ALLOW_ONLY_INLINE_ALLOCATION(); |
| 67 public: | 69 public: |
| 68 static ResourceRequest requestFromHistoryItem(HistoryItem*, ResourceRequestC
achePolicy); | 70 static ResourceRequest requestFromHistoryItem(HistoryItem*, ResourceRequestC
achePolicy); |
| 69 | 71 |
| 70 FrameLoader(LocalFrame*); | 72 FrameLoader(LocalFrame*); |
| 71 ~FrameLoader(); | 73 ~FrameLoader(); |
| 72 | 74 |
| 73 void init(); | 75 void init(); |
| 74 | 76 |
| 75 LocalFrame* frame() const { return m_frame; } | 77 LocalFrame* frame() const { return m_frame; } |
| 76 | 78 |
| 77 ProgressTracker& progress() const { return *m_progressTracker; } | 79 ProgressTracker& progress() const { return *m_progressTracker; } |
| 78 | 80 |
| 79 // These functions start a load. All eventually call into loadWithNavigation
Action() or loadInSameDocument(). | 81 // These functions start a load. All eventually call into loadWithNavigation
Action() or loadInSameDocument(). |
| 80 void load(const FrameLoadRequest&); // The entry point for non-reload, non-h
istory loads. | 82 void load(const FrameLoadRequest&); // The entry point for non-reload, non-h
istory loads. |
| 81 void reload(ReloadPolicy = NormalReload, const KURL& overrideURL = KURL(), c
onst AtomicString& overrideEncoding = nullAtom, ClientRedirectPolicy = NotClient
Redirect); | 83 void reload(ReloadPolicy = NormalReload, const KURL& overrideURL = KURL(), c
onst AtomicString& overrideEncoding = nullAtom, ClientRedirectPolicy = NotClient
Redirect); |
| 82 void loadHistoryItem(HistoryItem*, HistoryLoadType = HistoryDifferentDocumen
tLoad, ResourceRequestCachePolicy = UseProtocolCachePolicy); // The entry point
for all back/forward loads | 84 void loadHistoryItem(HistoryItem*, HistoryLoadType = HistoryDifferentDocumen
tLoad, ResourceRequestCachePolicy = UseProtocolCachePolicy); // The entry point
for all back/forward loads |
| 83 | 85 |
| 84 static void reportLocalLoadFailed(LocalFrame*, const String& url); | 86 static void reportLocalLoadFailed(LocalFrame*, const String& url); |
| 85 | 87 |
| 86 // FIXME: These are all functions which stop loads. We have too many. | 88 // FIXME: These are all functions which stop loads. We have too many. |
| 87 // Warning: stopAllLoaders can and will detach the LocalFrame out from under
you. All callers need to either protect the LocalFrame | 89 // Warning: stopAllLoaders can and will detach the LocalFrame out from under
you. All callers need to either protect the LocalFrame |
| 88 // or guarantee they won't in any way access the LocalFrame after stopAllLoa
ders returns. | 90 // or guarantee they won't in any way access the LocalFrame after stopAllLoa
ders returns. |
| 89 void stopAllLoaders(); | 91 void stopAllLoaders(); |
| 90 void stopLoading(); | 92 void stopLoading(); |
| 91 bool closeURL(); | 93 bool closeURL(); |
| 92 // FIXME: clear() is trying to do too many things. We should break it down i
nto smaller functions. | 94 |
| 93 void clear(); | 95 // FIXME: dispose() is trying to do too many things. We should break it down
into smaller functions. |
| 96 enum DisposeFrameContents { |
| 97 DoNotDisposeFrameContents, |
| 98 DoDisposeFrameContents |
| 99 }; |
| 100 |
| 101 void dispose(DisposeFrameContents); |
| 102 |
| 94 void replaceDocumentWhileExecutingJavaScriptURL(const String& source, Docume
nt* ownerDocument); | 103 void replaceDocumentWhileExecutingJavaScriptURL(const String& source, Docume
nt* ownerDocument); |
| 95 | 104 |
| 96 // Sets a timer to notify the client that the initial empty document has | 105 // Sets a timer to notify the client that the initial empty document has |
| 97 // been accessed, and thus it is no longer safe to show a provisional URL | 106 // been accessed, and thus it is no longer safe to show a provisional URL |
| 98 // above the document without risking a URL spoof. | 107 // above the document without risking a URL spoof. |
| 99 void didAccessInitialDocument(); | 108 void didAccessInitialDocument(); |
| 100 | 109 |
| 101 // If the initial empty document is showing and has been accessed, this | 110 // If the initial empty document is showing and has been accessed, this |
| 102 // cancels the timer and immediately notifies the client in cases that | 111 // cancels the timer and immediately notifies the client in cases that |
| 103 // waiting to notify would allow a URL spoof. | 112 // waiting to notify would allow a URL spoof. |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 169 bool allowPlugins(ReasonForCallingAllowPlugins); | 178 bool allowPlugins(ReasonForCallingAllowPlugins); |
| 170 | 179 |
| 171 void updateForSameDocumentNavigation(const KURL&, SameDocumentNavigationSour
ce, PassRefPtr<SerializedScriptValue>, FrameLoadType); | 180 void updateForSameDocumentNavigation(const KURL&, SameDocumentNavigationSour
ce, PassRefPtr<SerializedScriptValue>, FrameLoadType); |
| 172 | 181 |
| 173 HistoryItem* currentItem() const { return m_currentItem.get(); } | 182 HistoryItem* currentItem() const { return m_currentItem.get(); } |
| 174 void saveScrollState(); | 183 void saveScrollState(); |
| 175 void clearScrollPositionAndViewState(); | 184 void clearScrollPositionAndViewState(); |
| 176 | 185 |
| 177 void restoreScrollPositionAndViewState(); | 186 void restoreScrollPositionAndViewState(); |
| 178 | 187 |
| 188 void trace(Visitor*); |
| 189 |
| 179 private: | 190 private: |
| 180 bool allChildrenAreComplete() const; // immediate children, not all descenda
nts | 191 bool allChildrenAreComplete() const; // immediate children, not all descenda
nts |
| 181 | 192 |
| 182 void completed(); | 193 void completed(); |
| 183 | 194 |
| 184 void checkTimerFired(Timer<FrameLoader>*); | 195 void checkTimerFired(Timer<FrameLoader>*); |
| 185 void didAccessInitialDocumentTimerFired(Timer<FrameLoader>*); | 196 void didAccessInitialDocumentTimerFired(Timer<FrameLoader>*); |
| 186 | 197 |
| 187 bool prepareRequestForThisFrame(FrameLoadRequest&); | 198 bool prepareRequestForThisFrame(FrameLoadRequest&); |
| 188 void setReferrerForFrameRequest(ResourceRequest&, ShouldSendReferrer, Docume
nt*); | 199 void setReferrerForFrameRequest(ResourceRequest&, ShouldSendReferrer, Docume
nt*); |
| (...skipping 14 matching lines...) Expand all Loading... |
| 203 bool validateTransitionNavigationMode(); | 214 bool validateTransitionNavigationMode(); |
| 204 bool dispatchNavigationTransitionData(); | 215 bool dispatchNavigationTransitionData(); |
| 205 void detachClient(); | 216 void detachClient(); |
| 206 | 217 |
| 207 void setHistoryItemStateForCommit(HistoryCommitType, bool isPushOrReplaceSta
te = false, PassRefPtr<SerializedScriptValue> = nullptr); | 218 void setHistoryItemStateForCommit(HistoryCommitType, bool isPushOrReplaceSta
te = false, PassRefPtr<SerializedScriptValue> = nullptr); |
| 208 | 219 |
| 209 void loadInSameDocument(const KURL&, PassRefPtr<SerializedScriptValue> state
Object, FrameLoadType, ClientRedirectPolicy); | 220 void loadInSameDocument(const KURL&, PassRefPtr<SerializedScriptValue> state
Object, FrameLoadType, ClientRedirectPolicy); |
| 210 | 221 |
| 211 void scheduleCheckCompleted(); | 222 void scheduleCheckCompleted(); |
| 212 | 223 |
| 213 LocalFrame* m_frame; | 224 RawPtrWillBeMember<LocalFrame> m_frame; |
| 214 | 225 |
| 215 // FIXME: These should be OwnPtr<T> to reduce build times and simplify | 226 // FIXME: These should be OwnPtr<T> to reduce build times and simplify |
| 216 // header dependencies unless performance testing proves otherwise. | 227 // header dependencies unless performance testing proves otherwise. |
| 217 // Some of these could be lazily created for memory savings on devices. | 228 // Some of these could be lazily created for memory savings on devices. |
| 218 mutable FrameLoaderStateMachine m_stateMachine; | 229 mutable FrameLoaderStateMachine m_stateMachine; |
| 219 | 230 |
| 220 OwnPtr<ProgressTracker> m_progressTracker; | 231 OwnPtr<ProgressTracker> m_progressTracker; |
| 221 | 232 |
| 222 FrameState m_state; | 233 FrameState m_state; |
| 223 FrameLoadType m_loadType; | 234 FrameLoadType m_loadType; |
| 224 | 235 |
| 225 // Document loaders for the three phases of frame loading. Note that while | 236 // Document loaders for the three phases of frame loading. Note that while |
| 226 // a new request is being loaded, the old document loader may still be refer
enced. | 237 // a new request is being loaded, the old document loader may still be refer
enced. |
| 227 // E.g. while a new request is in the "policy" state, the old document loade
r may | 238 // E.g. while a new request is in the "policy" state, the old document loade
r may |
| 228 // be consulted in particular as it makes sense to imply certain settings on
the new loader. | 239 // be consulted in particular as it makes sense to imply certain settings on
the new loader. |
| 229 RefPtr<DocumentLoader> m_documentLoader; | 240 RefPtr<DocumentLoader> m_documentLoader; |
| 230 RefPtr<DocumentLoader> m_provisionalDocumentLoader; | 241 RefPtr<DocumentLoader> m_provisionalDocumentLoader; |
| 231 RefPtr<DocumentLoader> m_policyDocumentLoader; | 242 RefPtr<DocumentLoader> m_policyDocumentLoader; |
| 232 OwnPtr<FetchContext> m_fetchContext; | 243 OwnPtrWillBeMember<FetchContext> m_fetchContext; |
| 233 | 244 |
| 234 RefPtr<HistoryItem> m_currentItem; | 245 RefPtr<HistoryItem> m_currentItem; |
| 235 RefPtr<HistoryItem> m_provisionalItem; | 246 RefPtr<HistoryItem> m_provisionalItem; |
| 236 struct DeferredHistoryLoad { | 247 struct DeferredHistoryLoad { |
| 237 DeferredHistoryLoad(HistoryItem* item, HistoryLoadType type, ResourceReq
uestCachePolicy cachePolicy) | 248 DeferredHistoryLoad(HistoryItem* item, HistoryLoadType type, ResourceReq
uestCachePolicy cachePolicy) |
| 238 : m_item(item) | 249 : m_item(item) |
| 239 , m_type(type) | 250 , m_type(type) |
| 240 , m_cachePolicy(cachePolicy) | 251 , m_cachePolicy(cachePolicy) |
| 241 { | 252 { |
| 242 } | 253 } |
| (...skipping 14 matching lines...) Expand all Loading... |
| 257 | 268 |
| 258 bool m_didAccessInitialDocument; | 269 bool m_didAccessInitialDocument; |
| 259 Timer<FrameLoader> m_didAccessInitialDocumentTimer; | 270 Timer<FrameLoader> m_didAccessInitialDocumentTimer; |
| 260 | 271 |
| 261 SandboxFlags m_forcedSandboxFlags; | 272 SandboxFlags m_forcedSandboxFlags; |
| 262 }; | 273 }; |
| 263 | 274 |
| 264 } // namespace blink | 275 } // namespace blink |
| 265 | 276 |
| 266 #endif // FrameLoader_h | 277 #endif // FrameLoader_h |
| OLD | NEW |