OLD | NEW |
| (Empty) |
1 // -*- mode: c++; c-basic-offset: 4 -*- | |
2 /* | |
3 * Copyright (C) 2003, 2006 Apple Computer, Inc. All rights reserved. | |
4 * Copyright (C) 2006 Samuel Weinig <sam.weinig@gmail.com> | |
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 "CString.h" | |
32 #include "ResourceRequestBase.h" | |
33 | |
34 #include "webkit/glue/resource_type.h" | |
35 | |
36 namespace WebCore { | |
37 | |
38 class Frame; | |
39 | |
40 class ResourceRequest : public ResourceRequestBase { | |
41 public: | |
42 ResourceRequest(const String& url) | |
43 : ResourceRequestBase(KURL(url), UseProtocolCachePolicy) | |
44 , m_frame(0) | |
45 , m_originPid(0) | |
46 , m_resourceType(ResourceType::SUB_RESOURCE) | |
47 { | |
48 } | |
49 | |
50 ResourceRequest(const KURL& url, const CString& securityInfo) | |
51 : ResourceRequestBase(url, UseProtocolCachePolicy) | |
52 , m_frame(0) | |
53 , m_originPid(0) | |
54 , m_resourceType(ResourceType::SUB_RESOURCE) | |
55 , m_securityInfo(securityInfo) | |
56 { | |
57 } | |
58 | |
59 ResourceRequest(const KURL& url) | |
60 : ResourceRequestBase(url, UseProtocolCachePolicy) | |
61 , m_frame(0) | |
62 , m_originPid(0) | |
63 , m_resourceType(ResourceType::SUB_RESOURCE) | |
64 { | |
65 } | |
66 | |
67 ResourceRequest(const KURL& url, const String& referrer, ResourceRequest
CachePolicy policy = UseProtocolCachePolicy) | |
68 : ResourceRequestBase(url, policy) | |
69 , m_frame(0) | |
70 , m_originPid(0) | |
71 , m_resourceType(ResourceType::SUB_RESOURCE) | |
72 { | |
73 setHTTPReferrer(referrer); | |
74 } | |
75 | |
76 ResourceRequest() | |
77 : ResourceRequestBase(KURL(), UseProtocolCachePolicy) | |
78 , m_frame(0) | |
79 , m_originPid(0) | |
80 , m_resourceType(ResourceType::SUB_RESOURCE) | |
81 { | |
82 } | |
83 | |
84 // provides context for the resource request | |
85 Frame* frame() const { return m_frame; } | |
86 void setFrame(Frame* frame) { m_frame = frame; } | |
87 | |
88 // What this request is for. | |
89 void setResourceType(ResourceType::Type type) { | |
90 m_resourceType = type; | |
91 } | |
92 ResourceType::Type resourceType() const { | |
93 return m_resourceType; | |
94 } | |
95 | |
96 // The origin pid is the process id of the process from which this | |
97 // request originated. In the case of out-of-process plugins, this | |
98 // allows to link back the request to the plugin process (as it is | |
99 // processed through a render view process). | |
100 int originPid() const { return m_originPid; } | |
101 void setOriginPid(int originPid) { | |
102 m_originPid = originPid; | |
103 } | |
104 | |
105 // Opaque state that describes the security state (including SSL | |
106 // connection state) for that resource that should be reported when the | |
107 // resource has been loaded. This is used to simulate secure connection | |
108 // for request (typically when showing error page, so the error page has | |
109 // the errors of the page that actually failed). | |
110 // Empty string if not a secure connection. | |
111 CString securityInfo() const { | |
112 return m_securityInfo; | |
113 } | |
114 void setSecurityInfo(const CString& value) { | |
115 m_securityInfo = value; | |
116 } | |
117 | |
118 #if PLATFORM(MAC) | |
119 // WebCore/loader/FrameLoader.cpp calls this on PLATFORM_MAC. | |
120 // TODO(mmentovai): Remove this when Chromium on the Mac no longer | |
121 // uses PLATFORM_MAC. | |
122 void applyWebArchiveHackForMail() {} | |
123 #endif | |
124 | |
125 private: | |
126 friend class ResourceRequestBase; | |
127 | |
128 void doUpdatePlatformRequest() {} | |
129 void doUpdateResourceRequest() {} | |
130 | |
131 Frame* m_frame; | |
132 int m_originPid; | |
133 ResourceType::Type m_resourceType; | |
134 CString m_securityInfo; | |
135 }; | |
136 | |
137 } // namespace WebCore | |
138 | |
139 #endif // ResourceRequest_h | |
OLD | NEW |