Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(132)

Side by Side Diff: chrome/browser/net/url_fixer_upper.cc

Issue 15140003: Add support for split Public Suffix List distinctions. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebased again Created 7 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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/net/url_fixer_upper.h" 5 #include "chrome/browser/net/url_fixer_upper.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #if defined(OS_POSIX) 9 #if defined(OS_POSIX)
10 #include "base/environment.h" 10 #include "base/environment.h"
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after
188 // Check the TLD. If the return value is positive, we already have a TLD, so 188 // Check the TLD. If the return value is positive, we already have a TLD, so
189 // abort. If the return value is std::string::npos, there's no valid host, 189 // abort. If the return value is std::string::npos, there's no valid host,
190 // but we can try to append a TLD anyway, since the host may become valid once 190 // but we can try to append a TLD anyway, since the host may become valid once
191 // the TLD is attached -- for example, "999999999999" is detected as a broken 191 // the TLD is attached -- for example, "999999999999" is detected as a broken
192 // IP address and marked invalid, but attaching ".com" makes it legal. When 192 // IP address and marked invalid, but attaching ".com" makes it legal. When
193 // the return value is 0, there's a valid host with no known TLD, so we can 193 // the return value is 0, there's a valid host with no known TLD, so we can
194 // definitely append the user's TLD. We disallow unknown registries here so 194 // definitely append the user's TLD. We disallow unknown registries here so
195 // users can input "mail.yahoo" and hit ctrl-enter to get 195 // users can input "mail.yahoo" and hit ctrl-enter to get
196 // "www.mail.yahoo.com". 196 // "www.mail.yahoo.com".
197 const size_t registry_length = 197 const size_t registry_length =
198 net::RegistryControlledDomainService::GetRegistryLength(*domain, false); 198 net::registry_controlled_domains::GetRegistryLength(
199 *domain,
200 net::registry_controlled_domains::EXCLUDE_UNKNOWN_REGISTRIES,
201 net::registry_controlled_domains::EXCLUDE_PRIVATE_REGISTRIES);
199 if ((registry_length != 0) && (registry_length != std::string::npos)) 202 if ((registry_length != 0) && (registry_length != std::string::npos))
200 return; 203 return;
201 204
202 // Add the suffix at the end of the domain. 205 // Add the suffix at the end of the domain.
203 const size_t domain_length(domain->length()); 206 const size_t domain_length(domain->length());
204 DCHECK_GT(domain_length, 0U); 207 DCHECK_GT(domain_length, 0U);
205 DCHECK_NE(desired_tld[0], '.'); 208 DCHECK_NE(desired_tld[0], '.');
206 if ((*domain)[domain_length - 1] != '.') 209 if ((*domain)[domain_length - 1] != '.')
207 domain->push_back('.'); 210 domain->push_back('.');
208 domain->append(desired_tld); 211 domain->append(desired_tld);
(...skipping 424 matching lines...) Expand 10 before | Expand all | Expand 10 after
633 636
634 if (part->is_valid()) { 637 if (part->is_valid()) {
635 // Offset the location of this component. 638 // Offset the location of this component.
636 part->begin += offset; 639 part->begin += offset;
637 640
638 // This part might not have existed in the original text. 641 // This part might not have existed in the original text.
639 if (part->begin < 0) 642 if (part->begin < 0)
640 part->reset(); 643 part->reset();
641 } 644 }
642 } 645 }
OLDNEW
« no previous file with comments | « chrome/browser/intranet_redirect_detector.cc ('k') | chrome/browser/predictors/logged_in_predictor_table.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698