Home | History | Annotate | Download | only in chromium
      1 /*
      2  * Copyright (C) 2003, 2006 Apple Computer, Inc.  All rights reserved.
      3  * Copyright (C) 2006 Samuel Weinig <sam.weinig (at) gmail.com>
      4  * Copyright (C) 2008 Google, Inc.
      5  *
      6  * Redistribution and use in source and binary forms, with or without
      7  * modification, are permitted provided that the following conditions
      8  * are met:
      9  * 1. Redistributions of source code must retain the above copyright
     10  *    notice, this list of conditions and the following disclaimer.
     11  * 2. Redistributions in binary form must reproduce the above copyright
     12  *    notice, this list of conditions and the following disclaimer in the
     13  *    documentation and/or other materials provided with the distribution.
     14  *
     15  * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
     16  * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
     17  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
     18  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE COMPUTER, INC. OR
     19  * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
     20  * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
     21  * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
     22  * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
     23  * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
     24  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
     25  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
     26  */
     27 
     28 #ifndef ResourceRequest_h
     29 #define ResourceRequest_h
     30 
     31 #include "ResourceRequestBase.h"
     32 
     33 namespace WebCore {
     34 
     35     class Frame;
     36 
     37     class ResourceRequest : public ResourceRequestBase {
     38     public:
     39         ResourceRequest(const String& url)
     40             : ResourceRequestBase(KURL(ParsedURLString, url), UseProtocolCachePolicy)
     41             , m_requestorID(0)
     42             , m_requestorProcessID(0)
     43             , m_appCacheHostID(0)
     44         {
     45         }
     46 
     47         ResourceRequest(const KURL& url)
     48             : ResourceRequestBase(url, UseProtocolCachePolicy)
     49             , m_requestorID(0)
     50             , m_requestorProcessID(0)
     51             , m_appCacheHostID(0)
     52         {
     53         }
     54 
     55         ResourceRequest(const KURL& url, const String& referrer, ResourceRequestCachePolicy policy = UseProtocolCachePolicy)
     56             : ResourceRequestBase(url, policy)
     57             , m_requestorID(0)
     58             , m_requestorProcessID(0)
     59             , m_appCacheHostID(0)
     60         {
     61             setHTTPReferrer(referrer);
     62         }
     63 
     64         ResourceRequest()
     65             : ResourceRequestBase(KURL(), UseProtocolCachePolicy)
     66             , m_requestorID(0)
     67             , m_requestorProcessID(0)
     68             , m_appCacheHostID(0)
     69         {
     70         }
     71 
     72         // Allows the request to be matched up with its requestor.
     73         int requestorID() const { return m_requestorID; }
     74         void setRequestorID(int requestorID) { m_requestorID = requestorID; }
     75 
     76         // The process id of the process from which this request originated. In
     77         // the case of out-of-process plugins, this allows to link back the
     78         // request to the plugin process (as it is processed through a render
     79         // view process).
     80         int requestorProcessID() const { return m_requestorProcessID; }
     81         void setRequestorProcessID(int requestorProcessID) { m_requestorProcessID = requestorProcessID; }
     82 
     83         // Allows the request to be matched up with its app cache host.
     84         int appCacheHostID() const { return m_appCacheHostID; }
     85         void setAppCacheHostID(int id) { m_appCacheHostID = id; }
     86 
     87     private:
     88         friend class ResourceRequestBase;
     89 
     90         void doUpdatePlatformRequest() {}
     91         void doUpdateResourceRequest() {}
     92 
     93         int m_requestorID;
     94         int m_requestorProcessID;
     95         int m_appCacheHostID;
     96     };
     97 
     98 } // namespace WebCore
     99 
    100 #endif
    101