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

Side by Side Diff: chrome/browser/predictors/logged_in_predictor_table.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
« no previous file with comments | « chrome/browser/net/url_fixer_upper.cc ('k') | chrome/browser/safe_browsing/ui_manager.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 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/predictors/logged_in_predictor_table.h" 5 #include "chrome/browser/predictors/logged_in_predictor_table.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <utility> 8 #include <utility>
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/metrics/histogram.h" 10 #include "base/metrics/histogram.h"
(...skipping 22 matching lines...) Expand all
33 } 33 }
34 34
35 // static 35 // static
36 string LoggedInPredictorTable::GetKey(const GURL& url) { 36 string LoggedInPredictorTable::GetKey(const GURL& url) {
37 return GetKeyFromDomain(url.host()); 37 return GetKeyFromDomain(url.host());
38 } 38 }
39 39
40 // static 40 // static
41 string LoggedInPredictorTable::GetKeyFromDomain(const std::string& domain) { 41 string LoggedInPredictorTable::GetKeyFromDomain(const std::string& domain) {
42 string effective_domain( 42 string effective_domain(
43 net::RegistryControlledDomainService::GetDomainAndRegistry(domain)); 43 net::registry_controlled_domains::GetDomainAndRegistry(
44 domain,
45 net::registry_controlled_domains::EXCLUDE_PRIVATE_REGISTRIES));
44 if (effective_domain.empty()) 46 if (effective_domain.empty())
45 effective_domain = domain; 47 effective_domain = domain;
46 48
47 // Strip off a preceding ".", if present. 49 // Strip off a preceding ".", if present.
48 if (!effective_domain.empty() && effective_domain[0] == '.') 50 if (!effective_domain.empty() && effective_domain[0] == '.')
49 return effective_domain.substr(1); 51 return effective_domain.substr(1);
50 return effective_domain; 52 return effective_domain;
51 } 53 }
52 54
53 void LoggedInPredictorTable::AddDomainFromURL(const GURL& url) { 55 void LoggedInPredictorTable::AddDomainFromURL(const GURL& url) {
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
157 return; 159 return;
158 160
159 Statement statement(DB()->GetCachedStatement(SQL_FROM_HERE, 161 Statement statement(DB()->GetCachedStatement(SQL_FROM_HERE,
160 base::StringPrintf("SELECT count(*) FROM %s", kTableName).c_str())); 162 base::StringPrintf("SELECT count(*) FROM %s", kTableName).c_str()));
161 if (statement.Step()) 163 if (statement.Step())
162 UMA_HISTOGRAM_COUNTS("LoggedInPredictor.TableRowCount", 164 UMA_HISTOGRAM_COUNTS("LoggedInPredictor.TableRowCount",
163 statement.ColumnInt(0)); 165 statement.ColumnInt(0));
164 } 166 }
165 167
166 } // namespace predictors 168 } // namespace predictors
OLDNEW
« no previous file with comments | « chrome/browser/net/url_fixer_upper.cc ('k') | chrome/browser/safe_browsing/ui_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698