OLD | NEW |
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 Loading... |
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 Loading... |
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 |
OLD | NEW |