| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_ |
| 11 #define NET_URL_REQUEST_URL_REQUEST_CONTEXT_H_ | 11 #define NET_URL_REQUEST_URL_REQUEST_CONTEXT_H_ |
| 12 #pragma once | 12 #pragma once |
| 13 | 13 |
| 14 #include <set> |
| 15 |
| 14 #include "base/memory/ref_counted.h" | 16 #include "base/memory/ref_counted.h" |
| 15 #include "base/memory/scoped_ptr.h" | 17 #include "base/memory/scoped_ptr.h" |
| 16 #include "base/memory/weak_ptr.h" | 18 #include "base/memory/weak_ptr.h" |
| 17 #include "base/threading/non_thread_safe.h" | 19 #include "base/threading/non_thread_safe.h" |
| 18 #include "net/base/net_export.h" | 20 #include "net/base/net_export.h" |
| 19 #include "net/base/net_log.h" | 21 #include "net/base/net_log.h" |
| 20 #include "net/base/ssl_config_service.h" | 22 #include "net/base/ssl_config_service.h" |
| 21 #include "net/base/transport_security_state.h" | 23 #include "net/base/transport_security_state.h" |
| 22 #include "net/http/http_server_properties.h" | 24 #include "net/http/http_server_properties.h" |
| 23 #include "net/ftp/ftp_auth_cache.h" | 25 #include "net/ftp/ftp_auth_cache.h" |
| (...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 182 const std::string& referrer_charset() const { return referrer_charset_; } | 184 const std::string& referrer_charset() const { return referrer_charset_; } |
| 183 void set_referrer_charset(const std::string& charset) { | 185 void set_referrer_charset(const std::string& charset) { |
| 184 referrer_charset_ = charset; | 186 referrer_charset_ = charset; |
| 185 } | 187 } |
| 186 | 188 |
| 187 const URLRequestJobFactory* job_factory() const { return job_factory_; } | 189 const URLRequestJobFactory* job_factory() const { return job_factory_; } |
| 188 void set_job_factory(const URLRequestJobFactory* job_factory) { | 190 void set_job_factory(const URLRequestJobFactory* job_factory) { |
| 189 job_factory_ = job_factory; | 191 job_factory_ = job_factory; |
| 190 } | 192 } |
| 191 | 193 |
| 194 // Gets the URLRequest objects that hold a reference to this |
| 195 // URLRequestContext. |
| 196 std::set<const URLRequest*>* url_requests() const { |
| 197 return url_requests_.get(); |
| 198 } |
| 199 |
| 192 protected: | 200 protected: |
| 193 friend class base::RefCountedThreadSafe<URLRequestContext>; | 201 friend class base::RefCountedThreadSafe<URLRequestContext>; |
| 194 | 202 |
| 195 virtual ~URLRequestContext(); | 203 virtual ~URLRequestContext(); |
| 196 | 204 |
| 197 private: | 205 private: |
| 198 base::WeakPtrFactory<URLRequestContext> weak_factory_; | 206 base::WeakPtrFactory<URLRequestContext> weak_factory_; |
| 199 | 207 |
| 200 // --------------------------------------------------------------------------- | 208 // --------------------------------------------------------------------------- |
| 201 // Important: When adding any new members below, consider whether they need to | 209 // Important: When adding any new members below, consider whether they need to |
| (...skipping 23 matching lines...) Expand all Loading... |
| 225 std::string referrer_charset_; | 233 std::string referrer_charset_; |
| 226 HttpTransactionFactory* http_transaction_factory_; | 234 HttpTransactionFactory* http_transaction_factory_; |
| 227 FtpTransactionFactory* ftp_transaction_factory_; | 235 FtpTransactionFactory* ftp_transaction_factory_; |
| 228 const URLRequestJobFactory* job_factory_; | 236 const URLRequestJobFactory* job_factory_; |
| 229 | 237 |
| 230 // --------------------------------------------------------------------------- | 238 // --------------------------------------------------------------------------- |
| 231 // Important: When adding any new members below, consider whether they need to | 239 // Important: When adding any new members below, consider whether they need to |
| 232 // be added to CopyFrom. | 240 // be added to CopyFrom. |
| 233 // --------------------------------------------------------------------------- | 241 // --------------------------------------------------------------------------- |
| 234 | 242 |
| 243 scoped_ptr<std::set<const URLRequest*> > url_requests_; |
| 244 |
| 235 DISALLOW_COPY_AND_ASSIGN(URLRequestContext); | 245 DISALLOW_COPY_AND_ASSIGN(URLRequestContext); |
| 236 }; | 246 }; |
| 237 | 247 |
| 238 } // namespace net | 248 } // namespace net |
| 239 | 249 |
| 240 #endif // NET_URL_REQUEST_URL_REQUEST_CONTEXT_H_ | 250 #endif // NET_URL_REQUEST_URL_REQUEST_CONTEXT_H_ |
| OLD | NEW |