OLD | NEW |
---|---|
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 469 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
480 } | 480 } |
481 | 481 |
482 ChromeURLRequestContext* | 482 ChromeURLRequestContext* |
483 ProfileImplIOData::InitializeAppRequestContext( | 483 ProfileImplIOData::InitializeAppRequestContext( |
484 ChromeURLRequestContext* main_context, | 484 ChromeURLRequestContext* main_context, |
485 const std::string& app_id, | 485 const std::string& app_id, |
486 scoped_ptr<net::URLRequestJobFactory::Interceptor> | 486 scoped_ptr<net::URLRequestJobFactory::Interceptor> |
487 protocol_handler_interceptor) const { | 487 protocol_handler_interceptor) const { |
488 // If this is for a guest process, we should not persist cookies and http | 488 // If this is for a guest process, we should not persist cookies and http |
489 // cache. | 489 // cache. |
490 bool is_guest_process = (app_id.find("guest-") != std::string::npos); | 490 bool is_guest_process = (app_id.find("guest-") != std::string::npos); |
Tom Sepez
2012/10/29 17:59:08
Not your problem, but is there a better way of fin
Charlie Reis
2012/10/29 18:18:31
Funny you should mention it-- Albert and Nasko are
| |
491 | 491 |
492 // Copy most state from the main context. | 492 // Copy most state from the main context. |
493 AppRequestContext* context = new AppRequestContext(load_time_stats()); | 493 AppRequestContext* context = new AppRequestContext(load_time_stats()); |
494 context->CopyFrom(main_context); | 494 context->CopyFrom(main_context); |
495 | 495 |
496 using content::StoragePartition; | 496 using content::StoragePartition; |
497 FilePath app_path = | 497 FilePath app_path = |
498 profile_path_.Append(StoragePartition::GetPartitionPath(app_id)); | 498 profile_path_.Append(StoragePartition::GetPartitionPath(app_id)); |
499 | 499 |
500 FilePath cookie_path = app_path.Append(chrome::kCookieFilename); | 500 FilePath cookie_path = app_path.Append(chrome::kCookieFilename); |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
549 cookie_store = new net::CookieMonster(cookie_db.get(), NULL); | 549 cookie_store = new net::CookieMonster(cookie_db.get(), NULL); |
550 } | 550 } |
551 | 551 |
552 // Transfer ownership of the cookies and cache to AppRequestContext. | 552 // Transfer ownership of the cookies and cache to AppRequestContext. |
553 context->SetCookieStore(cookie_store); | 553 context->SetCookieStore(cookie_store); |
554 context->SetHttpTransactionFactory( | 554 context->SetHttpTransactionFactory( |
555 scoped_ptr<net::HttpTransactionFactory>(app_http_cache)); | 555 scoped_ptr<net::HttpTransactionFactory>(app_http_cache)); |
556 | 556 |
557 // Overwrite the job factory that we inherit from the main context so | 557 // Overwrite the job factory that we inherit from the main context so |
558 // that we can later provide our own handles for storage related protocols. | 558 // that we can later provide our own handles for storage related protocols. |
559 // Install all the usual protocol handlers unless we are in a browser plugin | |
560 // guest process, in which case only web-safe schemes are allowed. | |
559 scoped_ptr<net::URLRequestJobFactoryImpl> job_factory( | 561 scoped_ptr<net::URLRequestJobFactoryImpl> job_factory( |
560 new net::URLRequestJobFactoryImpl()); | 562 new net::URLRequestJobFactoryImpl()); |
561 SetUpJobFactory(job_factory.get(), protocol_handler_interceptor.Pass(), | 563 if (!is_guest_process) { |
562 network_delegate(), | 564 SetUpJobFactory(job_factory.get(), protocol_handler_interceptor.Pass(), |
563 context->ftp_transaction_factory(), | 565 network_delegate(), |
564 context->ftp_auth_cache()); | 566 context->ftp_transaction_factory(), |
567 context->ftp_auth_cache()); | |
568 } | |
565 context->SetJobFactory(job_factory.PassAs<net::URLRequestJobFactory>()); | 569 context->SetJobFactory(job_factory.PassAs<net::URLRequestJobFactory>()); |
566 | 570 |
567 return context; | 571 return context; |
568 } | 572 } |
569 | 573 |
570 ChromeURLRequestContext* | 574 ChromeURLRequestContext* |
571 ProfileImplIOData::InitializeMediaRequestContext( | 575 ProfileImplIOData::InitializeMediaRequestContext( |
572 ChromeURLRequestContext* original_context, | 576 ChromeURLRequestContext* original_context, |
573 const std::string& app_id) const { | 577 const std::string& app_id) const { |
574 // If this is for a guest process, we do not persist storage, so we can | 578 // If this is for a guest process, we do not persist storage, so we can |
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
671 void ProfileImplIOData::ClearNetworkingHistorySinceOnIOThread( | 675 void ProfileImplIOData::ClearNetworkingHistorySinceOnIOThread( |
672 base::Time time) { | 676 base::Time time) { |
673 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); | 677 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
674 LazyInitialize(); | 678 LazyInitialize(); |
675 | 679 |
676 DCHECK(transport_security_state()); | 680 DCHECK(transport_security_state()); |
677 transport_security_state()->DeleteSince(time); | 681 transport_security_state()->DeleteSince(time); |
678 DCHECK(http_server_properties_manager()); | 682 DCHECK(http_server_properties_manager()); |
679 http_server_properties_manager()->Clear(); | 683 http_server_properties_manager()->Clear(); |
680 } | 684 } |
OLD | NEW |