| 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 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 64 public base::SupportsWeakPtr<AutocompleteActionPredictor> { | 64 public base::SupportsWeakPtr<AutocompleteActionPredictor> { |
| 65 public: | 65 public: |
| 66 enum Action { | 66 enum Action { |
| 67 ACTION_PRERENDER = 0, | 67 ACTION_PRERENDER = 0, |
| 68 ACTION_PRECONNECT, | 68 ACTION_PRECONNECT, |
| 69 ACTION_NONE, | 69 ACTION_NONE, |
| 70 LAST_PREDICT_ACTION = ACTION_NONE | 70 LAST_PREDICT_ACTION = ACTION_NONE |
| 71 }; | 71 }; |
| 72 | 72 |
| 73 explicit AutocompleteActionPredictor(Profile* profile); | 73 explicit AutocompleteActionPredictor(Profile* profile); |
| 74 virtual ~AutocompleteActionPredictor(); | 74 ~AutocompleteActionPredictor() override; |
| 75 | 75 |
| 76 // Registers an AutocompleteResult for a given |user_text|. This will be used | 76 // Registers an AutocompleteResult for a given |user_text|. This will be used |
| 77 // when the user navigates from the Omnibox to determine early opportunities | 77 // when the user navigates from the Omnibox to determine early opportunities |
| 78 // to predict their actions. | 78 // to predict their actions. |
| 79 void RegisterTransitionalMatches(const base::string16& user_text, | 79 void RegisterTransitionalMatches(const base::string16& user_text, |
| 80 const AutocompleteResult& result); | 80 const AutocompleteResult& result); |
| 81 | 81 |
| 82 // Clears any transitional matches that have been registered. Called when, for | 82 // Clears any transitional matches that have been registered. Called when, for |
| 83 // example, the OmniboxEditModel is reverted. | 83 // example, the OmniboxEditModel is reverted. |
| 84 void ClearTransitionalMatches(); | 84 void ClearTransitionalMatches(); |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 147 int number_of_misses; | 147 int number_of_misses; |
| 148 }; | 148 }; |
| 149 | 149 |
| 150 typedef std::map<DBCacheKey, DBCacheValue> DBCacheMap; | 150 typedef std::map<DBCacheKey, DBCacheValue> DBCacheMap; |
| 151 typedef std::map<DBCacheKey, AutocompleteActionPredictorTable::Row::Id> | 151 typedef std::map<DBCacheKey, AutocompleteActionPredictorTable::Row::Id> |
| 152 DBIdCacheMap; | 152 DBIdCacheMap; |
| 153 | 153 |
| 154 static const int kMaximumDaysToKeepEntry; | 154 static const int kMaximumDaysToKeepEntry; |
| 155 | 155 |
| 156 // NotificationObserver | 156 // NotificationObserver |
| 157 virtual void Observe(int type, | 157 void Observe(int type, |
| 158 const content::NotificationSource& source, | 158 const content::NotificationSource& source, |
| 159 const content::NotificationDetails& details) override; | 159 const content::NotificationDetails& details) override; |
| 160 | 160 |
| 161 // The first step in initializing the predictor is accessing the database and | 161 // The first step in initializing the predictor is accessing the database and |
| 162 // building the local cache. This should be delayed until after critical DB | 162 // building the local cache. This should be delayed until after critical DB |
| 163 // and IO processes have completed. | 163 // and IO processes have completed. |
| 164 void CreateLocalCachesFromDatabase(); | 164 void CreateLocalCachesFromDatabase(); |
| 165 | 165 |
| 166 // Removes all rows from the database and caches. | 166 // Removes all rows from the database and caches. |
| 167 void DeleteAllRows(); | 167 void DeleteAllRows(); |
| 168 | 168 |
| 169 // Removes rows from the database and caches that contain a URL in |rows|. | 169 // Removes rows from the database and caches that contain a URL in |rows|. |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 245 DBIdCacheMap db_id_cache_; | 245 DBIdCacheMap db_id_cache_; |
| 246 | 246 |
| 247 bool initialized_; | 247 bool initialized_; |
| 248 | 248 |
| 249 DISALLOW_COPY_AND_ASSIGN(AutocompleteActionPredictor); | 249 DISALLOW_COPY_AND_ASSIGN(AutocompleteActionPredictor); |
| 250 }; | 250 }; |
| 251 | 251 |
| 252 } // namespace predictors | 252 } // namespace predictors |
| 253 | 253 |
| 254 #endif // CHROME_BROWSER_PREDICTORS_AUTOCOMPLETE_ACTION_PREDICTOR_H_ | 254 #endif // CHROME_BROWSER_PREDICTORS_AUTOCOMPLETE_ACTION_PREDICTOR_H_ |
| OLD | NEW |