| 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 #ifndef SKY_ENGINE_CORE_FETCH_FETCHCONTEXT_H_ | |
| 32 #define SKY_ENGINE_CORE_FETCH_FETCHCONTEXT_H_ | |
| 33 | |
| 34 #include "sky/engine/core/fetch/CachePolicy.h" | |
| 35 #include "sky/engine/core/fetch/FetchInitiatorInfo.h" | |
| 36 #include "sky/engine/core/fetch/Resource.h" | |
| 37 #include "sky/engine/platform/network/ResourceLoadPriority.h" | |
| 38 #include "sky/engine/wtf/Noncopyable.h" | |
| 39 | |
| 40 namespace blink { | |
| 41 | |
| 42 class Document; | |
| 43 class LocalFrame; | |
| 44 class KURL; | |
| 45 class Page; | |
| 46 class ResourceError; | |
| 47 class ResourceLoader; | |
| 48 class ResourceResponse; | |
| 49 class ResourceRequest; | |
| 50 | |
| 51 enum FetchResourceType { | |
| 52 FetchMainResource, | |
| 53 FetchSubresource | |
| 54 }; | |
| 55 | |
| 56 class FetchContext { | |
| 57 WTF_MAKE_NONCOPYABLE(FetchContext); | |
| 58 public: | |
| 59 static FetchContext& nullInstance(); | |
| 60 | |
| 61 FetchContext() { } | |
| 62 virtual ~FetchContext() { } | |
| 63 | |
| 64 virtual void reportLocalLoadFailed(const KURL&); | |
| 65 virtual void addAdditionalRequestHeaders(Document*, ResourceRequest&, FetchR
esourceType); | |
| 66 virtual CachePolicy cachePolicy(Document*) const; | |
| 67 | |
| 68 virtual void dispatchDidChangeResourcePriority(unsigned long identifier, Res
ourceLoadPriority, int intraPriorityValue); | |
| 69 virtual void dispatchWillSendRequest(Document*, unsigned long identifier, Re
sourceRequest&, const ResourceResponse& redirectResponse, const FetchInitiatorIn
fo& = FetchInitiatorInfo()); | |
| 70 virtual void dispatchDidLoadResourceFromMemoryCache(const ResourceRequest&,
const ResourceResponse&); | |
| 71 virtual void dispatchDidReceiveResponse(Document*, unsigned long identifier,
const ResourceResponse&, ResourceLoader* = 0); | |
| 72 virtual void dispatchDidReceiveData(Document*, unsigned long identifier, con
st char* data, int dataLength, int encodedDataLength); | |
| 73 virtual void dispatchDidDownloadData(Document*, unsigned long identifier, in
t dataLength, int encodedDataLength); | |
| 74 virtual void dispatchDidFinishLoading(Document*, unsigned long identifier, d
ouble finishTime, int64_t encodedDataLength); | |
| 75 virtual void dispatchDidFail(Document*, unsigned long identifier, const Reso
urceError&); | |
| 76 virtual void sendRemainingDelegateMessages(Document*, unsigned long identifi
er, const ResourceResponse&, int dataLength); | |
| 77 }; | |
| 78 | |
| 79 } | |
| 80 | |
| 81 #endif // SKY_ENGINE_CORE_FETCH_FETCHCONTEXT_H_ | |
| OLD | NEW |