180bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru/*
280bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru * Copyright (C) 2013 Google Inc. All rights reserved.
380bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru *
480bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru * Redistribution and use in source and binary forms, with or without
580bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru * modification, are permitted provided that the following conditions are
680bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru * met:
780bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru *
880bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru *     * Redistributions of source code must retain the above copyright
980bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru * notice, this list of conditions and the following disclaimer.
1080bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru *     * Redistributions in binary form must reproduce the above
1180bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru * copyright notice, this list of conditions and the following disclaimer
1280bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru * in the documentation and/or other materials provided with the
1380bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru * distribution.
1480bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru *     * Neither the name of Google Inc. nor the names of its
1580bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru * contributors may be used to endorse or promote products derived from
1680bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru * this software without specific prior written permission.
1780bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru *
1880bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
1980bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
2080bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
2180bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
2280bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
2380bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
2480bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
2580bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
2680bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
2780bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
2880bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
2980bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru */
3080bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru
3180bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru#ifndef FrameFetchContext_h
3280bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru#define FrameFetchContext_h
3380bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru
3480bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru#include "core/fetch/FetchContext.h"
3580bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru#include "platform/heap/Handle.h"
3680bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru#include "platform/network/ResourceRequest.h"
3780bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru#include "wtf/PassOwnPtr.h"
3880bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru
3980bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Querunamespace blink {
4080bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru
4180bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queruclass Document;
4280bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queruclass DocumentLoader;
4380bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queruclass LocalFrame;
4480bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queruclass ResourceError;
4580bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queruclass ResourceLoader;
4680bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queruclass ResourceResponse;
4780bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queruclass ResourceRequest;
4880bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru
4980bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queruclass FrameFetchContext FINAL : public FetchContext {
5080bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Querupublic:
5180bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru    static PassOwnPtrWillBeRawPtr<FrameFetchContext> create(LocalFrame* frame)
5280bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru    {
5380bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru        return adoptPtrWillBeNoop(new FrameFetchContext(frame));
5480bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru    }
5580bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru
5680bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru    virtual void reportLocalLoadFailed(const KURL&) OVERRIDE;
5780bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru    virtual void addAdditionalRequestHeaders(Document*, ResourceRequest&, FetchResourceType) OVERRIDE;
5880bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru    virtual void setFirstPartyForCookies(ResourceRequest&) OVERRIDE;
5980bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru    virtual CachePolicy cachePolicy(Document*) const OVERRIDE;
6080bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru    virtual void dispatchDidChangeResourcePriority(unsigned long identifier, ResourceLoadPriority, int intraPriorityValue);
6180bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru    virtual void dispatchWillSendRequest(DocumentLoader*, unsigned long identifier, ResourceRequest&, const ResourceResponse& redirectResponse, const FetchInitiatorInfo& = FetchInitiatorInfo()) OVERRIDE;
6280bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru    virtual void dispatchDidLoadResourceFromMemoryCache(const ResourceRequest&, const ResourceResponse&) OVERRIDE;
6380bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru    virtual void dispatchDidReceiveResponse(DocumentLoader*, unsigned long identifier, const ResourceResponse&, ResourceLoader* = 0) OVERRIDE;
6480bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru    virtual void dispatchDidReceiveData(DocumentLoader*, unsigned long identifier, const char* data, int dataLength, int encodedDataLength) OVERRIDE;
6580bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru    virtual void dispatchDidDownloadData(DocumentLoader*, unsigned long identifier, int dataLength, int encodedDataLength)  OVERRIDE;
6680bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru    virtual void dispatchDidFinishLoading(DocumentLoader*, unsigned long identifier, double finishTime, int64_t encodedDataLength) OVERRIDE;
6780bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru    virtual void dispatchDidFail(DocumentLoader*, unsigned long identifier, const ResourceError&) OVERRIDE;
6880bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru    virtual void sendRemainingDelegateMessages(DocumentLoader*, unsigned long identifier, const ResourceResponse&, int dataLength) OVERRIDE;
6980bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru
7080bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru    virtual void trace(Visitor*) OVERRIDE;
7180bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru
7280bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queruprivate:
7380bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru    explicit FrameFetchContext(LocalFrame*);
7480bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru    inline DocumentLoader* ensureLoader(DocumentLoader*);
7580bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru
7680bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru    RawPtrWillBeMember<LocalFrame> m_frame;
7780bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru};
7880bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru
7980bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru}
8080bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru
8180bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru#endif
8280bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru