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/io_thread.h" | 5 #include "chrome/browser/io_thread.h" |
6 | 6 |
7 #include <vector> | 7 #include <vector> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/bind_helpers.h" | 10 #include "base/bind_helpers.h" |
(...skipping 631 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
642 globals_->max_spdy_sessions_per_domain.set( | 642 globals_->max_spdy_sessions_per_domain.set( |
643 GetSwitchValueAsInt(command_line, switches::kMaxSpdySessionsPerDomain)); | 643 GetSwitchValueAsInt(command_line, switches::kMaxSpdySessionsPerDomain)); |
644 } | 644 } |
645 if (command_line.HasSwitch(switches::kMaxSpdyConcurrentStreams)) { | 645 if (command_line.HasSwitch(switches::kMaxSpdyConcurrentStreams)) { |
646 globals_->max_spdy_concurrent_streams_limit.set( | 646 globals_->max_spdy_concurrent_streams_limit.set( |
647 GetSwitchValueAsInt(command_line, switches::kMaxSpdyConcurrentStreams)); | 647 GetSwitchValueAsInt(command_line, switches::kMaxSpdyConcurrentStreams)); |
648 } | 648 } |
649 if (command_line.HasSwitch(switches::kIgnoreUrlFetcherCertRequests)) | 649 if (command_line.HasSwitch(switches::kIgnoreUrlFetcherCertRequests)) |
650 net::URLFetcher::SetIgnoreCertificateRequests(true); | 650 net::URLFetcher::SetIgnoreCertificateRequests(true); |
651 | 651 |
652 bool used_spdy_switch = false; | |
653 if (command_line.HasSwitch(switches::kUseSpdy)) { | 652 if (command_line.HasSwitch(switches::kUseSpdy)) { |
654 std::string spdy_mode = | 653 std::string spdy_mode = |
655 command_line.GetSwitchValueASCII(switches::kUseSpdy); | 654 command_line.GetSwitchValueASCII(switches::kUseSpdy); |
656 EnableSpdy(spdy_mode); | 655 EnableSpdy(spdy_mode); |
657 used_spdy_switch = true; | 656 } else if (command_line.HasSwitch(switches::kEnableSpdy31)) { |
658 } | 657 net::HttpStreamFactory::EnableNpnSpdy31(); |
659 if (command_line.HasSwitch(switches::kEnableSpdy3)) { | 658 } else if (command_line.HasSwitch(switches::kEnableSpdy3)) { |
660 net::HttpStreamFactory::EnableNpnSpdy3(); | 659 net::HttpStreamFactory::EnableNpnSpdy3(); |
661 used_spdy_switch = true; | |
662 } else if (command_line.HasSwitch(switches::kEnableNpn)) { | 660 } else if (command_line.HasSwitch(switches::kEnableNpn)) { |
663 net::HttpStreamFactory::EnableNpnSpdy(); | 661 net::HttpStreamFactory::EnableNpnSpdy(); |
664 used_spdy_switch = true; | |
665 } else if (command_line.HasSwitch(switches::kEnableNpnHttpOnly)) { | 662 } else if (command_line.HasSwitch(switches::kEnableNpnHttpOnly)) { |
666 net::HttpStreamFactory::EnableNpnHttpOnly(); | 663 net::HttpStreamFactory::EnableNpnHttpOnly(); |
667 used_spdy_switch = true; | 664 } else { |
668 } | 665 // Use SPDY/3 by default. |
669 if (!used_spdy_switch) { | |
670 net::HttpStreamFactory::EnableNpnSpdy3(); | 666 net::HttpStreamFactory::EnableNpnSpdy3(); |
671 } | 667 } |
672 } | 668 } |
673 | 669 |
674 void IOThread::EnableSpdy(const std::string& mode) { | 670 void IOThread::EnableSpdy(const std::string& mode) { |
675 static const char kOff[] = "off"; | 671 static const char kOff[] = "off"; |
676 static const char kSSL[] = "ssl"; | 672 static const char kSSL[] = "ssl"; |
677 static const char kDisableSSL[] = "no-ssl"; | 673 static const char kDisableSSL[] = "no-ssl"; |
678 static const char kDisablePing[] = "no-ping"; | 674 static const char kDisablePing[] = "no-ping"; |
679 static const char kExclude[] = "exclude"; // Hosts to exclude | 675 static const char kExclude[] = "exclude"; // Hosts to exclude |
(...skipping 222 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
902 globals_->system_request_context.reset( | 898 globals_->system_request_context.reset( |
903 ConstructSystemRequestContext(globals_, net_log_)); | 899 ConstructSystemRequestContext(globals_, net_log_)); |
904 | 900 |
905 sdch_manager_->set_sdch_fetcher( | 901 sdch_manager_->set_sdch_fetcher( |
906 new SdchDictionaryFetcher(system_url_request_context_getter_.get())); | 902 new SdchDictionaryFetcher(system_url_request_context_getter_.get())); |
907 } | 903 } |
908 | 904 |
909 void IOThread::UpdateDnsClientEnabled() { | 905 void IOThread::UpdateDnsClientEnabled() { |
910 globals()->host_resolver->SetDnsClientEnabled(*dns_client_enabled_); | 906 globals()->host_resolver->SetDnsClientEnabled(*dns_client_enabled_); |
911 } | 907 } |
OLD | NEW |