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

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: Merged with latest sync 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
« no previous file with comments | « chrome/browser/profiles/profile_impl_io_data.h ('k') | net/net.gyp » ('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) 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 job_factories[i]->AddInterceptor( 458 job_factories[i]->AddInterceptor(
452 new chrome_browser_net::ConnectInterceptor(predictor_.get())); 459 new chrome_browser_net::ConnectInterceptor(predictor_.get()));
453 } 460 }
454 461
455 main_context->set_job_factory(main_job_factory_.get()); 462 main_context->set_job_factory(main_job_factory_.get());
456 media_request_context_->set_job_factory(media_request_job_factory_.get()); 463 media_request_context_->set_job_factory(media_request_job_factory_.get());
457 extensions_context->set_job_factory(extensions_job_factory_.get()); 464 extensions_context->set_job_factory(extensions_job_factory_.get());
458 465
459 lazy_params_.reset(); 466 lazy_params_.reset();
460 } 467 }
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
533 ProfileImplIOData::AcquireIsolatedAppRequestContext( 540 ProfileImplIOData::AcquireIsolatedAppRequestContext(
534 ChromeURLRequestContext* main_context, 541 ChromeURLRequestContext* main_context,
535 const std::string& app_id) const { 542 const std::string& app_id) const {
536 // We create per-app contexts on demand, unlike the others above. 543 // We create per-app contexts on demand, unlike the others above.
537 ChromeURLRequestContext* app_request_context = 544 ChromeURLRequestContext* app_request_context =
538 InitializeAppRequestContext(main_context, app_id); 545 InitializeAppRequestContext(main_context, app_id);
539 DCHECK(app_request_context); 546 DCHECK(app_request_context);
540 return app_request_context; 547 return app_request_context;
541 } 548 }
542 549
550 void ProfileImplIOData::CreateFtpProtocolHandler(
551 net::URLRequestJobFactory* job_factory,
552 net::FtpAuthCache* ftp_auth_cache) const {
553 job_factory->SetProtocolHandler(
554 chrome::kFtpScheme,
555 new net::FtpProtocolHandler(network_delegate(),
556 ftp_factory_.get(),
557 ftp_auth_cache));
558 }
559
543 void ProfileImplIOData::ClearNetworkingHistorySinceOnIOThread( 560 void ProfileImplIOData::ClearNetworkingHistorySinceOnIOThread(
544 base::Time time) { 561 base::Time time) {
545 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); 562 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
546 LazyInitialize(); 563 LazyInitialize();
547 564
548 DCHECK(transport_security_state()); 565 DCHECK(transport_security_state());
549 transport_security_state()->DeleteSince(time); 566 transport_security_state()->DeleteSince(time);
550 DCHECK(http_server_properties_manager()); 567 DCHECK(http_server_properties_manager());
551 http_server_properties_manager()->Clear(); 568 http_server_properties_manager()->Clear();
552 } 569 }
OLDNEW
« no previous file with comments | « chrome/browser/profiles/profile_impl_io_data.h ('k') | net/net.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698