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

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: Fixed ftp_auth_cache Created 8 years, 5 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 396 matching lines...) Expand 10 before | Expand all | Expand 10 after
439 440
440 main_job_factory_.reset(new net::URLRequestJobFactory); 441 main_job_factory_.reset(new net::URLRequestJobFactory);
441 media_request_job_factory_.reset(new net::URLRequestJobFactory); 442 media_request_job_factory_.reset(new net::URLRequestJobFactory);
442 extensions_job_factory_.reset(new net::URLRequestJobFactory); 443 extensions_job_factory_.reset(new net::URLRequestJobFactory);
443 444
444 net::URLRequestJobFactory* job_factories[3]; 445 net::URLRequestJobFactory* job_factories[3];
445 job_factories[0] = main_job_factory_.get(); 446 job_factories[0] = main_job_factory_.get();
446 job_factories[1] = media_request_job_factory_.get(); 447 job_factories[1] = media_request_job_factory_.get();
447 job_factories[2] = extensions_job_factory_.get(); 448 job_factories[2] = extensions_job_factory_.get();
448 449
450 net::FtpAuthCache* ftp_auth_caches[3];
451 ftp_auth_caches[0] = main_context->ftp_auth_cache();
452 ftp_auth_caches[1] = media_request_context_->ftp_auth_cache();
453 ftp_auth_caches[2] = extensions_context->ftp_auth_cache();
454
449 for (int i = 0; i < 3; i++) { 455 for (int i = 0; i < 3; i++) {
450 SetUpJobFactoryDefaults(job_factories[i]); 456 SetUpJobFactoryDefaults(job_factories[i]);
457 CreateFtpProtocolHandler(job_factories[i], ftp_auth_caches[i]);
451 AddConnectInterceptor(job_factories[i]); 458 AddConnectInterceptor(job_factories[i]);
452 } 459 }
453 460
454 main_context->set_job_factory(main_job_factory_.get()); 461 main_context->set_job_factory(main_job_factory_.get());
455 media_request_context_->set_job_factory(media_request_job_factory_.get()); 462 media_request_context_->set_job_factory(media_request_job_factory_.get());
456 extensions_context->set_job_factory(extensions_job_factory_.get()); 463 extensions_context->set_job_factory(extensions_job_factory_.get());
457 464
458 lazy_params_.reset(); 465 lazy_params_.reset();
459 } 466 }
460 467
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
532 ProfileImplIOData::AcquireIsolatedAppRequestContext( 539 ProfileImplIOData::AcquireIsolatedAppRequestContext(
533 ChromeURLRequestContext* main_context, 540 ChromeURLRequestContext* main_context,
534 const std::string& app_id) const { 541 const std::string& app_id) const {
535 // We create per-app contexts on demand, unlike the others above. 542 // We create per-app contexts on demand, unlike the others above.
536 ChromeURLRequestContext* app_request_context = 543 ChromeURLRequestContext* app_request_context =
537 InitializeAppRequestContext(main_context, app_id); 544 InitializeAppRequestContext(main_context, app_id);
538 DCHECK(app_request_context); 545 DCHECK(app_request_context);
539 return app_request_context; 546 return app_request_context;
540 } 547 }
541 548
549 void ProfileImplIOData::CreateFtpProtocolHandler(
550 net::URLRequestJobFactory* job_factory,
551 net::FtpAuthCache* ftp_auth_cache) const {
552 job_factory->SetProtocolHandler(
553 chrome::kFtpScheme,
554 new net::FtpProtocolHandler(network_delegate(),
555 ftp_factory_.get(),
556 ftp_auth_cache));
557 }
558
542 void ProfileImplIOData::AddConnectInterceptor( 559 void ProfileImplIOData::AddConnectInterceptor(
543 net::URLRequestJobFactory* job_factory) const { 560 net::URLRequestJobFactory* job_factory) const {
544 job_factory->AddInterceptor( 561 job_factory->AddInterceptor(
545 new chrome_browser_net::ConnectInterceptor(predictor_.get())); 562 new chrome_browser_net::ConnectInterceptor(predictor_.get()));
546 } 563 }
547 564
548 void ProfileImplIOData::ClearNetworkingHistorySinceOnIOThread( 565 void ProfileImplIOData::ClearNetworkingHistorySinceOnIOThread(
549 base::Time time) { 566 base::Time time) {
550 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); 567 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
551 LazyInitialize(); 568 LazyInitialize();
552 569
553 DCHECK(transport_security_state()); 570 DCHECK(transport_security_state());
554 transport_security_state()->DeleteSince(time); 571 transport_security_state()->DeleteSince(time);
555 DCHECK(http_server_properties_manager()); 572 DCHECK(http_server_properties_manager());
556 http_server_properties_manager()->Clear(); 573 http_server_properties_manager()->Clear();
557 } 574 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698