OLD | NEW |
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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 13 matching lines...) Expand all Loading... |
24 class ProxyService; | 24 class ProxyService; |
25 } | 25 } |
26 | 26 |
27 // Subclass to provide application-specific context for URLRequest instances. | 27 // Subclass to provide application-specific context for URLRequest instances. |
28 class URLRequestContext : | 28 class URLRequestContext : |
29 public base::RefCountedThreadSafe<URLRequestContext> { | 29 public base::RefCountedThreadSafe<URLRequestContext> { |
30 public: | 30 public: |
31 URLRequestContext() | 31 URLRequestContext() |
32 : proxy_service_(NULL), | 32 : proxy_service_(NULL), |
33 http_transaction_factory_(NULL), | 33 http_transaction_factory_(NULL), |
34 cookie_store_(NULL), | 34 cookie_store_(NULL) { |
35 is_off_the_record_(false) { | |
36 } | 35 } |
37 | 36 |
38 // Get the proxy service for this context. | 37 // Get the proxy service for this context. |
39 net::ProxyService* proxy_service() const { | 38 net::ProxyService* proxy_service() const { |
40 return proxy_service_; | 39 return proxy_service_; |
41 } | 40 } |
42 | 41 |
43 // Gets the http transaction factory for this context. | 42 // Gets the http transaction factory for this context. |
44 net::HttpTransactionFactory* http_transaction_factory() { | 43 net::HttpTransactionFactory* http_transaction_factory() { |
45 return http_transaction_factory_; | 44 return http_transaction_factory_; |
(...skipping 10 matching lines...) Expand all Loading... |
56 | 55 |
57 // Gets the UA string to use for this context. | 56 // Gets the UA string to use for this context. |
58 const std::string& user_agent() const { return user_agent_; } | 57 const std::string& user_agent() const { return user_agent_; } |
59 | 58 |
60 // Gets the value of 'Accept-Charset' header field. | 59 // Gets the value of 'Accept-Charset' header field. |
61 const std::string& accept_charset() const { return accept_charset_; } | 60 const std::string& accept_charset() const { return accept_charset_; } |
62 | 61 |
63 // Gets the value of 'Accept-Language' header field. | 62 // Gets the value of 'Accept-Language' header field. |
64 const std::string& accept_language() const { return accept_language_; } | 63 const std::string& accept_language() const { return accept_language_; } |
65 | 64 |
66 // Returns true if this context is off the record. | |
67 bool is_off_the_record() { return is_off_the_record_; } | |
68 | |
69 // Do not call this directly. TODO(darin): extending from RefCounted* should | 65 // Do not call this directly. TODO(darin): extending from RefCounted* should |
70 // not require a public destructor! | 66 // not require a public destructor! |
71 virtual ~URLRequestContext() {} | 67 virtual ~URLRequestContext() {} |
72 | 68 |
73 protected: | 69 protected: |
74 // The following members are expected to be initialized and owned by | 70 // The following members are expected to be initialized and owned by |
75 // subclasses. | 71 // subclasses. |
76 net::ProxyService* proxy_service_; | 72 net::ProxyService* proxy_service_; |
77 net::HttpTransactionFactory* http_transaction_factory_; | 73 net::HttpTransactionFactory* http_transaction_factory_; |
78 net::CookieMonster* cookie_store_; | 74 net::CookieMonster* cookie_store_; |
79 net::CookiePolicy cookie_policy_; | 75 net::CookiePolicy cookie_policy_; |
80 net::AuthCache ftp_auth_cache_; | 76 net::AuthCache ftp_auth_cache_; |
81 std::string user_agent_; | 77 std::string user_agent_; |
82 bool is_off_the_record_; | |
83 std::string accept_language_; | 78 std::string accept_language_; |
84 std::string accept_charset_; | 79 std::string accept_charset_; |
85 | 80 |
86 private: | 81 private: |
87 DISALLOW_EVIL_CONSTRUCTORS(URLRequestContext); | 82 DISALLOW_EVIL_CONSTRUCTORS(URLRequestContext); |
88 }; | 83 }; |
89 | 84 |
90 #endif // NET_URL_REQUEST_URL_REQUEST_CONTEXT_H_ | 85 #endif // NET_URL_REQUEST_URL_REQUEST_CONTEXT_H_ |
91 | 86 |
OLD | NEW |