| 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 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <map> | 9 #include <map> |
| 10 | 10 |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 48 enum Action { | 48 enum Action { |
| 49 ACTION_PRERENDER = 0, | 49 ACTION_PRERENDER = 0, |
| 50 ACTION_PRECONNECT, | 50 ACTION_PRECONNECT, |
| 51 ACTION_NONE, | 51 ACTION_NONE, |
| 52 LAST_PREDICT_ACTION = ACTION_NONE | 52 LAST_PREDICT_ACTION = ACTION_NONE |
| 53 }; | 53 }; |
| 54 | 54 |
| 55 explicit AutocompleteActionPredictor(Profile* profile); | 55 explicit AutocompleteActionPredictor(Profile* profile); |
| 56 virtual ~AutocompleteActionPredictor(); | 56 virtual ~AutocompleteActionPredictor(); |
| 57 | 57 |
| 58 static void set_hit_weight(double weight) { hit_weight_ = weight; } | |
| 59 static double get_hit_weight() { return hit_weight_; } | |
| 60 | |
| 61 // Registers an AutocompleteResult for a given |user_text|. This will be used | 58 // Registers an AutocompleteResult for a given |user_text|. This will be used |
| 62 // when the user navigates from the Omnibox to determine early opportunities | 59 // when the user navigates from the Omnibox to determine early opportunities |
| 63 // to predict their actions. | 60 // to predict their actions. |
| 64 void RegisterTransitionalMatches(const string16& user_text, | 61 void RegisterTransitionalMatches(const string16& user_text, |
| 65 const AutocompleteResult& result); | 62 const AutocompleteResult& result); |
| 66 | 63 |
| 67 // Clears any transitional matches that have been registered. Called when, for | 64 // Clears any transitional matches that have been registered. Called when, for |
| 68 // example, the AutocompleteEditModel is reverted. | 65 // example, the AutocompleteEditModel is reverted. |
| 69 void ClearTransitionalMatches(); | 66 void ClearTransitionalMatches(); |
| 70 | 67 |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 115 int number_of_hits; | 112 int number_of_hits; |
| 116 int number_of_misses; | 113 int number_of_misses; |
| 117 }; | 114 }; |
| 118 | 115 |
| 119 typedef std::map<DBCacheKey, DBCacheValue> DBCacheMap; | 116 typedef std::map<DBCacheKey, DBCacheValue> DBCacheMap; |
| 120 typedef std::map<DBCacheKey, AutocompleteActionPredictorTable::Row::Id> | 117 typedef std::map<DBCacheKey, AutocompleteActionPredictorTable::Row::Id> |
| 121 DBIdCacheMap; | 118 DBIdCacheMap; |
| 122 | 119 |
| 123 static const int kMaximumDaysToKeepEntry; | 120 static const int kMaximumDaysToKeepEntry; |
| 124 | 121 |
| 125 // Multiplying factor applied to the |number_of_hits| for a database entry | |
| 126 // when calculating the confidence. It is currently set by a field trial so is | |
| 127 // static. Once the field trial ends, this will be a constant value. | |
| 128 static double hit_weight_; | |
| 129 | |
| 130 // NotificationObserver | 122 // NotificationObserver |
| 131 virtual void Observe(int type, | 123 virtual void Observe(int type, |
| 132 const content::NotificationSource& source, | 124 const content::NotificationSource& source, |
| 133 const content::NotificationDetails& details) OVERRIDE; | 125 const content::NotificationDetails& details) OVERRIDE; |
| 134 | 126 |
| 135 // Called when NOTIFICATION_OMNIBOX_OPENED_URL is observed. | 127 // Called when NOTIFICATION_OMNIBOX_OPENED_URL is observed. |
| 136 void OnOmniboxOpenedUrl(const AutocompleteLog& log); | 128 void OnOmniboxOpenedUrl(const AutocompleteLog& log); |
| 137 | 129 |
| 138 // Deletes any old or invalid entries from the local caches. |url_db| and | 130 // Deletes any old or invalid entries from the local caches. |url_db| and |
| 139 // |id_list| must not be NULL. Every row id deleted will be added to id_list. | 131 // |id_list| must not be NULL. Every row id deleted will be added to id_list. |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 192 DBIdCacheMap db_id_cache_; | 184 DBIdCacheMap db_id_cache_; |
| 193 | 185 |
| 194 bool initialized_; | 186 bool initialized_; |
| 195 | 187 |
| 196 DISALLOW_COPY_AND_ASSIGN(AutocompleteActionPredictor); | 188 DISALLOW_COPY_AND_ASSIGN(AutocompleteActionPredictor); |
| 197 }; | 189 }; |
| 198 | 190 |
| 199 } // namespace predictors | 191 } // namespace predictors |
| 200 | 192 |
| 201 #endif // CHROME_BROWSER_PREDICTORS_AUTOCOMPLETE_ACTION_PREDICTOR_H_ | 193 #endif // CHROME_BROWSER_PREDICTORS_AUTOCOMPLETE_ACTION_PREDICTOR_H_ |
| OLD | NEW |