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

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

Issue 10700117: Replaced static URLRequestFileJob factory with non-static protocol handler for File jobs (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Removed context from file_dir_job, merged with error_job cl 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 | Annotate | Revision Log
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/file_protocol_handler.h"
33 #include "net/url_request/ftp_protocol_handler.h" 34 #include "net/url_request/ftp_protocol_handler.h"
34 #include "net/url_request/url_request_job_factory.h" 35 #include "net/url_request/url_request_job_factory.h"
35 #include "webkit/quota/special_storage_policy.h" 36 #include "webkit/quota/special_storage_policy.h"
36 37
37 using content::BrowserThread; 38 using content::BrowserThread;
38 39
39 ProfileImplIOData::Handle::Handle(Profile* profile) 40 ProfileImplIOData::Handle::Handle(Profile* profile)
40 : io_data_(new ProfileImplIOData), 41 : io_data_(new ProfileImplIOData),
41 profile_(profile), 42 profile_(profile),
42 initialized_(false) { 43 initialized_(false) {
(...skipping 404 matching lines...) Expand 10 before | Expand all | Expand 10 after
447 job_factories[1] = media_request_job_factory_.get(); 448 job_factories[1] = media_request_job_factory_.get();
448 job_factories[2] = extensions_job_factory_.get(); 449 job_factories[2] = extensions_job_factory_.get();
449 450
450 net::FtpAuthCache* ftp_auth_caches[3]; 451 net::FtpAuthCache* ftp_auth_caches[3];
451 ftp_auth_caches[0] = main_context->ftp_auth_cache(); 452 ftp_auth_caches[0] = main_context->ftp_auth_cache();
452 ftp_auth_caches[1] = media_request_context_->ftp_auth_cache(); 453 ftp_auth_caches[1] = media_request_context_->ftp_auth_cache();
453 ftp_auth_caches[2] = extensions_context->ftp_auth_cache(); 454 ftp_auth_caches[2] = extensions_context->ftp_auth_cache();
454 455
455 for (int i = 0; i < 3; i++) { 456 for (int i = 0; i < 3; i++) {
456 SetUpJobFactoryDefaults(job_factories[i]); 457 SetUpJobFactoryDefaults(job_factories[i]);
458 CreateFileProtocolHandler(job_factories[i]);
457 CreateFtpProtocolHandler(job_factories[i], ftp_auth_caches[i]); 459 CreateFtpProtocolHandler(job_factories[i], ftp_auth_caches[i]);
458 job_factories[i]->AddInterceptor( 460 job_factories[i]->AddInterceptor(
459 new chrome_browser_net::ConnectInterceptor(predictor_.get())); 461 new chrome_browser_net::ConnectInterceptor(predictor_.get()));
460 } 462 }
461 463
462 main_context->set_job_factory(main_job_factory_.get()); 464 main_context->set_job_factory(main_job_factory_.get());
463 media_request_context_->set_job_factory(media_request_job_factory_.get()); 465 media_request_context_->set_job_factory(media_request_job_factory_.get());
464 extensions_context->set_job_factory(extensions_job_factory_.get()); 466 extensions_context->set_job_factory(extensions_job_factory_.get());
465 467
466 lazy_params_.reset(); 468 lazy_params_.reset();
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
540 ProfileImplIOData::AcquireIsolatedAppRequestContext( 542 ProfileImplIOData::AcquireIsolatedAppRequestContext(
541 ChromeURLRequestContext* main_context, 543 ChromeURLRequestContext* main_context,
542 const std::string& app_id) const { 544 const std::string& app_id) const {
543 // We create per-app contexts on demand, unlike the others above. 545 // We create per-app contexts on demand, unlike the others above.
544 ChromeURLRequestContext* app_request_context = 546 ChromeURLRequestContext* app_request_context =
545 InitializeAppRequestContext(main_context, app_id); 547 InitializeAppRequestContext(main_context, app_id);
546 DCHECK(app_request_context); 548 DCHECK(app_request_context);
547 return app_request_context; 549 return app_request_context;
548 } 550 }
549 551
552 void ProfileImplIOData::CreateFileProtocolHandler(
553 net::URLRequestJobFactory* job_factory) const {
554 job_factory->SetProtocolHandler(
555 chrome::kFtpScheme,
erikwright (departed) 2012/07/13 14:50:36 kFileScheme?
shalev 2012/07/17 19:40:16 Done.
556 new net::FileProtocolHandler(network_delegate()));
557 }
558
550 void ProfileImplIOData::CreateFtpProtocolHandler( 559 void ProfileImplIOData::CreateFtpProtocolHandler(
551 net::URLRequestJobFactory* job_factory, 560 net::URLRequestJobFactory* job_factory,
552 net::FtpAuthCache* ftp_auth_cache) const { 561 net::FtpAuthCache* ftp_auth_cache) const {
553 job_factory->SetProtocolHandler( 562 job_factory->SetProtocolHandler(
554 chrome::kFtpScheme, 563 chrome::kFtpScheme,
555 new net::FtpProtocolHandler(network_delegate(), 564 new net::FtpProtocolHandler(network_delegate(),
556 ftp_factory_.get(), 565 ftp_factory_.get(),
557 ftp_auth_cache)); 566 ftp_auth_cache));
558 } 567 }
559 568
560 void ProfileImplIOData::ClearNetworkingHistorySinceOnIOThread( 569 void ProfileImplIOData::ClearNetworkingHistorySinceOnIOThread(
561 base::Time time) { 570 base::Time time) {
562 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); 571 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
563 LazyInitialize(); 572 LazyInitialize();
564 573
565 DCHECK(transport_security_state()); 574 DCHECK(transport_security_state());
566 transport_security_state()->DeleteSince(time); 575 transport_security_state()->DeleteSince(time);
567 DCHECK(http_server_properties_manager()); 576 DCHECK(http_server_properties_manager());
568 http_server_properties_manager()->Clear(); 577 http_server_properties_manager()->Clear();
569 } 578 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698