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

Unified Diff: chrome/browser/autocomplete/autocomplete_edit.cc

Issue 8600004: Adding a fourth omnibox prerender experiment. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix clang 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
« no previous file with comments | « no previous file | chrome/browser/autocomplete/network_action_predictor.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/autocomplete/autocomplete_edit.cc
diff --git a/chrome/browser/autocomplete/autocomplete_edit.cc b/chrome/browser/autocomplete/autocomplete_edit.cc
index 096d2adf97abe2bfa346efe9216b83040bb72dde..6c971b8243805dcc17ac28307c5952d3da988527 100644
--- a/chrome/browser/autocomplete/autocomplete_edit.cc
+++ b/chrome/browser/autocomplete/autocomplete_edit.cc
@@ -213,23 +213,29 @@ bool AutocompleteEditModel::AcceptCurrentInstantPreview() {
void AutocompleteEditModel::OnChanged() {
const AutocompleteMatch current_match = CurrentMatch();
- string16 suggested_text;
-
- // Confer with the NetworkActionPredictor to determine what action, if any,
- // we should take. Get the recommended action here even if we don't need it
- // so we can get stats for anyone who is opted in to UMA, but only get it if
- // the user has actually typed something to avoid constructing it before it's
- // needed. Note: This event is triggered as part of startup when the initial
- // tab transitions to the start page.
+ NetworkActionPredictor::Action recommended_action =
+ NetworkActionPredictor::ACTION_NONE;
NetworkActionPredictor* network_action_predictor = user_input_in_progress() ?
profile_->GetNetworkActionPredictor() : NULL;
- NetworkActionPredictor::Action recommended_action = network_action_predictor ?
- network_action_predictor->RecommendAction(user_text_, current_match) :
- NetworkActionPredictor::ACTION_NONE;
+ if (network_action_predictor) {
+ network_action_predictor->RegisterTransitionalMatches(user_text_,
+ result());
+ // Confer with the NetworkActionPredictor to determine what action, if any,
+ // we should take. Get the recommended action here even if we don't need it
+ // so we can get stats for anyone who is opted in to UMA, but only get it if
+ // the user has actually typed something to avoid constructing it before
+ // it's needed. Note: This event is triggered as part of startup when the
+ // initial tab transitions to the start page.
+ recommended_action =
+ network_action_predictor->RecommendAction(user_text_, current_match);
+ }
+
UMA_HISTOGRAM_ENUMERATION("NetworkActionPredictor.Action_" +
prerender::GetOmniboxHistogramSuffix(),
recommended_action,
NetworkActionPredictor::LAST_PREDICT_ACTION);
+ string16 suggested_text;
+
if (DoInstant(current_match, &suggested_text)) {
SetSuggestedText(suggested_text, instant_complete_behavior_);
} else {
@@ -394,6 +400,10 @@ void AutocompleteEditModel::Revert() {
has_temporary_text_ = false;
view_->SetWindowTextAndCaretPos(permanent_text_,
has_focus_ ? permanent_text_.length() : 0);
+ NetworkActionPredictor* network_action_predictor =
+ profile_->GetNetworkActionPredictor();
+ if (network_action_predictor)
+ network_action_predictor->ClearTransitionalMatches();
}
void AutocompleteEditModel::StartAutocomplete(
« no previous file with comments | « no previous file | chrome/browser/autocomplete/network_action_predictor.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698