| 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 // FIXME: dispose() is trying to do too many things. We should break it down
into smaller functions. |
| 104 void clear(); | 106 void dispose(bool clearFrameContents); |
| 105 void replaceDocumentWhileExecutingJavaScriptURL(const String& source, Docume
nt* ownerDocument); | 107 void replaceDocumentWhileExecutingJavaScriptURL(const String& source, Docume
nt* ownerDocument); |
| 106 | 108 |
| 107 // Sets a timer to notify the client that the initial empty document has | 109 // 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 | 110 // been accessed, and thus it is no longer safe to show a provisional URL |
| 109 // above the document without risking a URL spoof. | 111 // above the document without risking a URL spoof. |
| 110 void didAccessInitialDocument(); | 112 void didAccessInitialDocument(); |
| 111 | 113 |
| 112 // If the initial empty document is showing and has been accessed, this | 114 // If the initial empty document is showing and has been accessed, this |
| 113 // cancels the timer and immediately notifies the client in cases that | 115 // cancels the timer and immediately notifies the client in cases that |
| 114 // waiting to notify would allow a URL spoof. | 116 // waiting to notify would allow a URL spoof. |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 182 bool allowPlugins(ReasonForCallingAllowPlugins); | 184 bool allowPlugins(ReasonForCallingAllowPlugins); |
| 183 | 185 |
| 184 void updateForSameDocumentNavigation(const KURL&, SameDocumentNavigationSour
ce, PassRefPtr<SerializedScriptValue>, FrameLoadType); | 186 void updateForSameDocumentNavigation(const KURL&, SameDocumentNavigationSour
ce, PassRefPtr<SerializedScriptValue>, FrameLoadType); |
| 185 | 187 |
| 186 HistoryItem* currentItem() const { return m_currentItem.get(); } | 188 HistoryItem* currentItem() const { return m_currentItem.get(); } |
| 187 void saveScrollState(); | 189 void saveScrollState(); |
| 188 void clearScrollPositionAndViewState(); | 190 void clearScrollPositionAndViewState(); |
| 189 | 191 |
| 190 void restoreScrollPositionAndViewState(); | 192 void restoreScrollPositionAndViewState(); |
| 191 | 193 |
| 194 void trace(Visitor*); |
| 195 |
| 192 private: | 196 private: |
| 193 bool allChildrenAreComplete() const; // immediate children, not all descenda
nts | 197 bool allChildrenAreComplete() const; // immediate children, not all descenda
nts |
| 194 | 198 |
| 195 void completed(); | 199 void completed(); |
| 196 | 200 |
| 197 void checkTimerFired(Timer<FrameLoader>*); | 201 void checkTimerFired(Timer<FrameLoader>*); |
| 198 void didAccessInitialDocumentTimerFired(Timer<FrameLoader>*); | 202 void didAccessInitialDocumentTimerFired(Timer<FrameLoader>*); |
| 199 | 203 |
| 200 bool prepareRequestForThisFrame(FrameLoadRequest&); | 204 bool prepareRequestForThisFrame(FrameLoadRequest&); |
| 201 void setReferrerForFrameRequest(ResourceRequest&, ShouldSendReferrer, Docume
nt*); | 205 void setReferrerForFrameRequest(ResourceRequest&, ShouldSendReferrer, Docume
nt*); |
| (...skipping 14 matching lines...) Expand all Loading... |
| 216 bool validateTransitionNavigationMode(); | 220 bool validateTransitionNavigationMode(); |
| 217 bool dispatchNavigationTransitionData(); | 221 bool dispatchNavigationTransitionData(); |
| 218 void detachClient(); | 222 void detachClient(); |
| 219 | 223 |
| 220 void setHistoryItemStateForCommit(HistoryCommitType, bool isPushOrReplaceSta
te = false, PassRefPtr<SerializedScriptValue> = nullptr); | 224 void setHistoryItemStateForCommit(HistoryCommitType, bool isPushOrReplaceSta
te = false, PassRefPtr<SerializedScriptValue> = nullptr); |
| 221 | 225 |
| 222 void loadInSameDocument(const KURL&, PassRefPtr<SerializedScriptValue> state
Object, FrameLoadType, ClientRedirectPolicy); | 226 void loadInSameDocument(const KURL&, PassRefPtr<SerializedScriptValue> state
Object, FrameLoadType, ClientRedirectPolicy); |
| 223 | 227 |
| 224 void scheduleCheckCompleted(); | 228 void scheduleCheckCompleted(); |
| 225 | 229 |
| 226 LocalFrame* m_frame; | 230 RawPtrWillBeMember<LocalFrame> m_frame; |
| 227 | 231 |
| 228 // FIXME: These should be OwnPtr<T> to reduce build times and simplify | 232 // FIXME: These should be OwnPtr<T> to reduce build times and simplify |
| 229 // header dependencies unless performance testing proves otherwise. | 233 // header dependencies unless performance testing proves otherwise. |
| 230 // Some of these could be lazily created for memory savings on devices. | 234 // Some of these could be lazily created for memory savings on devices. |
| 231 mutable FrameLoaderStateMachine m_stateMachine; | 235 mutable FrameLoaderStateMachine m_stateMachine; |
| 232 mutable MixedContentChecker m_mixedContentChecker; | 236 mutable MixedContentChecker m_mixedContentChecker; |
| 233 | 237 |
| 234 OwnPtr<ProgressTracker> m_progressTracker; | 238 OwnPtr<ProgressTracker> m_progressTracker; |
| 235 | 239 |
| 236 FrameState m_state; | 240 FrameState m_state; |
| 237 FrameLoadType m_loadType; | 241 FrameLoadType m_loadType; |
| 238 | 242 |
| 239 // Document loaders for the three phases of frame loading. Note that while | 243 // Document loaders for the three phases of frame loading. Note that while |
| 240 // a new request is being loaded, the old document loader may still be refer
enced. | 244 // a new request is being loaded, the old document loader may still be refer
enced. |
| 241 // E.g. while a new request is in the "policy" state, the old document loade
r may | 245 // E.g. while a new request is in the "policy" state, the old document loade
r may |
| 242 // be consulted in particular as it makes sense to imply certain settings on
the new loader. | 246 // be consulted in particular as it makes sense to imply certain settings on
the new loader. |
| 243 RefPtr<DocumentLoader> m_documentLoader; | 247 RefPtr<DocumentLoader> m_documentLoader; |
| 244 RefPtr<DocumentLoader> m_provisionalDocumentLoader; | 248 RefPtr<DocumentLoader> m_provisionalDocumentLoader; |
| 245 RefPtr<DocumentLoader> m_policyDocumentLoader; | 249 RefPtr<DocumentLoader> m_policyDocumentLoader; |
| 246 OwnPtr<FetchContext> m_fetchContext; | 250 OwnPtrWillBeMember<FetchContext> m_fetchContext; |
| 247 | 251 |
| 248 RefPtr<HistoryItem> m_currentItem; | 252 RefPtr<HistoryItem> m_currentItem; |
| 249 RefPtr<HistoryItem> m_provisionalItem; | 253 RefPtr<HistoryItem> m_provisionalItem; |
| 250 struct DeferredHistoryLoad { | 254 struct DeferredHistoryLoad { |
| 251 DeferredHistoryLoad(HistoryItem* item, HistoryLoadType type, ResourceReq
uestCachePolicy cachePolicy) | 255 DeferredHistoryLoad(HistoryItem* item, HistoryLoadType type, ResourceReq
uestCachePolicy cachePolicy) |
| 252 : m_item(item) | 256 : m_item(item) |
| 253 , m_type(type) | 257 , m_type(type) |
| 254 , m_cachePolicy(cachePolicy) | 258 , m_cachePolicy(cachePolicy) |
| 255 { | 259 { |
| 256 } | 260 } |
| (...skipping 14 matching lines...) Expand all Loading... |
| 271 | 275 |
| 272 bool m_didAccessInitialDocument; | 276 bool m_didAccessInitialDocument; |
| 273 Timer<FrameLoader> m_didAccessInitialDocumentTimer; | 277 Timer<FrameLoader> m_didAccessInitialDocumentTimer; |
| 274 | 278 |
| 275 SandboxFlags m_forcedSandboxFlags; | 279 SandboxFlags m_forcedSandboxFlags; |
| 276 }; | 280 }; |
| 277 | 281 |
| 278 } // namespace blink | 282 } // namespace blink |
| 279 | 283 |
| 280 #endif // FrameLoader_h | 284 #endif // FrameLoader_h |
| OLD | NEW |