15267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)/* 25267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles) * Copyright (C) 2009 Google Inc. All rights reserved. 35267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles) * 45267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles) * Redistribution and use in source and binary forms, with or without 55267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles) * modification, are permitted provided that the following conditions are 65267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles) * met: 75267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles) * 85267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles) * * Redistributions of source code must retain the above copyright 95267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles) * notice, this list of conditions and the following disclaimer. 105267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles) * * Redistributions in binary form must reproduce the above 115267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles) * copyright notice, this list of conditions and the following disclaimer 125267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles) * in the documentation and/or other materials provided with the 135267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles) * distribution. 145267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles) * * Neither the name of Google Inc. nor the names of its 155267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles) * contributors may be used to endorse or promote products derived from 165267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles) * this software without specific prior written permission. 175267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles) * 185267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles) * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 195267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles) * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 205267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles) * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 215267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles) * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 225267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles) * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 235267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles) * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 245267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles) * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 255267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles) * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 265267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles) * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 275267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles) * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 285267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles) * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 295267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles) */ 305267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles) 315267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)#ifndef WebDataSource_h 325267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)#define WebDataSource_h 335267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles) 345267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)#include "../platform/WebCommon.h" 355267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)#include "WebNavigationType.h" 365267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)#include "WebTextDirection.h" 375267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles) 3851b2906e11752df6c18351cf520e30522d3b53a1Torne (Richard Coles)namespace blink { 395267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles) 405267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)class WebApplicationCacheHost; 415267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)class WebString; 425267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)class WebURL; 435267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)class WebURLRequest; 445267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)class WebURLResponse; 455267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)template <typename T> class WebVector; 465267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles) 475267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)class WebDataSource { 485267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)public: 495267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles) class ExtraData { 505267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles) public: 515267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles) virtual ~ExtraData() { } 525267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles) }; 535267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles) 545267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles) // Returns the original request that resulted in this datasource. 555267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles) virtual const WebURLRequest& originalRequest() const = 0; 565267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles) 575267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles) // Returns the request corresponding to this datasource. It may 585267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles) // include additional request headers added by WebKit that were not 595267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles) // present in the original request. This request may also correspond 605267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles) // to a location specified by a redirect that was followed. 615267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles) virtual const WebURLRequest& request() const = 0; 625267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles) 635267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles) // Returns the response associated with this datasource. 645267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles) virtual const WebURLResponse& response() const = 0; 655267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles) 665267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles) // When this datasource was created as a result of WebFrame::loadData, 675267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles) // there may be an associated unreachableURL. 685267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles) virtual bool hasUnreachableURL() const = 0; 695267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles) virtual WebURL unreachableURL() const = 0; 705267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles) 71f79f16f17ddc4f842d7b7a38603e280e94be826aTorne (Richard Coles) // Allows the embedder to append redirects to the chain as a navigation 72f79f16f17ddc4f842d7b7a38603e280e94be826aTorne (Richard Coles) // is starting, in case it is being transferred from another process. 73f79f16f17ddc4f842d7b7a38603e280e94be826aTorne (Richard Coles) virtual void appendRedirect(const WebURL&) = 0; 74f79f16f17ddc4f842d7b7a38603e280e94be826aTorne (Richard Coles) 755267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles) // Returns all redirects that occurred (both client and server) before 765267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles) // at last committing the current page. This will contain one entry 775267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles) // for each intermediate URL, and one entry for the last URL (so if 785267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles) // there are no redirects, it will contain exactly the current URL, and 795267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles) // if there is one redirect, it will contain the source and destination 805267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles) // URL). 815267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles) virtual void redirectChain(WebVector<WebURL>&) const = 0; 825267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles) 835267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles) // Returns whether the navigation associated with this datasource is a 847757ec2eadfa2dd8ac2aeed0a4399e9b07ec38cbBen Murdoch // client redirect. 855267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles) virtual bool isClientRedirect() const = 0; 865267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles) 877757ec2eadfa2dd8ac2aeed0a4399e9b07ec38cbBen Murdoch // Returns whether the navigation associated with this datasource should 887757ec2eadfa2dd8ac2aeed0a4399e9b07ec38cbBen Murdoch // replace the current history item. 897757ec2eadfa2dd8ac2aeed0a4399e9b07ec38cbBen Murdoch virtual bool replacesCurrentHistoryItem() const = 0; 907757ec2eadfa2dd8ac2aeed0a4399e9b07ec38cbBen Murdoch 915267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles) // The type of navigation that triggered the creation of this datasource. 925267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles) virtual WebNavigationType navigationType() const = 0; 935267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles) 945267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles) // The time in seconds (since the epoch) of the event that triggered 955267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles) // the creation of this datasource. Returns 0 if unknown. 965267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles) virtual double triggeringEventTime() const = 0; 975267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles) 985267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles) // Extra data associated with this datasource. If non-null, the extra 995267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles) // data pointer will be deleted when the datasource is destroyed. 1005267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles) // Setting the extra data pointer will cause any existing non-null 1015267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles) // extra data pointer to be deleted. 1025267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles) virtual ExtraData* extraData() const = 0; 1035267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles) virtual void setExtraData(ExtraData*) = 0; 1045267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles) 1055267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles) // Sets the navigation start time for this datasource. Ordinarily, 1065267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles) // navigation start is determined in WebCore. But, in some situations, 1075267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles) // the embedder might have a better value and can override it here. This 1085267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles) // should be called before WebFrameClient::didCommitProvisionalLoad. 1095267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles) // Calling it later may confuse users, because JavaScript may have run and 1105267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles) // the user may have already recorded the original value. 1115267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles) virtual void setNavigationStartTime(double) = 0; 1125267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles) 1135267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)protected: 1145267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles) ~WebDataSource() { } 1155267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)}; 1165267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles) 11751b2906e11752df6c18351cf520e30522d3b53a1Torne (Richard Coles)} // namespace blink 1185267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles) 1195267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)#endif 120