| 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 465 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 476 | 476 |
| 477 if (version < 4) { | 477 if (version < 4) { |
| 478 if (!AddServersData(*servers_dict, spdy_servers.get(), | 478 if (!AddServersData(*servers_dict, spdy_servers.get(), |
| 479 alternative_service_map.get(), | 479 alternative_service_map.get(), |
| 480 server_network_stats_map.get(), version)) { | 480 server_network_stats_map.get(), version)) { |
| 481 detected_corrupted_prefs = true; | 481 detected_corrupted_prefs = true; |
| 482 } | 482 } |
| 483 } else { | 483 } else { |
| 484 for (base::ListValue::const_iterator it = servers_list->begin(); | 484 for (base::ListValue::const_iterator it = servers_list->begin(); |
| 485 it != servers_list->end(); ++it) { | 485 it != servers_list->end(); ++it) { |
| 486 if (!(*it)->GetAsDictionary(&servers_dict)) { | 486 if (!it->GetAsDictionary(&servers_dict)) { |
| 487 DVLOG(1) << "Malformed http_server_properties for servers dictionary."; | 487 DVLOG(1) << "Malformed http_server_properties for servers dictionary."; |
| 488 detected_corrupted_prefs = true; | 488 detected_corrupted_prefs = true; |
| 489 continue; | 489 continue; |
| 490 } | 490 } |
| 491 if (!AddServersData(*servers_dict, spdy_servers.get(), | 491 if (!AddServersData(*servers_dict, spdy_servers.get(), |
| 492 alternative_service_map.get(), | 492 alternative_service_map.get(), |
| 493 server_network_stats_map.get(), version)) { | 493 server_network_stats_map.get(), version)) { |
| 494 detected_corrupted_prefs = true; | 494 detected_corrupted_prefs = true; |
| 495 } | 495 } |
| 496 } | 496 } |
| (...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 634 kAlternativeServiceKey, &alternative_service_list)) { | 634 kAlternativeServiceKey, &alternative_service_list)) { |
| 635 return true; | 635 return true; |
| 636 } | 636 } |
| 637 if (server.scheme() != "https") { | 637 if (server.scheme() != "https") { |
| 638 return false; | 638 return false; |
| 639 } | 639 } |
| 640 | 640 |
| 641 AlternativeServiceInfoVector alternative_service_info_vector; | 641 AlternativeServiceInfoVector alternative_service_info_vector; |
| 642 for (const auto& alternative_service_list_item : *alternative_service_list) { | 642 for (const auto& alternative_service_list_item : *alternative_service_list) { |
| 643 const base::DictionaryValue* alternative_service_dict; | 643 const base::DictionaryValue* alternative_service_dict; |
| 644 if (!alternative_service_list_item->GetAsDictionary( | 644 if (!alternative_service_list_item.GetAsDictionary( |
| 645 &alternative_service_dict)) | 645 &alternative_service_dict)) |
| 646 return false; | 646 return false; |
| 647 AlternativeServiceInfo alternative_service_info; | 647 AlternativeServiceInfo alternative_service_info; |
| 648 if (!ParseAlternativeServiceDict(*alternative_service_dict, | 648 if (!ParseAlternativeServiceDict(*alternative_service_dict, |
| 649 server.Serialize(), | 649 server.Serialize(), |
| 650 &alternative_service_info)) { | 650 &alternative_service_info)) { |
| 651 return false; | 651 return false; |
| 652 } | 652 } |
| 653 if (base::Time::Now() < alternative_service_info.expiration) { | 653 if (base::Time::Now() < alternative_service_info.expiration) { |
| 654 alternative_service_info_vector.push_back(alternative_service_info); | 654 alternative_service_info_vector.push_back(alternative_service_info); |
| (...skipping 481 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1136 if (!setting_prefs_) | 1136 if (!setting_prefs_) |
| 1137 ScheduleUpdateCacheOnPrefThread(); | 1137 ScheduleUpdateCacheOnPrefThread(); |
| 1138 } | 1138 } |
| 1139 | 1139 |
| 1140 void HttpServerPropertiesManager::SetInitialized() { | 1140 void HttpServerPropertiesManager::SetInitialized() { |
| 1141 DCHECK(network_task_runner_->RunsTasksOnCurrentThread()); | 1141 DCHECK(network_task_runner_->RunsTasksOnCurrentThread()); |
| 1142 is_initialized_ = true; | 1142 is_initialized_ = true; |
| 1143 } | 1143 } |
| 1144 | 1144 |
| 1145 } // namespace net | 1145 } // namespace net |
| OLD | NEW |