Chromium Code Reviews| 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 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 78 void set_accept_language(const std::string& accept_language) { | 78 void set_accept_language(const std::string& accept_language) { |
| 79 accept_language_ = accept_language; | 79 accept_language_ = accept_language; |
| 80 } | 80 } |
| 81 void set_accept_charset(const std::string& accept_charset) { | 81 void set_accept_charset(const std::string& accept_charset) { |
| 82 accept_charset_ = accept_charset; | 82 accept_charset_ = accept_charset; |
| 83 } | 83 } |
| 84 void set_user_agent(const std::string& user_agent) { | 84 void set_user_agent(const std::string& user_agent) { |
| 85 user_agent_ = user_agent; | 85 user_agent_ = user_agent; |
| 86 } | 86 } |
| 87 | 87 |
| 88 // By default it's disabled. | |
| 89 void set_ftp_enabled(bool enable) { | |
|
mmenke
2013/01/22 16:50:37
Should we actually keep this, and create a job fac
willchan no longer on Chromium
2013/01/23 17:14:55
Minor obvious compile-time breakage is OK. They'll
pauljensen
2013/01/23 21:43:33
I added a URLRequestJobFactoryImpl with file, data
| |
| 90 ftp_enabled_ = enable; | |
| 91 } | |
| 92 | |
| 93 // Uses BasicNetworkDelegate by default. Note that calling Build will unset | 88 // Uses BasicNetworkDelegate by default. Note that calling Build will unset |
| 94 // any custom delegate in builder, so this must be called each time before | 89 // any custom delegate in builder, so this must be called each time before |
| 95 // Build is called. | 90 // Build is called. |
| 96 void set_network_delegate(NetworkDelegate* delegate) { | 91 void set_network_delegate(NetworkDelegate* delegate) { |
| 97 network_delegate_.reset(delegate); | 92 network_delegate_.reset(delegate); |
| 98 } | 93 } |
| 99 | 94 |
| 100 // By default HttpCache is enabled with a default constructed HttpCacheParams. | 95 // By default HttpCache is enabled with a default constructed HttpCacheParams. |
| 101 void EnableHttpCache(const HttpCacheParams& params) { | 96 void EnableHttpCache(const HttpCacheParams& params) { |
| 102 http_cache_params_ = params; | 97 http_cache_params_ = params; |
| 103 } | 98 } |
| 104 | 99 |
| 105 void DisableHttpCache() { | 100 void DisableHttpCache() { |
| 106 http_cache_params_ = HttpCacheParams(); | 101 http_cache_params_ = HttpCacheParams(); |
| 107 } | 102 } |
| 108 | 103 |
| 109 // Override default net::HttpNetworkSession::Params settings. | 104 // Override default net::HttpNetworkSession::Params settings. |
| 110 void set_http_network_session_params( | 105 void set_http_network_session_params( |
| 111 const HttpNetworkSessionParams& http_network_session_params) { | 106 const HttpNetworkSessionParams& http_network_session_params) { |
| 112 http_network_session_params_ = http_network_session_params; | 107 http_network_session_params_ = http_network_session_params; |
| 113 } | 108 } |
| 114 | 109 |
| 115 URLRequestContext* Build(); | 110 URLRequestContext* Build(); |
| 116 | 111 |
| 117 private: | 112 private: |
| 118 std::string accept_language_; | 113 std::string accept_language_; |
| 119 std::string accept_charset_; | 114 std::string accept_charset_; |
| 120 std::string user_agent_; | 115 std::string user_agent_; |
| 121 bool ftp_enabled_; | |
| 122 bool http_cache_enabled_; | 116 bool http_cache_enabled_; |
| 123 HttpCacheParams http_cache_params_; | 117 HttpCacheParams http_cache_params_; |
| 124 HttpNetworkSessionParams http_network_session_params_; | 118 HttpNetworkSessionParams http_network_session_params_; |
| 125 #if defined(OS_LINUX) || defined(OS_ANDROID) | 119 #if defined(OS_LINUX) || defined(OS_ANDROID) |
| 126 scoped_ptr<ProxyConfigService> proxy_config_service_; | 120 scoped_ptr<ProxyConfigService> proxy_config_service_; |
| 127 #endif // defined(OS_LINUX) || defined(OS_ANDROID) | 121 #endif // defined(OS_LINUX) || defined(OS_ANDROID) |
| 128 scoped_ptr<NetworkDelegate> network_delegate_; | 122 scoped_ptr<NetworkDelegate> network_delegate_; |
| 129 | 123 |
| 130 DISALLOW_COPY_AND_ASSIGN(URLRequestContextBuilder); | 124 DISALLOW_COPY_AND_ASSIGN(URLRequestContextBuilder); |
| 131 }; | 125 }; |
| 132 | 126 |
| 133 } // namespace net | 127 } // namespace net |
| 134 | 128 |
| 135 #endif // NET_URL_REQUEST_URL_REQUEST_CONTEXT_BUILDER_H_ | 129 #endif // NET_URL_REQUEST_URL_REQUEST_CONTEXT_BUILDER_H_ |
| OLD | NEW |