OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2006, 2007, 2008 Apple Inc. All rights reserved. | 2 * Copyright (C) 2006, 2007, 2008 Apple Inc. All rights reserved. |
3 * Copyright (C) 2011 Google Inc. All rights reserved. | 3 * Copyright (C) 2011 Google Inc. All rights reserved. |
4 * | 4 * |
5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
6 * modification, are permitted provided that the following conditions | 6 * modification, are permitted provided that the following conditions |
7 * are met: | 7 * are met: |
8 * | 8 * |
9 * 1. Redistributions of source code must retain the above copyright | 9 * 1. Redistributions of source code must retain the above copyright |
10 * notice, this list of conditions and the following disclaimer. | 10 * notice, this list of conditions and the following disclaimer. |
(...skipping 20 matching lines...) Expand all Loading... |
31 | 31 |
32 #include <memory> | 32 #include <memory> |
33 | 33 |
34 #include "core/dom/Document.h" | 34 #include "core/dom/Document.h" |
35 #include "core/dom/WeakIdentifierMap.h" | 35 #include "core/dom/WeakIdentifierMap.h" |
36 #include "core/events/Event.h" | 36 #include "core/events/Event.h" |
37 #include "core/frame/Deprecation.h" | 37 #include "core/frame/Deprecation.h" |
38 #include "core/frame/FrameHost.h" | 38 #include "core/frame/FrameHost.h" |
39 #include "core/frame/LocalDOMWindow.h" | 39 #include "core/frame/LocalDOMWindow.h" |
40 #include "core/frame/LocalFrame.h" | 40 #include "core/frame/LocalFrame.h" |
| 41 #include "core/frame/LocalFrameClient.h" |
41 #include "core/frame/Settings.h" | 42 #include "core/frame/Settings.h" |
42 #include "core/frame/csp/ContentSecurityPolicy.h" | 43 #include "core/frame/csp/ContentSecurityPolicy.h" |
43 #include "core/html/HTMLFrameOwnerElement.h" | 44 #include "core/html/HTMLFrameOwnerElement.h" |
44 #include "core/html/parser/TextResourceDecoder.h" | 45 #include "core/html/parser/TextResourceDecoder.h" |
45 #include "core/inspector/ConsoleMessage.h" | 46 #include "core/inspector/ConsoleMessage.h" |
46 #include "core/inspector/InspectorInstrumentation.h" | 47 #include "core/inspector/InspectorInstrumentation.h" |
47 #include "core/inspector/MainThreadDebugger.h" | 48 #include "core/inspector/MainThreadDebugger.h" |
48 #include "core/loader/FrameFetchContext.h" | 49 #include "core/loader/FrameFetchContext.h" |
49 #include "core/loader/FrameLoader.h" | 50 #include "core/loader/FrameLoader.h" |
50 #include "core/loader/FrameLoaderClient.h" | |
51 #include "core/loader/LinkLoader.h" | 51 #include "core/loader/LinkLoader.h" |
52 #include "core/loader/NetworkHintsInterface.h" | 52 #include "core/loader/NetworkHintsInterface.h" |
53 #include "core/loader/ProgressTracker.h" | 53 #include "core/loader/ProgressTracker.h" |
54 #include "core/loader/appcache/ApplicationCacheHost.h" | 54 #include "core/loader/appcache/ApplicationCacheHost.h" |
55 #include "core/loader/resource/CSSStyleSheetResource.h" | 55 #include "core/loader/resource/CSSStyleSheetResource.h" |
56 #include "core/loader/resource/FontResource.h" | 56 #include "core/loader/resource/FontResource.h" |
57 #include "core/loader/resource/ImageResource.h" | 57 #include "core/loader/resource/ImageResource.h" |
58 #include "core/loader/resource/ScriptResource.h" | 58 #include "core/loader/resource/ScriptResource.h" |
59 #include "core/page/FrameTree.h" | 59 #include "core/page/FrameTree.h" |
60 #include "core/page/Page.h" | 60 #include "core/page/Page.h" |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
124 // where the redirects originated. | 124 // where the redirects originated. |
125 if (m_isClientRedirect) | 125 if (m_isClientRedirect) |
126 appendRedirect(m_frame->document()->url()); | 126 appendRedirect(m_frame->document()->url()); |
127 } | 127 } |
128 | 128 |
129 FrameLoader& DocumentLoader::frameLoader() const { | 129 FrameLoader& DocumentLoader::frameLoader() const { |
130 DCHECK(m_frame); | 130 DCHECK(m_frame); |
131 return m_frame->loader(); | 131 return m_frame->loader(); |
132 } | 132 } |
133 | 133 |
134 FrameLoaderClient& DocumentLoader::frameLoaderClient() const { | 134 LocalFrameClient& DocumentLoader::localFrameClient() const { |
135 DCHECK(m_frame); | 135 DCHECK(m_frame); |
136 FrameLoaderClient* client = m_frame->client(); | 136 LocalFrameClient* client = m_frame->client(); |
137 // LocalFrame clears its |m_client| only after detaching all DocumentLoaders | 137 // LocalFrame clears its |m_client| only after detaching all DocumentLoaders |
138 // (i.e. calls detachFromFrame() which clears |m_frame|) owned by the | 138 // (i.e. calls detachFromFrame() which clears |m_frame|) owned by the |
139 // LocalFrame's FrameLoader. So, if |m_frame| is non nullptr, |client| is | 139 // LocalFrame's FrameLoader. So, if |m_frame| is non nullptr, |client| is |
140 // also non nullptr. | 140 // also non nullptr. |
141 DCHECK(client); | 141 DCHECK(client); |
142 return *client; | 142 return *client; |
143 } | 143 } |
144 | 144 |
145 DocumentLoader::~DocumentLoader() { | 145 DocumentLoader::~DocumentLoader() { |
146 DCHECK(!m_frame); | 146 DCHECK(!m_frame); |
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
233 ViewportDescriptionWrapper* viewport, | 233 ViewportDescriptionWrapper* viewport, |
234 LinkLoader::MediaPreloadPolicy mediaPolicy) { | 234 LinkLoader::MediaPreloadPolicy mediaPolicy) { |
235 LinkLoader::loadLinksFromHeader( | 235 LinkLoader::loadLinksFromHeader( |
236 response().httpHeaderField(HTTPNames::Link), response().url(), | 236 response().httpHeaderField(HTTPNames::Link), response().url(), |
237 m_frame->document(), NetworkHintsInterfaceImpl(), | 237 m_frame->document(), NetworkHintsInterfaceImpl(), |
238 LinkLoader::OnlyLoadResources, mediaPolicy, viewport); | 238 LinkLoader::OnlyLoadResources, mediaPolicy, viewport); |
239 } | 239 } |
240 | 240 |
241 void DocumentLoader::didChangePerformanceTiming() { | 241 void DocumentLoader::didChangePerformanceTiming() { |
242 if (m_frame && m_frame->isMainFrame() && m_state >= Committed) { | 242 if (m_frame && m_frame->isMainFrame() && m_state >= Committed) { |
243 frameLoaderClient().didChangePerformanceTiming(); | 243 localFrameClient().didChangePerformanceTiming(); |
244 } | 244 } |
245 } | 245 } |
246 | 246 |
247 void DocumentLoader::didObserveLoadingBehavior( | 247 void DocumentLoader::didObserveLoadingBehavior( |
248 WebLoadingBehaviorFlag behavior) { | 248 WebLoadingBehaviorFlag behavior) { |
249 if (m_frame && m_frame->isMainFrame()) { | 249 if (m_frame && m_frame->isMainFrame()) { |
250 DCHECK_GE(m_state, Committed); | 250 DCHECK_GE(m_state, Committed); |
251 frameLoaderClient().didObserveLoadingBehavior(behavior); | 251 localFrameClient().didObserveLoadingBehavior(behavior); |
252 } | 252 } |
253 } | 253 } |
254 | 254 |
255 void DocumentLoader::updateForSameDocumentNavigation( | 255 void DocumentLoader::updateForSameDocumentNavigation( |
256 const KURL& newURL, | 256 const KURL& newURL, |
257 SameDocumentNavigationSource sameDocumentNavigationSource) { | 257 SameDocumentNavigationSource sameDocumentNavigationSource) { |
258 KURL oldURL = m_request.url(); | 258 KURL oldURL = m_request.url(); |
259 m_originalRequest.setURL(newURL); | 259 m_originalRequest.setURL(newURL); |
260 m_request.setURL(newURL); | 260 m_request.setURL(newURL); |
261 if (sameDocumentNavigationSource == SameDocumentNavigationHistoryApi) { | 261 if (sameDocumentNavigationSource == SameDocumentNavigationHistoryApi) { |
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
375 | 375 |
376 DCHECK(timing().fetchStart()); | 376 DCHECK(timing().fetchStart()); |
377 appendRedirect(requestURL); | 377 appendRedirect(requestURL); |
378 timing().addRedirect(redirectResponse.url(), requestURL); | 378 timing().addRedirect(redirectResponse.url(), requestURL); |
379 | 379 |
380 // If a redirection happens during a back/forward navigation, don't restore | 380 // If a redirection happens during a back/forward navigation, don't restore |
381 // any state from the old HistoryItem. There is a provisional history item for | 381 // any state from the old HistoryItem. There is a provisional history item for |
382 // back/forward navigation only. In the other case, clearing it is a no-op. | 382 // back/forward navigation only. In the other case, clearing it is a no-op. |
383 frameLoader().clearProvisionalHistoryItem(); | 383 frameLoader().clearProvisionalHistoryItem(); |
384 | 384 |
385 frameLoaderClient().dispatchDidReceiveServerRedirectForProvisionalLoad(); | 385 localFrameClient().dispatchDidReceiveServerRedirectForProvisionalLoad(); |
386 | 386 |
387 return true; | 387 return true; |
388 } | 388 } |
389 | 389 |
390 static bool canShowMIMEType(const String& mimeType, LocalFrame* frame) { | 390 static bool canShowMIMEType(const String& mimeType, LocalFrame* frame) { |
391 if (MIMETypeRegistry::isSupportedMIMEType(mimeType)) | 391 if (MIMETypeRegistry::isSupportedMIMEType(mimeType)) |
392 return true; | 392 return true; |
393 PluginData* pluginData = frame->pluginData(); | 393 PluginData* pluginData = frame->pluginData(); |
394 return !mimeType.isEmpty() && pluginData && | 394 return !mimeType.isEmpty() && pluginData && |
395 pluginData->supportsMimeType(mimeType); | 395 pluginData->supportsMimeType(mimeType); |
(...skipping 416 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
812 m_writer ? m_writer->encoding() : emptyAtom, true, | 812 m_writer ? m_writer->encoding() : emptyAtom, true, |
813 ForceSynchronousParsing); | 813 ForceSynchronousParsing); |
814 if (!source.isNull()) | 814 if (!source.isNull()) |
815 m_writer->appendReplacingData(source); | 815 m_writer->appendReplacingData(source); |
816 endWriting(); | 816 endWriting(); |
817 } | 817 } |
818 | 818 |
819 DEFINE_WEAK_IDENTIFIER_MAP(DocumentLoader); | 819 DEFINE_WEAK_IDENTIFIER_MAP(DocumentLoader); |
820 | 820 |
821 } // namespace blink | 821 } // namespace blink |
OLD | NEW |