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