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 16 matching lines...) Expand all Loading... |
27 | 27 |
28 LoggedInPredictorTable::LoggedInPredictorTable() | 28 LoggedInPredictorTable::LoggedInPredictorTable() |
29 : PredictorTableBase() { | 29 : PredictorTableBase() { |
30 } | 30 } |
31 | 31 |
32 LoggedInPredictorTable::~LoggedInPredictorTable() { | 32 LoggedInPredictorTable::~LoggedInPredictorTable() { |
33 } | 33 } |
34 | 34 |
35 string LoggedInPredictorTable::GetKey(const GURL& url) const { | 35 string LoggedInPredictorTable::GetKey(const GURL& url) const { |
36 string effective_domain( | 36 string effective_domain( |
37 net::RegistryControlledDomainService::GetDomainAndRegistry(url.host())); | 37 net::RegistryControlledDomainService::GetDomainAndRegistry( |
| 38 url.host(), net::RCDS::EXCLUDE_PRIVATE_REGISTRIES)); |
38 if (effective_domain.empty()) | 39 if (effective_domain.empty()) |
39 effective_domain = url.host(); | 40 effective_domain = url.host(); |
40 | 41 |
41 // Strip off a preceding ".", if present. | 42 // Strip off a preceding ".", if present. |
42 if (!effective_domain.empty() && effective_domain[0] == '.') | 43 if (!effective_domain.empty() && effective_domain[0] == '.') |
43 return effective_domain.substr(1); | 44 return effective_domain.substr(1); |
44 return effective_domain; | 45 return effective_domain; |
45 } | 46 } |
46 | 47 |
47 void LoggedInPredictorTable::Add(const GURL& url) { | 48 void LoggedInPredictorTable::Add(const GURL& url) { |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
116 return; | 117 return; |
117 | 118 |
118 Statement statement(DB()->GetCachedStatement(SQL_FROM_HERE, | 119 Statement statement(DB()->GetCachedStatement(SQL_FROM_HERE, |
119 base::StringPrintf("SELECT count(*) FROM %s", kTableName).c_str())); | 120 base::StringPrintf("SELECT count(*) FROM %s", kTableName).c_str())); |
120 if (statement.Step()) | 121 if (statement.Step()) |
121 UMA_HISTOGRAM_COUNTS("LoggedInPredictor.TableRowCount", | 122 UMA_HISTOGRAM_COUNTS("LoggedInPredictor.TableRowCount", |
122 statement.ColumnInt(0)); | 123 statement.ColumnInt(0)); |
123 } | 124 } |
124 | 125 |
125 } // namespace predictors | 126 } // namespace predictors |
OLD | NEW |