| 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 "net/base/sdch_manager.h" | 5 #include "net/base/sdch_manager.h" |
| 6 | 6 |
| 7 #include "base/base64.h" | 7 #include "base/base64.h" |
| 8 #include "base/logging.h" | 8 #include "base/logging.h" |
| 9 #include "base/metrics/histogram.h" | 9 #include "base/metrics/histogram.h" |
| 10 #include "base/string_number_conversions.h" | 10 #include "base/string_number_conversions.h" |
| (...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 102 */ | 102 */ |
| 103 | 103 |
| 104 // TODO(jar): Redirects in dictionary fetches might plausibly be problematic, | 104 // TODO(jar): Redirects in dictionary fetches might plausibly be problematic, |
| 105 // and hence the conservative approach is to not allow any redirects (if there | 105 // and hence the conservative approach is to not allow any redirects (if there |
| 106 // were any... then don't allow the dictionary to be set). | 106 // were any... then don't allow the dictionary to be set). |
| 107 | 107 |
| 108 if (domain.empty()) { | 108 if (domain.empty()) { |
| 109 SdchErrorRecovery(DICTIONARY_MISSING_DOMAIN_SPECIFIER); | 109 SdchErrorRecovery(DICTIONARY_MISSING_DOMAIN_SPECIFIER); |
| 110 return false; // Domain is required. | 110 return false; // Domain is required. |
| 111 } | 111 } |
| 112 if (RegistryControlledDomainService::GetDomainAndRegistry(domain).empty()) { | 112 if (registry_controlled_domains::GetDomainAndRegistry( |
| 113 domain, |
| 114 registry_controlled_domains::EXCLUDE_PRIVATE_REGISTRIES).empty()) { |
| 113 SdchErrorRecovery(DICTIONARY_SPECIFIES_TOP_LEVEL_DOMAIN); | 115 SdchErrorRecovery(DICTIONARY_SPECIFIES_TOP_LEVEL_DOMAIN); |
| 114 return false; // domain was a TLD. | 116 return false; // domain was a TLD. |
| 115 } | 117 } |
| 116 if (!Dictionary::DomainMatch(dictionary_url, domain)) { | 118 if (!Dictionary::DomainMatch(dictionary_url, domain)) { |
| 117 SdchErrorRecovery(DICTIONARY_DOMAIN_NOT_MATCHING_SOURCE_URL); | 119 SdchErrorRecovery(DICTIONARY_DOMAIN_NOT_MATCHING_SOURCE_URL); |
| 118 return false; | 120 return false; |
| 119 } | 121 } |
| 120 | 122 |
| 121 std::string referrer_url_host = dictionary_url.host(); | 123 std::string referrer_url_host = dictionary_url.host(); |
| 122 size_t postfix_domain_index = referrer_url_host.rfind(domain); | 124 size_t postfix_domain_index = referrer_url_host.rfind(domain); |
| (...skipping 432 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 555 case '/': | 557 case '/': |
| 556 (*output)[i] = '_'; | 558 (*output)[i] = '_'; |
| 557 continue; | 559 continue; |
| 558 default: | 560 default: |
| 559 continue; | 561 continue; |
| 560 } | 562 } |
| 561 } | 563 } |
| 562 } | 564 } |
| 563 | 565 |
| 564 } // namespace net | 566 } // namespace net |
| OLD | NEW |