OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/io_thread.h" | 5 #include "chrome/browser/io_thread.h" |
6 | 6 |
7 #include <vector> | 7 #include <vector> |
8 | 8 |
9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 376 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
387 | 387 |
388 IOThread::Globals* IOThread::globals() { | 388 IOThread::Globals* IOThread::globals() { |
389 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); | 389 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
390 return globals_; | 390 return globals_; |
391 } | 391 } |
392 | 392 |
393 ChromeNetLog* IOThread::net_log() { | 393 ChromeNetLog* IOThread::net_log() { |
394 return net_log_; | 394 return net_log_; |
395 } | 395 } |
396 | 396 |
| 397 void IOThread::ChangedToOnTheRecord() { |
| 398 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 399 message_loop()->PostTask( |
| 400 FROM_HERE, |
| 401 base::Bind(&IOThread::ChangedToOnTheRecordOnIOThread, |
| 402 base::Unretained(this))); |
| 403 } |
| 404 |
397 net::URLRequestContextGetter* IOThread::system_url_request_context_getter() { | 405 net::URLRequestContextGetter* IOThread::system_url_request_context_getter() { |
398 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 406 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
399 if (!system_url_request_context_getter_) { | 407 if (!system_url_request_context_getter_) { |
400 InitSystemRequestContext(); | 408 InitSystemRequestContext(); |
401 } | 409 } |
402 return system_url_request_context_getter_; | 410 return system_url_request_context_getter_; |
403 } | 411 } |
404 | 412 |
405 void IOThread::Init() { | 413 void IOThread::Init() { |
406 // Though this thread is called the "IO" thread, it actually just routes | 414 // Though this thread is called the "IO" thread, it actually just routes |
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
573 | 581 |
574 return net::HttpAuthHandlerRegistryFactory::Create( | 582 return net::HttpAuthHandlerRegistryFactory::Create( |
575 supported_schemes, | 583 supported_schemes, |
576 globals_->url_security_manager.get(), | 584 globals_->url_security_manager.get(), |
577 resolver, | 585 resolver, |
578 gssapi_library_name_, | 586 gssapi_library_name_, |
579 negotiate_disable_cname_lookup_, | 587 negotiate_disable_cname_lookup_, |
580 negotiate_enable_port_); | 588 negotiate_enable_port_); |
581 } | 589 } |
582 | 590 |
| 591 void IOThread::ChangedToOnTheRecordOnIOThread() { |
| 592 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
| 593 |
| 594 // Clear the host cache to avoid showing entries from the OTR session |
| 595 // in about:net-internals. |
| 596 ClearHostCache(); |
| 597 |
| 598 // Clear all of the passively logged data. |
| 599 // TODO(eroman): this is a bit heavy handed, really all we need to do is |
| 600 // clear the data pertaining to incognito context. |
| 601 net_log_->ClearAllPassivelyCapturedEvents(); |
| 602 } |
| 603 |
583 void IOThread::ClearHostCache() { | 604 void IOThread::ClearHostCache() { |
584 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); | 605 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
585 | 606 |
586 net::HostCache* host_cache = globals_->host_resolver->GetHostCache(); | 607 net::HostCache* host_cache = globals_->host_resolver->GetHostCache(); |
587 if (host_cache) | 608 if (host_cache) |
588 host_cache->clear(); | 609 host_cache->clear(); |
589 } | 610 } |
590 | 611 |
591 MessageLoop* IOThread::message_loop() const { | 612 MessageLoop* IOThread::message_loop() const { |
592 return BrowserThread::UnsafeGetBrowserThread( | 613 return BrowserThread::UnsafeGetBrowserThread( |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
647 system_params.network_delegate = globals_->system_network_delegate.get(); | 668 system_params.network_delegate = globals_->system_network_delegate.get(); |
648 system_params.net_log = net_log_; | 669 system_params.net_log = net_log_; |
649 globals_->system_http_transaction_factory.reset( | 670 globals_->system_http_transaction_factory.reset( |
650 new net::HttpNetworkLayer( | 671 new net::HttpNetworkLayer( |
651 new net::HttpNetworkSession(system_params))); | 672 new net::HttpNetworkSession(system_params))); |
652 globals_->system_ftp_transaction_factory.reset( | 673 globals_->system_ftp_transaction_factory.reset( |
653 new net::FtpNetworkLayer(globals_->host_resolver.get())); | 674 new net::FtpNetworkLayer(globals_->host_resolver.get())); |
654 globals_->system_request_context = | 675 globals_->system_request_context = |
655 ConstructSystemRequestContext(globals_, net_log_); | 676 ConstructSystemRequestContext(globals_, net_log_); |
656 } | 677 } |
OLD | NEW |