OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 // This class represents contextual information (cookies, cache, etc.) | 5 // This class represents contextual information (cookies, cache, etc.) |
6 // that's useful when processing resource requests. | 6 // that's useful when processing resource requests. |
7 // The class is reference-counted so that it can be cleaned up after any | 7 // The class is reference-counted so that it can be cleaned up after any |
8 // requests that are using it have been completed. | 8 // requests that are using it have been completed. |
9 | 9 |
10 #ifndef NET_URL_REQUEST_URL_REQUEST_CONTEXT_H_ | 10 #ifndef NET_URL_REQUEST_URL_REQUEST_CONTEXT_H_ |
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
105 return EmptyString(); | 105 return EmptyString(); |
106 } | 106 } |
107 | 107 |
108 // In general, referrer_charset is not known when URLRequestContext is | 108 // In general, referrer_charset is not known when URLRequestContext is |
109 // constructed. So, we need a setter. | 109 // constructed. So, we need a setter. |
110 const std::string& referrer_charset() const { return referrer_charset_; } | 110 const std::string& referrer_charset() const { return referrer_charset_; } |
111 void set_referrer_charset(const std::string& charset) { | 111 void set_referrer_charset(const std::string& charset) { |
112 referrer_charset_ = charset; | 112 referrer_charset_ = charset; |
113 } | 113 } |
114 | 114 |
115 // Called before adding cookies to requests. Returns true if cookie can | |
116 // be added to the request. The cookie might still be modified though. | |
117 virtual bool InterceptRequestCookies(const URLRequest* request, | |
118 const std::string& cookies) const { | |
119 return true; | |
120 } | |
121 | |
122 // Called before adding cookies from respones to the cookie monster. Returns | |
123 // true if the cookie can be added. The cookie might still be modified though. | |
124 virtual bool InterceptResponseCookie(const URLRequest* request, | |
125 const std::string& cookie) const { | |
126 return true; | |
127 } | |
128 | |
129 protected: | 115 protected: |
130 friend class base::RefCountedThreadSafe<URLRequestContext>; | 116 friend class base::RefCountedThreadSafe<URLRequestContext>; |
131 | 117 |
132 virtual ~URLRequestContext() {} | 118 virtual ~URLRequestContext() {} |
133 | 119 |
134 // The following members are expected to be initialized and owned by | 120 // The following members are expected to be initialized and owned by |
135 // subclasses. | 121 // subclasses. |
136 net::NetLog* net_log_; | 122 net::NetLog* net_log_; |
137 scoped_refptr<net::HostResolver> host_resolver_; | 123 scoped_refptr<net::HostResolver> host_resolver_; |
138 scoped_refptr<net::ProxyService> proxy_service_; | 124 scoped_refptr<net::ProxyService> proxy_service_; |
(...skipping 11 matching lines...) Expand all Loading... |
150 // The charset of the referrer where this request comes from. It's not | 136 // The charset of the referrer where this request comes from. It's not |
151 // used in communication with a server but is used to construct a suggested | 137 // used in communication with a server but is used to construct a suggested |
152 // filename for file download. | 138 // filename for file download. |
153 std::string referrer_charset_; | 139 std::string referrer_charset_; |
154 | 140 |
155 private: | 141 private: |
156 DISALLOW_COPY_AND_ASSIGN(URLRequestContext); | 142 DISALLOW_COPY_AND_ASSIGN(URLRequestContext); |
157 }; | 143 }; |
158 | 144 |
159 #endif // NET_URL_REQUEST_URL_REQUEST_CONTEXT_H_ | 145 #endif // NET_URL_REQUEST_URL_REQUEST_CONTEXT_H_ |
OLD | NEW |