| 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 <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/memory/ptr_util.h" | 10 #include "base/memory/ptr_util.h" |
| (...skipping 475 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 486 | 486 |
| 487 if (version < 4) { | 487 if (version < 4) { |
| 488 if (!AddServersData(*servers_dict, spdy_servers.get(), | 488 if (!AddServersData(*servers_dict, spdy_servers.get(), |
| 489 alternative_service_map.get(), | 489 alternative_service_map.get(), |
| 490 server_network_stats_map.get(), version)) { | 490 server_network_stats_map.get(), version)) { |
| 491 detected_corrupted_prefs = true; | 491 detected_corrupted_prefs = true; |
| 492 } | 492 } |
| 493 } else { | 493 } else { |
| 494 for (base::ListValue::const_iterator it = servers_list->begin(); | 494 for (base::ListValue::const_iterator it = servers_list->begin(); |
| 495 it != servers_list->end(); ++it) { | 495 it != servers_list->end(); ++it) { |
| 496 if (!(*it)->GetAsDictionary(&servers_dict)) { | 496 if (!it->GetAsDictionary(&servers_dict)) { |
| 497 DVLOG(1) << "Malformed http_server_properties for servers dictionary."; | 497 DVLOG(1) << "Malformed http_server_properties for servers dictionary."; |
| 498 detected_corrupted_prefs = true; | 498 detected_corrupted_prefs = true; |
| 499 continue; | 499 continue; |
| 500 } | 500 } |
| 501 if (!AddServersData(*servers_dict, spdy_servers.get(), | 501 if (!AddServersData(*servers_dict, spdy_servers.get(), |
| 502 alternative_service_map.get(), | 502 alternative_service_map.get(), |
| 503 server_network_stats_map.get(), version)) { | 503 server_network_stats_map.get(), version)) { |
| 504 detected_corrupted_prefs = true; | 504 detected_corrupted_prefs = true; |
| 505 } | 505 } |
| 506 } | 506 } |
| (...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 644 kAlternativeServiceKey, &alternative_service_list)) { | 644 kAlternativeServiceKey, &alternative_service_list)) { |
| 645 return true; | 645 return true; |
| 646 } | 646 } |
| 647 if (server.scheme() != "https") { | 647 if (server.scheme() != "https") { |
| 648 return false; | 648 return false; |
| 649 } | 649 } |
| 650 | 650 |
| 651 AlternativeServiceInfoVector alternative_service_info_vector; | 651 AlternativeServiceInfoVector alternative_service_info_vector; |
| 652 for (const auto& alternative_service_list_item : *alternative_service_list) { | 652 for (const auto& alternative_service_list_item : *alternative_service_list) { |
| 653 const base::DictionaryValue* alternative_service_dict; | 653 const base::DictionaryValue* alternative_service_dict; |
| 654 if (!alternative_service_list_item->GetAsDictionary( | 654 if (!alternative_service_list_item.GetAsDictionary( |
| 655 &alternative_service_dict)) | 655 &alternative_service_dict)) |
| 656 return false; | 656 return false; |
| 657 AlternativeServiceInfo alternative_service_info; | 657 AlternativeServiceInfo alternative_service_info; |
| 658 if (!ParseAlternativeServiceDict(*alternative_service_dict, | 658 if (!ParseAlternativeServiceDict(*alternative_service_dict, |
| 659 server.Serialize(), | 659 server.Serialize(), |
| 660 &alternative_service_info)) { | 660 &alternative_service_info)) { |
| 661 return false; | 661 return false; |
| 662 } | 662 } |
| 663 if (base::Time::Now() < alternative_service_info.expiration) { | 663 if (base::Time::Now() < alternative_service_info.expiration) { |
| 664 alternative_service_info_vector.push_back(alternative_service_info); | 664 alternative_service_info_vector.push_back(alternative_service_info); |
| (...skipping 481 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1146 if (!setting_prefs_) | 1146 if (!setting_prefs_) |
| 1147 ScheduleUpdateCacheOnPrefThread(); | 1147 ScheduleUpdateCacheOnPrefThread(); |
| 1148 } | 1148 } |
| 1149 | 1149 |
| 1150 void HttpServerPropertiesManager::SetInitialized() { | 1150 void HttpServerPropertiesManager::SetInitialized() { |
| 1151 DCHECK(network_task_runner_->RunsTasksOnCurrentThread()); | 1151 DCHECK(network_task_runner_->RunsTasksOnCurrentThread()); |
| 1152 is_initialized_ = true; | 1152 is_initialized_ = true; |
| 1153 } | 1153 } |
| 1154 | 1154 |
| 1155 } // namespace net | 1155 } // namespace net |
| OLD | NEW |