| OLD | NEW |
| (Empty) |
| 1 /* | |
| 2 * Copyright (C) 2013 Google Inc. All rights reserved. | |
| 3 * | |
| 4 * Redistribution and use in source and binary forms, with or without | |
| 5 * modification, are permitted provided that the following conditions are | |
| 6 * met: | |
| 7 * | |
| 8 * * Redistributions of source code must retain the above copyright | |
| 9 * notice, this list of conditions and the following disclaimer. | |
| 10 * * Redistributions in binary form must reproduce the above | |
| 11 * copyright notice, this list of conditions and the following disclaimer | |
| 12 * in the documentation and/or other materials provided with the | |
| 13 * distribution. | |
| 14 * * Neither the name of Google Inc. nor the names of its | |
| 15 * contributors may be used to endorse or promote products derived from | |
| 16 * this software without specific prior written permission. | |
| 17 * | |
| 18 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS | |
| 19 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT | |
| 20 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR | |
| 21 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT | |
| 22 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | |
| 23 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | |
| 24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | |
| 25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | |
| 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | |
| 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | |
| 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | |
| 29 */ | |
| 30 | |
| 31 #include "sky/engine/core/loader/FrameFetchContext.h" | |
| 32 | |
| 33 #include "sky/engine/core/dom/Document.h" | |
| 34 #include "sky/engine/core/frame/FrameConsole.h" | |
| 35 #include "sky/engine/core/frame/LocalFrame.h" | |
| 36 #include "sky/engine/core/loader/FrameLoaderClient.h" | |
| 37 #include "sky/engine/core/page/Page.h" | |
| 38 | |
| 39 namespace blink { | |
| 40 | |
| 41 FrameFetchContext::FrameFetchContext(LocalFrame* frame) | |
| 42 : m_frame(frame) | |
| 43 { | |
| 44 } | |
| 45 | |
| 46 void FrameFetchContext::reportLocalLoadFailed(const KURL& url) | |
| 47 { | |
| 48 FrameLoader::reportLocalLoadFailed(m_frame, url.elidedString()); | |
| 49 } | |
| 50 | |
| 51 void FrameFetchContext::addAdditionalRequestHeaders(Document* document, Resource
Request& request, FetchResourceType type) | |
| 52 { | |
| 53 // FIXME(sky): remove, this is all done by the network service. | |
| 54 } | |
| 55 | |
| 56 CachePolicy FrameFetchContext::cachePolicy(Document* document) const | |
| 57 { | |
| 58 return CachePolicyVerify; | |
| 59 } | |
| 60 | |
| 61 void FrameFetchContext::dispatchDidChangeResourcePriority(unsigned long identifi
er, ResourceLoadPriority loadPriority, int intraPriorityValue) | |
| 62 { | |
| 63 m_frame->loaderClient()->dispatchDidChangeResourcePriority(identifier, loadP
riority, intraPriorityValue); | |
| 64 } | |
| 65 | |
| 66 void FrameFetchContext::dispatchWillSendRequest(Document* document, unsigned lon
g identifier, ResourceRequest& request, const ResourceResponse& redirectResponse
, const FetchInitiatorInfo& initiatorInfo) | |
| 67 { | |
| 68 m_frame->loaderClient()->dispatchWillSendRequest(document, identifier, reque
st, redirectResponse); | |
| 69 } | |
| 70 | |
| 71 void FrameFetchContext::dispatchDidLoadResourceFromMemoryCache(const ResourceReq
uest& request, const ResourceResponse& response) | |
| 72 { | |
| 73 m_frame->loaderClient()->dispatchDidLoadResourceFromMemoryCache(request, res
ponse); | |
| 74 } | |
| 75 | |
| 76 void FrameFetchContext::dispatchDidReceiveResponse(Document* document, unsigned
long identifier, const ResourceResponse& r, ResourceLoader* resourceLoader) | |
| 77 { | |
| 78 m_frame->loaderClient()->dispatchDidReceiveResponse(document, identifier, r)
; | |
| 79 m_frame->console().reportResourceResponseReceived(document, identifier, r); | |
| 80 } | |
| 81 | |
| 82 void FrameFetchContext::dispatchDidReceiveData(Document*, unsigned long identifi
er, const char* data, int dataLength, int encodedDataLength) | |
| 83 { | |
| 84 } | |
| 85 | |
| 86 void FrameFetchContext::dispatchDidDownloadData(Document*, unsigned long identif
ier, int dataLength, int encodedDataLength) | |
| 87 { | |
| 88 } | |
| 89 | |
| 90 void FrameFetchContext::dispatchDidFinishLoading(Document* document, unsigned lo
ng identifier, double finishTime, int64_t encodedDataLength) | |
| 91 { | |
| 92 m_frame->loaderClient()->dispatchDidFinishLoading(document, identifier); | |
| 93 } | |
| 94 | |
| 95 void FrameFetchContext::dispatchDidFail(Document* document, unsigned long identi
fier, const ResourceError& error) | |
| 96 { | |
| 97 } | |
| 98 | |
| 99 void FrameFetchContext::sendRemainingDelegateMessages(Document* document, unsign
ed long identifier, const ResourceResponse& response, int dataLength) | |
| 100 { | |
| 101 if (!response.isNull()) | |
| 102 dispatchDidReceiveResponse(document, identifier, response); | |
| 103 | |
| 104 if (dataLength > 0) | |
| 105 dispatchDidReceiveData(document, identifier, 0, dataLength, 0); | |
| 106 | |
| 107 dispatchDidFinishLoading(document, identifier, 0, 0); | |
| 108 } | |
| 109 | |
| 110 } // namespace blink | |
| OLD | NEW |