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

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

Issue 42197: Add command line switch "--new-ftp" for new portable... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Upload before checkin Created 11 years, 9 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | chrome/common/chrome_switches.h » ('j') | 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/chrome_thread.h" 10 #include "chrome/browser/chrome_thread.h"
11 #include "chrome/browser/extensions/extensions_service.h" 11 #include "chrome/browser/extensions/extensions_service.h"
12 #include "chrome/browser/extensions/user_script_master.h" 12 #include "chrome/browser/extensions/user_script_master.h"
13 #include "chrome/browser/profile.h" 13 #include "chrome/browser/profile.h"
14 #include "chrome/common/chrome_constants.h" 14 #include "chrome/common/chrome_constants.h"
15 #include "chrome/common/chrome_switches.h" 15 #include "chrome/common/chrome_switches.h"
16 #include "chrome/common/notification_service.h" 16 #include "chrome/common/notification_service.h"
17 #include "chrome/common/pref_names.h" 17 #include "chrome/common/pref_names.h"
18 #include "net/ftp/ftp_network_layer.h"
18 #include "net/http/http_cache.h" 19 #include "net/http/http_cache.h"
19 #include "net/http/http_network_layer.h" 20 #include "net/http/http_network_layer.h"
20 #include "net/http/http_util.h" 21 #include "net/http/http_util.h"
21 #include "net/proxy/proxy_service.h" 22 #include "net/proxy/proxy_service.h"
22 #include "webkit/glue/webkit_glue.h" 23 #include "webkit/glue/webkit_glue.h"
23 24
24 // Sets up proxy info if overrides were specified on the command line. 25 // Sets up proxy info if overrides were specified on the command line.
25 // Otherwise returns NULL (meaning we should use the system defaults). 26 // Otherwise returns NULL (meaning we should use the system defaults).
26 // The caller is responsible for deleting returned pointer. 27 // The caller is responsible for deleting returned pointer.
27 static net::ProxyInfo* CreateProxyInfo(const CommandLine& command_line) { 28 static net::ProxyInfo* CreateProxyInfo(const CommandLine& command_line) {
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
75 bool playback_mode = command_line.HasSwitch(switches::kPlaybackMode); 76 bool playback_mode = command_line.HasSwitch(switches::kPlaybackMode);
76 77
77 if (record_mode || playback_mode) { 78 if (record_mode || playback_mode) {
78 // Don't use existing cookies and use an in-memory store. 79 // Don't use existing cookies and use an in-memory store.
79 context->cookie_store_ = new net::CookieMonster(); 80 context->cookie_store_ = new net::CookieMonster();
80 cache->set_mode( 81 cache->set_mode(
81 record_mode ? net::HttpCache::RECORD : net::HttpCache::PLAYBACK); 82 record_mode ? net::HttpCache::RECORD : net::HttpCache::PLAYBACK);
82 } 83 }
83 context->http_transaction_factory_ = cache; 84 context->http_transaction_factory_ = cache;
84 85
86 // The kNewFtp switch is Windows specific only because we have multiple FTP
87 // implementations on Windows.
88 #if defined(OS_WIN)
89 if (command_line.HasSwitch(switches::kNewFtp))
90 context->ftp_transaction_factory_ = new net::FtpNetworkLayer;
91 #else
92 context->ftp_transaction_factory_ = new net::FtpNetworkLayer;
93 #endif
94
85 // setup cookie store 95 // setup cookie store
86 if (!context->cookie_store_) { 96 if (!context->cookie_store_) {
87 DCHECK(!cookie_store_path.empty()); 97 DCHECK(!cookie_store_path.empty());
88 context->cookie_db_.reset(new SQLitePersistentCookieStore( 98 context->cookie_db_.reset(new SQLitePersistentCookieStore(
89 cookie_store_path.ToWStringHack(), 99 cookie_store_path.ToWStringHack(),
90 g_browser_process->db_thread()->message_loop())); 100 g_browser_process->db_thread()->message_loop()));
91 context->cookie_store_ = new net::CookieMonster(context->cookie_db_.get()); 101 context->cookie_store_ = new net::CookieMonster(context->cookie_db_.get());
92 } 102 }
93 103
94 return context; 104 return context;
(...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after
281 291
282 ChromeURLRequestContext::~ChromeURLRequestContext() { 292 ChromeURLRequestContext::~ChromeURLRequestContext() {
283 DCHECK(NULL == prefs_); 293 DCHECK(NULL == prefs_);
284 294
285 NotificationService::current()->Notify( 295 NotificationService::current()->Notify(
286 NotificationType::URL_REQUEST_CONTEXT_RELEASED, 296 NotificationType::URL_REQUEST_CONTEXT_RELEASED,
287 Source<URLRequestContext>(this), 297 Source<URLRequestContext>(this),
288 NotificationService::NoDetails()); 298 NotificationService::NoDetails());
289 299
290 delete cookie_store_; 300 delete cookie_store_;
301 delete ftp_transaction_factory_;
291 delete http_transaction_factory_; 302 delete http_transaction_factory_;
292 303
293 // Do not delete the proxy service in the case of OTR, as it is owned by the 304 // Do not delete the proxy service in the case of OTR, as it is owned by the
294 // original URLRequestContext. 305 // original URLRequestContext.
295 if (!is_off_the_record_) 306 if (!is_off_the_record_)
296 delete proxy_service_; 307 delete proxy_service_;
297 } 308 }
OLDNEW
« no previous file with comments | « no previous file | chrome/common/chrome_switches.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698