OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 #ifndef CHROME_BROWSER_AUTOCOMPLETE_NETWORK_ACTION_PREDICTOR_H_ | 5 #ifndef CHROME_BROWSER_AUTOCOMPLETE_NETWORK_ACTION_PREDICTOR_H_ |
6 #define CHROME_BROWSER_AUTOCOMPLETE_NETWORK_ACTION_PREDICTOR_H_ | 6 #define CHROME_BROWSER_AUTOCOMPLETE_NETWORK_ACTION_PREDICTOR_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <map> | 9 #include <map> |
10 | 10 |
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
134 // if the history service is available, or registers for the notification of | 134 // if the history service is available, or registers for the notification of |
135 // it becoming available. | 135 // it becoming available. |
136 void CreateCaches( | 136 void CreateCaches( |
137 std::vector<NetworkActionPredictorDatabase::Row>* row_buffer); | 137 std::vector<NetworkActionPredictorDatabase::Row>* row_buffer); |
138 | 138 |
139 // Attempts to call DeleteOldEntries if the in-memory database has been loaded | 139 // Attempts to call DeleteOldEntries if the in-memory database has been loaded |
140 // by |service|. Returns success as a boolean. | 140 // by |service|. Returns success as a boolean. |
141 bool TryDeleteOldEntries(HistoryService* service); | 141 bool TryDeleteOldEntries(HistoryService* service); |
142 | 142 |
143 // Uses local caches to calculate an exact percentage prediction that the user | 143 // Uses local caches to calculate an exact percentage prediction that the user |
144 // will take a particular match given what they have typed. | 144 // will take a particular match given what they have typed. |is_in_db| is set |
145 double ExactAlgorithm(const string16& user_text, | 145 // to differentiate trivial zero results resulting from a match not being |
146 const AutocompleteMatch& match) const; | 146 // found from actual zero results where the calculation returns 0.0. |
| 147 double CalculateConfidence(const string16& user_text, |
| 148 const AutocompleteMatch& match, |
| 149 bool* is_in_db) const; |
147 | 150 |
148 // Adds a row to the database and caches. | 151 // Adds a row to the database and caches. |
149 void AddRow(const DBCacheKey& key, | 152 void AddRow(const DBCacheKey& key, |
150 const NetworkActionPredictorDatabase::Row& row); | 153 const NetworkActionPredictorDatabase::Row& row); |
151 | 154 |
152 // Updates a row in the database and the caches. | 155 // Updates a row in the database and the caches. |
153 void UpdateRow(DBCacheMap::iterator it, | 156 void UpdateRow(DBCacheMap::iterator it, |
154 const NetworkActionPredictorDatabase::Row& row); | 157 const NetworkActionPredictorDatabase::Row& row); |
155 | 158 |
156 // Removes all rows from the database and caches. | 159 // Removes all rows from the database and caches. |
(...skipping 15 matching lines...) Expand all Loading... |
172 | 175 |
173 DBCacheMap db_cache_; | 176 DBCacheMap db_cache_; |
174 DBIdCacheMap db_id_cache_; | 177 DBIdCacheMap db_id_cache_; |
175 | 178 |
176 bool initialized_; | 179 bool initialized_; |
177 | 180 |
178 DISALLOW_COPY_AND_ASSIGN(NetworkActionPredictor); | 181 DISALLOW_COPY_AND_ASSIGN(NetworkActionPredictor); |
179 }; | 182 }; |
180 | 183 |
181 #endif // CHROME_BROWSER_AUTOCOMPLETE_NETWORK_ACTION_PREDICTOR_H_ | 184 #endif // CHROME_BROWSER_AUTOCOMPLETE_NETWORK_ACTION_PREDICTOR_H_ |
OLD | NEW |