| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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 #include "chrome/browser/net/chrome_url_request_context.h" | 5 #include "chrome/browser/net/chrome_url_request_context.h" |
| 6 | 6 |
| 7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/string_util.h" | 8 #include "base/string_util.h" |
| 9 #include "chrome/browser/browser_process.h" | 9 #include "chrome/browser/browser_process.h" |
| 10 #include "chrome/browser/privacy_blacklist/blacklist.h" | 10 #include "chrome/browser/privacy_blacklist/blacklist.h" |
| (...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 161 bool playback_mode = command_line.HasSwitch(switches::kPlaybackMode); | 161 bool playback_mode = command_line.HasSwitch(switches::kPlaybackMode); |
| 162 | 162 |
| 163 if (record_mode || playback_mode) { | 163 if (record_mode || playback_mode) { |
| 164 // Don't use existing cookies and use an in-memory store. | 164 // Don't use existing cookies and use an in-memory store. |
| 165 context->set_cookie_store(new net::CookieMonster()); | 165 context->set_cookie_store(new net::CookieMonster()); |
| 166 cache->set_mode( | 166 cache->set_mode( |
| 167 record_mode ? net::HttpCache::RECORD : net::HttpCache::PLAYBACK); | 167 record_mode ? net::HttpCache::RECORD : net::HttpCache::PLAYBACK); |
| 168 } | 168 } |
| 169 context->set_http_transaction_factory(cache); | 169 context->set_http_transaction_factory(cache); |
| 170 | 170 |
| 171 // The kWininetFtp switch is Windows specific because we have two FTP | |
| 172 // implementations on Windows. | |
| 173 #if defined(OS_WIN) | |
| 174 if (!command_line.HasSwitch(switches::kWininetFtp)) | |
| 175 context->set_ftp_transaction_factory( | |
| 176 new net::FtpNetworkLayer(context->host_resolver())); | |
| 177 #else | |
| 178 context->set_ftp_transaction_factory( | 171 context->set_ftp_transaction_factory( |
| 179 new net::FtpNetworkLayer(context->host_resolver())); | 172 new net::FtpNetworkLayer(context->host_resolver())); |
| 180 #endif | |
| 181 | 173 |
| 182 // setup cookie store | 174 // setup cookie store |
| 183 if (!context->cookie_store()) { | 175 if (!context->cookie_store()) { |
| 184 DCHECK(!cookie_store_path_.empty()); | 176 DCHECK(!cookie_store_path_.empty()); |
| 185 | 177 |
| 186 scoped_refptr<SQLitePersistentCookieStore> cookie_db = | 178 scoped_refptr<SQLitePersistentCookieStore> cookie_db = |
| 187 new SQLitePersistentCookieStore(cookie_store_path_); | 179 new SQLitePersistentCookieStore(cookie_store_path_); |
| 188 context->set_cookie_store(new net::CookieMonster(cookie_db.get())); | 180 context->set_cookie_store(new net::CookieMonster(cookie_db.get())); |
| 189 } | 181 } |
| 190 | 182 |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 265 net::HttpCache* cache = | 257 net::HttpCache* cache = |
| 266 new net::HttpCache(context->host_resolver(), context->proxy_service(), | 258 new net::HttpCache(context->host_resolver(), context->proxy_service(), |
| 267 context->ssl_config_service(), 0); | 259 context->ssl_config_service(), 0); |
| 268 context->set_cookie_store(new net::CookieMonster); | 260 context->set_cookie_store(new net::CookieMonster); |
| 269 context->set_http_transaction_factory(cache); | 261 context->set_http_transaction_factory(cache); |
| 270 | 262 |
| 271 if (CommandLine::ForCurrentProcess()->HasSwitch( | 263 if (CommandLine::ForCurrentProcess()->HasSwitch( |
| 272 switches::kDisableByteRangeSupport)) | 264 switches::kDisableByteRangeSupport)) |
| 273 cache->set_enable_range_support(false); | 265 cache->set_enable_range_support(false); |
| 274 | 266 |
| 275 // The kWininetFtp switch is Windows specific because we have two FTP | |
| 276 // implementations on Windows. | |
| 277 #if defined(OS_WIN) | |
| 278 if (!CommandLine::ForCurrentProcess()->HasSwitch(switches::kWininetFtp)) | |
| 279 context->set_ftp_transaction_factory( | |
| 280 new net::FtpNetworkLayer(context->host_resolver())); | |
| 281 #else | |
| 282 context->set_ftp_transaction_factory( | 267 context->set_ftp_transaction_factory( |
| 283 new net::FtpNetworkLayer(context->host_resolver())); | 268 new net::FtpNetworkLayer(context->host_resolver())); |
| 284 #endif | |
| 285 | 269 |
| 286 // Create a separate AppCacheService for OTR mode. | 270 // Create a separate AppCacheService for OTR mode. |
| 287 context->set_appcache_service( | 271 context->set_appcache_service( |
| 288 new ChromeAppCacheService(profile_dir_path_, true)); | 272 new ChromeAppCacheService(profile_dir_path_, true)); |
| 289 context->appcache_service()->set_request_context(context); | 273 context->appcache_service()->set_request_context(context); |
| 290 | 274 |
| 291 return context; | 275 return context; |
| 292 } | 276 } |
| 293 | 277 |
| 294 // Factory that creates the ChromeURLRequestContext for extensions in incognito | 278 // Factory that creates the ChromeURLRequestContext for extensions in incognito |
| (...skipping 664 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 959 } | 943 } |
| 960 | 944 |
| 961 if (command_line.HasSwitch(switches::kProxyBypassList)) { | 945 if (command_line.HasSwitch(switches::kProxyBypassList)) { |
| 962 proxy_config->ParseNoProxyList( | 946 proxy_config->ParseNoProxyList( |
| 963 WideToASCII(command_line.GetSwitchValue( | 947 WideToASCII(command_line.GetSwitchValue( |
| 964 switches::kProxyBypassList))); | 948 switches::kProxyBypassList))); |
| 965 } | 949 } |
| 966 | 950 |
| 967 return proxy_config; | 951 return proxy_config; |
| 968 } | 952 } |
| OLD | NEW |