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 is useful for building a simple URLRequestContext. Most creators | 5 // This class is useful for building a simple URLRequestContext. Most creators |
6 // of new URLRequestContexts should use this helper class to construct it. Call | 6 // of new URLRequestContexts should use this helper class to construct it. Call |
7 // any configuration params, and when done, invoke Build() to construct the | 7 // any configuration params, and when done, invoke Build() to construct the |
8 // URLRequestContext. This URLRequestContext will own all its own storage. | 8 // URLRequestContext. This URLRequestContext will own all its own storage. |
9 // | 9 // |
10 // URLRequestContextBuilder and its associated params classes are initially | 10 // URLRequestContextBuilder and its associated params classes are initially |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
80 } | 80 } |
81 void set_user_agent(const std::string& user_agent) { | 81 void set_user_agent(const std::string& user_agent) { |
82 user_agent_ = user_agent; | 82 user_agent_ = user_agent; |
83 } | 83 } |
84 | 84 |
85 // Control support for data:// requests. By default it's disabled. | 85 // Control support for data:// requests. By default it's disabled. |
86 void set_data_enabled(bool enable) { | 86 void set_data_enabled(bool enable) { |
87 data_enabled_ = enable; | 87 data_enabled_ = enable; |
88 } | 88 } |
89 | 89 |
| 90 #if !defined(DISABLE_FILE_SUPPORT) |
90 // Control support for file:// requests. By default it's disabled. | 91 // Control support for file:// requests. By default it's disabled. |
91 void set_file_enabled(bool enable) { | 92 void set_file_enabled(bool enable) { |
92 file_enabled_ = enable; | 93 file_enabled_ = enable; |
93 } | 94 } |
| 95 #endif |
94 | 96 |
95 #if !defined(DISABLE_FTP_SUPPORT) | 97 #if !defined(DISABLE_FTP_SUPPORT) |
96 // Control support for ftp:// requests. By default it's disabled. | 98 // Control support for ftp:// requests. By default it's disabled. |
97 void set_ftp_enabled(bool enable) { | 99 void set_ftp_enabled(bool enable) { |
98 ftp_enabled_ = enable; | 100 ftp_enabled_ = enable; |
99 } | 101 } |
100 #endif | 102 #endif |
101 | 103 |
102 // By default host_resolver is constructed with CreateDefaultResolver. | 104 // By default host_resolver is constructed with CreateDefaultResolver. |
103 void set_host_resolver(HostResolver* host_resolver) { | 105 void set_host_resolver(HostResolver* host_resolver) { |
(...skipping 24 matching lines...) Expand all Loading... |
128 http_network_session_params_ = http_network_session_params; | 130 http_network_session_params_ = http_network_session_params; |
129 } | 131 } |
130 | 132 |
131 URLRequestContext* Build(); | 133 URLRequestContext* Build(); |
132 | 134 |
133 private: | 135 private: |
134 std::string accept_language_; | 136 std::string accept_language_; |
135 std::string user_agent_; | 137 std::string user_agent_; |
136 // Include support for data:// requests. | 138 // Include support for data:// requests. |
137 bool data_enabled_; | 139 bool data_enabled_; |
| 140 #if !defined(DISABLE_FILE_SUPPORT) |
138 // Include support for file:// requests. | 141 // Include support for file:// requests. |
139 bool file_enabled_; | 142 bool file_enabled_; |
| 143 #endif |
140 #if !defined(DISABLE_FTP_SUPPORT) | 144 #if !defined(DISABLE_FTP_SUPPORT) |
141 // Include support for ftp:// requests. | 145 // Include support for ftp:// requests. |
142 bool ftp_enabled_; | 146 bool ftp_enabled_; |
143 #endif | 147 #endif |
144 bool http_cache_enabled_; | 148 bool http_cache_enabled_; |
145 HttpCacheParams http_cache_params_; | 149 HttpCacheParams http_cache_params_; |
146 HttpNetworkSessionParams http_network_session_params_; | 150 HttpNetworkSessionParams http_network_session_params_; |
147 scoped_ptr<HostResolver> host_resolver_; | 151 scoped_ptr<HostResolver> host_resolver_; |
148 scoped_ptr<ProxyConfigService> proxy_config_service_; | 152 scoped_ptr<ProxyConfigService> proxy_config_service_; |
149 scoped_ptr<NetworkDelegate> network_delegate_; | 153 scoped_ptr<NetworkDelegate> network_delegate_; |
150 scoped_ptr<FtpTransactionFactory> ftp_transaction_factory_; | 154 scoped_ptr<FtpTransactionFactory> ftp_transaction_factory_; |
151 | 155 |
152 DISALLOW_COPY_AND_ASSIGN(URLRequestContextBuilder); | 156 DISALLOW_COPY_AND_ASSIGN(URLRequestContextBuilder); |
153 }; | 157 }; |
154 | 158 |
155 } // namespace net | 159 } // namespace net |
156 | 160 |
157 #endif // NET_URL_REQUEST_URL_REQUEST_CONTEXT_BUILDER_H_ | 161 #endif // NET_URL_REQUEST_URL_REQUEST_CONTEXT_BUILDER_H_ |
OLD | NEW |