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

Side by Side Diff: chrome/browser/profiles/profile_impl_io_data.cc

Issue 10537056: Replaced static URLRequestFtpJob factory with non-static protocol handler for FTP jobs. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Added DCHECKs Created 8 years, 6 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
OLDNEW
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 #include "chrome/browser/profiles/profile_impl_io_data.h" 5 #include "chrome/browser/profiles/profile_impl_io_data.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/command_line.h" 8 #include "base/command_line.h"
9 #include "base/file_util.h" 9 #include "base/file_util.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 12 matching lines...) Expand all
23 #include "chrome/browser/profiles/profile.h" 23 #include "chrome/browser/profiles/profile.h"
24 #include "chrome/common/chrome_constants.h" 24 #include "chrome/common/chrome_constants.h"
25 #include "chrome/common/chrome_switches.h" 25 #include "chrome/common/chrome_switches.h"
26 #include "chrome/common/pref_names.h" 26 #include "chrome/common/pref_names.h"
27 #include "chrome/common/url_constants.h" 27 #include "chrome/common/url_constants.h"
28 #include "content/public/browser/browser_thread.h" 28 #include "content/public/browser/browser_thread.h"
29 #include "content/public/browser/resource_context.h" 29 #include "content/public/browser/resource_context.h"
30 #include "net/base/server_bound_cert_service.h" 30 #include "net/base/server_bound_cert_service.h"
31 #include "net/ftp/ftp_network_layer.h" 31 #include "net/ftp/ftp_network_layer.h"
32 #include "net/http/http_cache.h" 32 #include "net/http/http_cache.h"
33 #include "net/url_request/ftp_protocol_handler.h"
33 #include "net/url_request/url_request_job_factory.h" 34 #include "net/url_request/url_request_job_factory.h"
34 #include "webkit/quota/special_storage_policy.h" 35 #include "webkit/quota/special_storage_policy.h"
35 36
36 using content::BrowserThread; 37 using content::BrowserThread;
37 38
38 ProfileImplIOData::Handle::Handle(Profile* profile) 39 ProfileImplIOData::Handle::Handle(Profile* profile)
39 : io_data_(new ProfileImplIOData), 40 : io_data_(new ProfileImplIOData),
40 profile_(profile), 41 profile_(profile),
41 initialized_(false) { 42 initialized_(false) {
42 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 43 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
(...skipping 393 matching lines...) Expand 10 before | Expand all | Expand 10 after
436 main_http_factory_.reset(main_cache); 437 main_http_factory_.reset(main_cache);
437 media_http_factory_.reset(media_cache); 438 media_http_factory_.reset(media_cache);
438 main_context->set_http_transaction_factory(main_cache); 439 main_context->set_http_transaction_factory(main_cache);
439 media_request_context_->set_http_transaction_factory(media_cache); 440 media_request_context_->set_http_transaction_factory(media_cache);
440 441
441 ftp_factory_.reset( 442 ftp_factory_.reset(
442 new net::FtpNetworkLayer(io_thread_globals->host_resolver.get())); 443 new net::FtpNetworkLayer(io_thread_globals->host_resolver.get()));
443 main_context->set_ftp_transaction_factory(ftp_factory_.get()); 444 main_context->set_ftp_transaction_factory(ftp_factory_.get());
444 media_request_context_->set_ftp_transaction_factory(ftp_factory_.get()); 445 media_request_context_->set_ftp_transaction_factory(ftp_factory_.get());
445 446
447 ftp_auth_cache_.reset(new net::FtpAuthCache);
448
446 main_context->set_chrome_url_data_manager_backend( 449 main_context->set_chrome_url_data_manager_backend(
447 chrome_url_data_manager_backend()); 450 chrome_url_data_manager_backend());
448 451
449 main_context->set_job_factory(job_factory()); 452 main_context->set_job_factory(job_factory());
450 media_request_context_->set_job_factory(job_factory()); 453 media_request_context_->set_job_factory(job_factory());
451 extensions_context->set_job_factory(job_factory()); 454 extensions_context->set_job_factory(job_factory());
452 455
456 job_factory()->SetProtocolHandler(chrome::kFtpScheme,
457 new net::FtpProtocolHandler(
458 network_delegate(), ftp_factory_.get(), ftp_auth_cache_.get()));
459
453 job_factory()->AddInterceptor( 460 job_factory()->AddInterceptor(
454 new chrome_browser_net::ConnectInterceptor(predictor_.get())); 461 new chrome_browser_net::ConnectInterceptor(predictor_.get()));
455 462
456 lazy_params_.reset(); 463 lazy_params_.reset();
457 } 464 }
458 465
459 ChromeURLRequestContext* 466 ChromeURLRequestContext*
460 ProfileImplIOData::InitializeAppRequestContext( 467 ProfileImplIOData::InitializeAppRequestContext(
461 ChromeURLRequestContext* main_context, 468 ChromeURLRequestContext* main_context,
462 const std::string& app_id) const { 469 const std::string& app_id) const {
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
538 void ProfileImplIOData::ClearNetworkingHistorySinceOnIOThread( 545 void ProfileImplIOData::ClearNetworkingHistorySinceOnIOThread(
539 base::Time time) { 546 base::Time time) {
540 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); 547 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
541 LazyInitialize(); 548 LazyInitialize();
542 549
543 DCHECK(transport_security_state()); 550 DCHECK(transport_security_state());
544 transport_security_state()->DeleteSince(time); 551 transport_security_state()->DeleteSince(time);
545 DCHECK(http_server_properties_manager()); 552 DCHECK(http_server_properties_manager());
546 http_server_properties_manager()->Clear(); 553 http_server_properties_manager()->Clear();
547 } 554 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698