Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(17)

Side by Side Diff: chrome/browser/net/chrome_url_request_context.cc

Issue 165386: Fix crash with new FTP in Incognito mode. (Closed)
Patch Set: Created 11 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 #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 189 matching lines...) Expand 10 before | Expand all | Expand 10 after
200 // profile which we reference (see above). 200 // profile which we reference (see above).
201 context->host_resolver_ = 201 context->host_resolver_ =
202 profile->GetOriginalProfile()->GetRequestContext()->host_resolver(); 202 profile->GetOriginalProfile()->GetRequestContext()->host_resolver();
203 context->proxy_service_ = 203 context->proxy_service_ =
204 profile->GetOriginalProfile()->GetRequestContext()->proxy_service(); 204 profile->GetOriginalProfile()->GetRequestContext()->proxy_service();
205 205
206 context->http_transaction_factory_ = 206 context->http_transaction_factory_ =
207 new net::HttpCache(context->host_resolver_, context->proxy_service_, 0); 207 new net::HttpCache(context->host_resolver_, context->proxy_service_, 0);
208 context->cookie_store_ = new net::CookieMonster; 208 context->cookie_store_ = new net::CookieMonster;
209 209
210 // The kNewFtp switch is Windows specific only because we have multiple FTP
wtc 2009/08/12 17:25:50 Nit: pick one of "specific" and "only". We don't
211 // implementations on Windows.
212 #if defined(OS_WIN)
213 if (command_line.HasSwitch(switches::kNewFtp))
214 context->ftp_transaction_factory_ =
215 new net::FtpNetworkLayer(context->host_resolver_);
216 #else
217 context->ftp_transaction_factory_ =
218 new net::FtpNetworkLayer(context->host_resolver_);
219 #endif
220
210 return context; 221 return context;
211 } 222 }
212 223
213 // static 224 // static
214 ChromeURLRequestContext* 225 ChromeURLRequestContext*
215 ChromeURLRequestContext::CreateOffTheRecordForExtensions(Profile* profile) { 226 ChromeURLRequestContext::CreateOffTheRecordForExtensions(Profile* profile) {
216 DCHECK(profile->IsOffTheRecord()); 227 DCHECK(profile->IsOffTheRecord());
217 ChromeURLRequestContext* context = new ChromeURLRequestContext(profile); 228 ChromeURLRequestContext* context = new ChromeURLRequestContext(profile);
218 net::CookieMonster* cookie_monster = new net::CookieMonster; 229 net::CookieMonster* cookie_monster = new net::CookieMonster;
219 230
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
256 disk_cache_path.ToWStringHack(), cache_size); 267 disk_cache_path.ToWStringHack(), cache_size);
257 } else { 268 } else {
258 // If original HttpCache doesn't exist, simply construct one with a whole 269 // If original HttpCache doesn't exist, simply construct one with a whole
259 // new set of network stack. 270 // new set of network stack.
260 cache = new net::HttpCache(original_context->host_resolver(), 271 cache = new net::HttpCache(original_context->host_resolver(),
261 original_context->proxy_service(), 272 original_context->proxy_service(),
262 disk_cache_path.ToWStringHack(), cache_size); 273 disk_cache_path.ToWStringHack(), cache_size);
263 } 274 }
264 275
265 cache->set_type(net::MEDIA_CACHE); 276 cache->set_type(net::MEDIA_CACHE);
266 context->http_transaction_factory_ = cache; 277 context->http_transaction_factory_ = cache;
wtc 2009/08/12 17:25:50 I wonder if we should set ftp_transaction_factory_
267 return context; 278 return context;
268 } 279 }
269 280
270 ChromeURLRequestContext::ChromeURLRequestContext(Profile* profile) 281 ChromeURLRequestContext::ChromeURLRequestContext(Profile* profile)
271 : prefs_(profile->GetPrefs()), 282 : prefs_(profile->GetPrefs()),
272 is_media_(false), 283 is_media_(false),
273 is_off_the_record_(profile->IsOffTheRecord()) { 284 is_off_the_record_(profile->IsOffTheRecord()) {
274 // Set up Accept-Language and Accept-Charset header values 285 // Set up Accept-Language and Accept-Charset header values
275 accept_language_ = net::HttpUtil::GenerateAcceptLanguageHeader( 286 accept_language_ = net::HttpUtil::GenerateAcceptLanguageHeader(
276 WideToASCII(prefs_->GetString(prefs::kAcceptLanguages))); 287 WideToASCII(prefs_->GetString(prefs::kAcceptLanguages)));
(...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after
502 // Do not delete the cookie store in the case of the media context, as it is 513 // Do not delete the cookie store in the case of the media context, as it is
503 // owned by the original context. 514 // owned by the original context.
504 if (!is_media_) 515 if (!is_media_)
505 delete cookie_store_; 516 delete cookie_store_;
506 517
507 // Do not delete the proxy service in the case of OTR or media contexts, as 518 // Do not delete the proxy service in the case of OTR or media contexts, as
508 // it is owned by the original URLRequestContext. 519 // it is owned by the original URLRequestContext.
509 if (!is_off_the_record_ && !is_media_) 520 if (!is_off_the_record_ && !is_media_)
510 delete proxy_service_; 521 delete proxy_service_;
511 } 522 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698