summaryrefslogtreecommitdiffstats
path: root/chrome/browser/autocomplete/network_action_predictor.h
diff options
context:
space:
mode:
authordominich@chromium.org <dominich@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-09-01 06:16:52 +0000
committerdominich@chromium.org <dominich@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-09-01 06:16:52 +0000
commit925136821950cb844c98dcfa88c7807e8708746e (patch)
tree4b2337cac69fee8f562b68fba7385349f5de0045 /chrome/browser/autocomplete/network_action_predictor.h
parent70213de441a0c8e29ffc6f73bd64c78aabba06aa (diff)
downloadchromium_src-925136821950cb844c98dcfa88c7807e8708746e.zip
chromium_src-925136821950cb844c98dcfa88c7807e8708746e.tar.gz
chromium_src-925136821950cb844c98dcfa88c7807e8708746e.tar.bz2
Remove confidence from AutocompleteMatch and use History DB instead.
Adds a class responsible for providing recommended actions given an AutocompleteMatch which uses the History Database to determine that action. BUG=92896,94423 TEST=NetworkActionPredictorTest* Review URL: http://codereview.chromium.org/7686012 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@99140 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/autocomplete/network_action_predictor.h')
-rw-r--r--chrome/browser/autocomplete/network_action_predictor.h45
1 files changed, 45 insertions, 0 deletions
diff --git a/chrome/browser/autocomplete/network_action_predictor.h b/chrome/browser/autocomplete/network_action_predictor.h
new file mode 100644
index 0000000..5be8597
--- /dev/null
+++ b/chrome/browser/autocomplete/network_action_predictor.h
@@ -0,0 +1,45 @@
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CHROME_BROWSER_AUTOCOMPLETE_NETWORK_ACTION_PREDICTOR_H_
+#define CHROME_BROWSER_AUTOCOMPLETE_NETWORK_ACTION_PREDICTOR_H_
+#pragma once
+
+#include "base/string16.h"
+
+struct AutocompleteMatch;
+class Profile;
+
+// This class is responsible for determining the correct predictive network
+// action to take given for a given AutocompleteMatch and entered text.
+class NetworkActionPredictor {
+ public:
+ enum Action {
+ ACTION_PRERENDER = 0,
+ ACTION_PRECONNECT,
+ ACTION_NONE,
+ LAST_PREDICT_ACTION = ACTION_NONE
+ };
+
+ explicit NetworkActionPredictor(Profile* profile);
+ virtual ~NetworkActionPredictor();
+
+ // 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
+ // of the matching entry the user typed, and how long it's been since the user
+ // visited the matching URL, to calculate a score between 0 and 1. This score
+ // is then mapped to an Action.
+ Action RecommendAction(const string16& user_text,
+ const AutocompleteMatch& match) const;
+
+ // Return true if the suggestion type warrants a TCP/IP preconnection.
+ // i.e., it is now quite likely that the user will select the related domain.
+ static bool IsPreconnectable(const AutocompleteMatch& match);
+
+ private:
+ Profile* profile_;
+};
+
+#endif // CHROME_BROWSER_AUTOCOMPLETE_NETWORK_ACTION_PREDICTOR_H_