OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "net/http/http_server_properties_manager.h" | 5 #include "net/http/http_server_properties_manager.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/metrics/histogram.h" | 8 #include "base/metrics/histogram.h" |
9 #include "base/prefs/pref_service.h" | 9 #include "base/prefs/pref_service.h" |
10 #include "base/single_thread_task_runner.h" | 10 #include "base/single_thread_task_runner.h" |
(...skipping 728 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
739 ++it) { | 739 ++it) { |
740 net::SpdySettingsIds id = it->first; | 740 net::SpdySettingsIds id = it->first; |
741 uint32 value = it->second.second; | 741 uint32 value = it->second.second; |
742 std::string key = base::StringPrintf("%u", id); | 742 std::string key = base::StringPrintf("%u", id); |
743 spdy_settings_dict->SetInteger(key, value); | 743 spdy_settings_dict->SetInteger(key, value); |
744 } | 744 } |
745 server_pref_dict->SetWithoutPathExpansion("settings", spdy_settings_dict); | 745 server_pref_dict->SetWithoutPathExpansion("settings", spdy_settings_dict); |
746 } | 746 } |
747 | 747 |
748 // Save alternate_protocol. | 748 // Save alternate_protocol. |
749 if (server_pref.alternate_protocol) { | 749 const net::AlternateProtocolInfo* port_alternate_protocol = |
| 750 server_pref.alternate_protocol; |
| 751 if (port_alternate_protocol && !port_alternate_protocol->is_broken) { |
750 base::DictionaryValue* port_alternate_protocol_dict = | 752 base::DictionaryValue* port_alternate_protocol_dict = |
751 new base::DictionaryValue; | 753 new base::DictionaryValue; |
752 const net::AlternateProtocolInfo* port_alternate_protocol = | |
753 server_pref.alternate_protocol; | |
754 port_alternate_protocol_dict->SetInteger("port", | 754 port_alternate_protocol_dict->SetInteger("port", |
755 port_alternate_protocol->port); | 755 port_alternate_protocol->port); |
756 const char* protocol_str = | 756 const char* protocol_str = |
757 net::AlternateProtocolToString(port_alternate_protocol->protocol); | 757 net::AlternateProtocolToString(port_alternate_protocol->protocol); |
758 port_alternate_protocol_dict->SetString("protocol_str", protocol_str); | 758 port_alternate_protocol_dict->SetString("protocol_str", protocol_str); |
759 port_alternate_protocol_dict->SetDouble( | 759 port_alternate_protocol_dict->SetDouble( |
760 "probability", port_alternate_protocol->probability); | 760 "probability", port_alternate_protocol->probability); |
761 server_pref_dict->SetWithoutPathExpansion( | 761 server_pref_dict->SetWithoutPathExpansion( |
762 "alternate_protocol", port_alternate_protocol_dict); | 762 "alternate_protocol", port_alternate_protocol_dict); |
763 } | 763 } |
(...skipping 25 matching lines...) Expand all Loading... |
789 completion.Run(); | 789 completion.Run(); |
790 } | 790 } |
791 | 791 |
792 void HttpServerPropertiesManager::OnHttpServerPropertiesChanged() { | 792 void HttpServerPropertiesManager::OnHttpServerPropertiesChanged() { |
793 DCHECK(pref_task_runner_->RunsTasksOnCurrentThread()); | 793 DCHECK(pref_task_runner_->RunsTasksOnCurrentThread()); |
794 if (!setting_prefs_) | 794 if (!setting_prefs_) |
795 ScheduleUpdateCacheOnPrefThread(); | 795 ScheduleUpdateCacheOnPrefThread(); |
796 } | 796 } |
797 | 797 |
798 } // namespace net | 798 } // namespace net |
OLD | NEW |