| 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_PREDICTORS_AUTOCOMPLETE_ACTION_PREDICTOR_H_ | 5 #ifndef CHROME_BROWSER_PREDICTORS_AUTOCOMPLETE_ACTION_PREDICTOR_H_ |
| 6 #define CHROME_BROWSER_PREDICTORS_AUTOCOMPLETE_ACTION_PREDICTOR_H_ | 6 #define CHROME_BROWSER_PREDICTORS_AUTOCOMPLETE_ACTION_PREDICTOR_H_ |
| 7 | 7 |
| 8 #include <map> | 8 #include <map> |
| 9 | 9 |
| 10 #include "base/gtest_prod_util.h" | 10 #include "base/gtest_prod_util.h" |
| (...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 144 typedef std::map<DBCacheKey, AutocompleteActionPredictorTable::Row::Id> | 144 typedef std::map<DBCacheKey, AutocompleteActionPredictorTable::Row::Id> |
| 145 DBIdCacheMap; | 145 DBIdCacheMap; |
| 146 | 146 |
| 147 static const int kMaximumDaysToKeepEntry; | 147 static const int kMaximumDaysToKeepEntry; |
| 148 | 148 |
| 149 // NotificationObserver | 149 // NotificationObserver |
| 150 virtual void Observe(int type, | 150 virtual void Observe(int type, |
| 151 const content::NotificationSource& source, | 151 const content::NotificationSource& source, |
| 152 const content::NotificationDetails& details) OVERRIDE; | 152 const content::NotificationDetails& details) OVERRIDE; |
| 153 | 153 |
| 154 // The first step in initializing the predictor is accessing the database and |
| 155 // building the local cache. This should be delayed until after critical DB |
| 156 // and IO processes have completed. |
| 157 void CreateLocalCachesFromDatabase(); |
| 158 |
| 154 // Removes all rows from the database and caches. | 159 // Removes all rows from the database and caches. |
| 155 void DeleteAllRows(); | 160 void DeleteAllRows(); |
| 156 | 161 |
| 157 // Removes rows from the database and caches that contain a URL in |rows|. | 162 // Removes rows from the database and caches that contain a URL in |rows|. |
| 158 void DeleteRowsWithURLs(const history::URLRows& rows); | 163 void DeleteRowsWithURLs(const history::URLRows& rows); |
| 159 | 164 |
| 160 // Called when NOTIFICATION_OMNIBOX_OPENED_URL is observed. | 165 // Called when NOTIFICATION_OMNIBOX_OPENED_URL is observed. |
| 161 void OnOmniboxOpenedUrl(const AutocompleteLog& log); | 166 void OnOmniboxOpenedUrl(const AutocompleteLog& log); |
| 162 | 167 |
| 163 // Adds and updates rows in the database and caches. | 168 // Adds and updates rows in the database and caches. |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 233 DBIdCacheMap db_id_cache_; | 238 DBIdCacheMap db_id_cache_; |
| 234 | 239 |
| 235 bool initialized_; | 240 bool initialized_; |
| 236 | 241 |
| 237 DISALLOW_COPY_AND_ASSIGN(AutocompleteActionPredictor); | 242 DISALLOW_COPY_AND_ASSIGN(AutocompleteActionPredictor); |
| 238 }; | 243 }; |
| 239 | 244 |
| 240 } // namespace predictors | 245 } // namespace predictors |
| 241 | 246 |
| 242 #endif // CHROME_BROWSER_PREDICTORS_AUTOCOMPLETE_ACTION_PREDICTOR_H_ | 247 #endif // CHROME_BROWSER_PREDICTORS_AUTOCOMPLETE_ACTION_PREDICTOR_H_ |
| OLD | NEW |