OLD | NEW |
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 #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 |
11 #include "base/gtest_prod_util.h" | 11 #include "base/gtest_prod_util.h" |
12 #include "base/memory/scoped_ptr.h" | 12 #include "base/memory/scoped_ptr.h" |
13 #include "base/memory/weak_ptr.h" | 13 #include "base/memory/weak_ptr.h" |
14 #include "base/string16.h" | 14 #include "base/string16.h" |
15 #include "chrome/browser/autocomplete/network_action_predictor_database.h" | 15 #include "chrome/browser/autocomplete/network_action_predictor_database.h" |
| 16 #include "chrome/browser/history/history_types.h" |
16 #include "chrome/browser/profiles/profile_keyed_service.h" | 17 #include "chrome/browser/profiles/profile_keyed_service.h" |
17 #include "content/public/browser/notification_observer.h" | 18 #include "content/public/browser/notification_observer.h" |
18 #include "content/public/browser/notification_registrar.h" | 19 #include "content/public/browser/notification_registrar.h" |
19 #include "googleurl/src/gurl.h" | 20 #include "googleurl/src/gurl.h" |
20 | 21 |
21 struct AutocompleteLog; | 22 struct AutocompleteLog; |
22 struct AutocompleteMatch; | 23 struct AutocompleteMatch; |
23 class AutocompleteResult; | 24 class AutocompleteResult; |
24 class HistoryService; | 25 class HistoryService; |
25 class Profile; | 26 class Profile; |
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
169 void AddRow(const DBCacheKey& key, | 170 void AddRow(const DBCacheKey& key, |
170 const NetworkActionPredictorDatabase::Row& row); | 171 const NetworkActionPredictorDatabase::Row& row); |
171 | 172 |
172 // Updates a row in the database and the caches. | 173 // Updates a row in the database and the caches. |
173 void UpdateRow(DBCacheMap::iterator it, | 174 void UpdateRow(DBCacheMap::iterator it, |
174 const NetworkActionPredictorDatabase::Row& row); | 175 const NetworkActionPredictorDatabase::Row& row); |
175 | 176 |
176 // Removes all rows from the database and caches. | 177 // Removes all rows from the database and caches. |
177 void DeleteAllRows(); | 178 void DeleteAllRows(); |
178 | 179 |
179 // Removes rows from the database and caches that contain a URL in |urls|. | 180 // Removes rows from the database and caches that contain a URL in |rows|. |
180 void DeleteRowsWithURLs(const std::set<GURL>& urls); | 181 void DeleteRowsWithURLs(const history::URLRows& rows); |
181 | 182 |
182 // Used to batch operations on the database. | 183 // Used to batch operations on the database. |
183 void BeginTransaction(); | 184 void BeginTransaction(); |
184 void CommitTransaction(); | 185 void CommitTransaction(); |
185 | 186 |
186 Profile* profile_; | 187 Profile* profile_; |
187 scoped_refptr<NetworkActionPredictorDatabase> db_; | 188 scoped_refptr<NetworkActionPredictorDatabase> db_; |
188 content::NotificationRegistrar notification_registrar_; | 189 content::NotificationRegistrar notification_registrar_; |
189 | 190 |
190 // This is cleared after every Omnibox navigation. | 191 // This is cleared after every Omnibox navigation. |
191 std::vector<TransitionalMatch> transitional_matches_; | 192 std::vector<TransitionalMatch> transitional_matches_; |
192 | 193 |
193 // This allows us to predict the effect of confidence threshold changes on | 194 // This allows us to predict the effect of confidence threshold changes on |
194 // accuracy. | 195 // accuracy. |
195 mutable std::vector<std::pair<GURL, double> > tracked_urls_; | 196 mutable std::vector<std::pair<GURL, double> > tracked_urls_; |
196 | 197 |
197 DBCacheMap db_cache_; | 198 DBCacheMap db_cache_; |
198 DBIdCacheMap db_id_cache_; | 199 DBIdCacheMap db_id_cache_; |
199 | 200 |
200 bool initialized_; | 201 bool initialized_; |
201 | 202 |
202 DISALLOW_COPY_AND_ASSIGN(NetworkActionPredictor); | 203 DISALLOW_COPY_AND_ASSIGN(NetworkActionPredictor); |
203 }; | 204 }; |
204 | 205 |
205 #endif // CHROME_BROWSER_AUTOCOMPLETE_NETWORK_ACTION_PREDICTOR_H_ | 206 #endif // CHROME_BROWSER_AUTOCOMPLETE_NETWORK_ACTION_PREDICTOR_H_ |
OLD | NEW |