summaryrefslogtreecommitdiffstats
path: root/chrome/browser/autocomplete
diff options
context:
space:
mode:
authorsreeram@chromium.org <sreeram@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-10-04 18:08:15 +0000
committersreeram@chromium.org <sreeram@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-10-04 18:08:15 +0000
commit88f15b5393368eb61397c8828ef786c1b9d02172 (patch)
tree144c1b5cbd1850fff623d868d080fd249acb4fd8 /chrome/browser/autocomplete
parent737cfb2a8cc57c8fbc93c2fb5997f384e01bf0cc (diff)
downloadchromium_src-88f15b5393368eb61397c8828ef786c1b9d02172.zip
chromium_src-88f15b5393368eb61397c8828ef786c1b9d02172.tar.gz
chromium_src-88f15b5393368eb61397c8828ef786c1b9d02172.tar.bz2
Don't destroy instant loaders if you don't have to.
As long as the omnibox retains focus, don't delete any instant loaders. This includes cases where the user is not typing actively, or when the user switches tabs (but retaining focus in the omnibox). The rationale is that the user may type at any time, so it's useful to keep the instant loaders ready to process the user query. BUG=none TEST=PreloadInstantTest.* Review URL: http://codereview.chromium.org/8085010 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@103938 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/autocomplete')
-rw-r--r--chrome/browser/autocomplete/autocomplete_edit.cc18
1 files changed, 7 insertions, 11 deletions
diff --git a/chrome/browser/autocomplete/autocomplete_edit.cc b/chrome/browser/autocomplete/autocomplete_edit.cc
index 742768c..6b31345 100644
--- a/chrome/browser/autocomplete/autocomplete_edit.cc
+++ b/chrome/browser/autocomplete/autocomplete_edit.cc
@@ -1000,19 +1000,15 @@ bool AutocompleteEditModel::DoInstant(const AutocompleteMatch& match,
if (!tab)
return false;
+ // The destination is typically the current URL when the user presses the
+ // down arrow in the omnibox, in which case we shouldn't load a preview.
bool instant_is_active = false;
- if (user_input_in_progress() && popup_->IsOpen()) {
- if (match.destination_url == PermanentURL()) {
- // The destination is the same as the current url. This typically
- // happens if the user presses the down arrow in the omnibox, in which
- // case we don't want to load a preview.
- instant->DestroyPreviewContentsAndLeaveActive();
- } else {
- instant_is_active = instant->Update(tab, match, view_->GetText(),
- UseVerbatimInstant(), suggested_text);
- }
+ if (user_input_in_progress() && popup_->IsOpen() &&
+ match.destination_url != PermanentURL()) {
+ instant_is_active = instant->Update(tab, match, view_->GetText(),
+ UseVerbatimInstant(), suggested_text);
} else {
- instant->DestroyPreviewContents();
+ instant->DestroyPreviewContentsAndLeaveActive();
}
*might_support_instant = instant->MightSupportInstant();