Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(411)

Unified Diff: chrome/browser/autocomplete/network_action_predictor.h

Issue 8600004: Adding a fourth omnibox prerender experiment. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/autocomplete/network_action_predictor.h
diff --git a/chrome/browser/autocomplete/network_action_predictor.h b/chrome/browser/autocomplete/network_action_predictor.h
index 60d710a32746d9902c2d0c9e4fa855b8222aefb5..7185d797cad31951ec000aea7299bd4d92eedc77 100644
--- a/chrome/browser/autocomplete/network_action_predictor.h
+++ b/chrome/browser/autocomplete/network_action_predictor.h
@@ -17,7 +17,9 @@
#include "content/public/browser/notification_registrar.h"
#include "googleurl/src/gurl.h"
+struct AutocompleteLog;
struct AutocompleteMatch;
+class AutocompleteResult;
class HistoryService;
class Profile;
@@ -47,6 +49,16 @@ class NetworkActionPredictor
explicit NetworkActionPredictor(Profile* profile);
virtual ~NetworkActionPredictor();
+ // Registers an AutocompleteResult for a given |user_text|. This will be used
+ // when the user navigates from the Omnibox to determine early opportunities
+ // to predict their actions.
+ void RegisterTransitionalMatches(const string16& user_text,
+ const AutocompleteResult& result);
+
+ // Clears any transitional matches that have been registered. Called when, for
+ // example, the AutocompleteEditModel is reverted.
+ void ClearTransitionalMatches();
+
// Return the recommended action given |user_text|, the text the user has
// entered in the Omnibox, and |match|, the suggestion from Autocomplete.
// This method uses information from the ShortcutsBackend including how much
@@ -63,6 +75,15 @@ class NetworkActionPredictor
private:
friend class NetworkActionPredictorTest;
+ struct TransitionalMatch {
+ string16 user_text;
+ std::vector<GURL> urls;
+
+ bool operator==(const string16& other_user_text) const {
+ return user_text.compare(other_user_text) == 0;
Peter Kasting 2011/11/18 21:17:13 Nit: Just return user_text == other_user_text. Ju
dominich 2011/11/18 23:05:51 Done.
+ }
+ };
+
struct DBCacheKey {
string16 user_text;
GURL url;
@@ -93,6 +114,9 @@ class NetworkActionPredictor
const content::NotificationSource& source,
const content::NotificationDetails& details) OVERRIDE;
+ // Called when NOTIFICATION_OMNIBOX_OPENED_URL is observed.
+ void OnOmniboxOpenedUrl(const AutocompleteLog& log);
+
// Deletes any old or invalid entries from the local caches. |url_db| and
// |id_list| must not be NULL. Every row id deleted will be added to id_list.
void DeleteOldIdsFromCaches(
@@ -140,6 +164,9 @@ class NetworkActionPredictor
scoped_refptr<NetworkActionPredictorDatabase> db_;
content::NotificationRegistrar notification_registrar_;
+ // This is cleared after every Omnibox navigation.
+ std::vector<TransitionalMatch> transitional_matches_;
+
DBCacheMap db_cache_;
DBIdCacheMap db_id_cache_;

Powered by Google App Engine
This is Rietveld 408576698