diff options
author | sky@chromium.org <sky@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-12-08 21:33:20 +0000 |
---|---|---|
committer | sky@chromium.org <sky@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-12-08 21:33:20 +0000 |
commit | 058baa2f74397cf0c05de99e3538570c11803588 (patch) | |
tree | 9f4b45938af87814782fac4a3103f33953fe1eaf /chrome/browser | |
parent | 03ac7747b8185a508ad89ff87f64c4e3b1c5a8d3 (diff) | |
download | chromium_src-058baa2f74397cf0c05de99e3538570c11803588.zip chromium_src-058baa2f74397cf0c05de99e3538570c11803588.tar.gz chromium_src-058baa2f74397cf0c05de99e3538570c11803588.tar.bz2 |
Fixes bug where tab/right-arrow to commit results wouldn't always
work. When you press tab/right-arrow we tell the search provider to
update the results. The search provider ignores the request if it was
previously told there are no more results coming. When the location
bar updates (AutocompleteEditController::OnChanged) it tells the
search provider there are no more results coming if whatever it is
loading supports instant. The bug was the existing code was using the
state of what is being displayed when it should have been using the
state of what is being loaded, otherwise if they are different it
prematurely finalizes the search provider so that when we go to commit
it does nothing.
I'm also fixing a bug in LocationBarViewGtk::OnCommitSuggestedText. It
wasn't updating instant and it now needs to.
Lastly I changed windows to not fade out the background if animations
are disabled (this doesn't really fit in with these changes, but I'm
trying to minimize merges).
BUG=65706
TEST=see bug, although this is heavily dependant upon your profile.
Review URL: http://codereview.chromium.org/5659004
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@68638 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser')
6 files changed, 25 insertions, 10 deletions
diff --git a/chrome/browser/gtk/location_bar_view_gtk.cc b/chrome/browser/gtk/location_bar_view_gtk.cc index c95dc2a..b82bcfd 100644 --- a/chrome/browser/gtk/location_bar_view_gtk.cc +++ b/chrome/browser/gtk/location_bar_view_gtk.cc @@ -460,11 +460,7 @@ bool LocationBarViewGtk::OnCommitSuggestedText( if (!instant) return false; - bool updating_instant = update_instant_; - update_instant_ = false; - bool rv = location_entry_->CommitInstantSuggestion(); - update_instant_ = updating_instant; - return rv; + return location_entry_->CommitInstantSuggestion(); } bool LocationBarViewGtk::AcceptCurrentInstantPreview() { @@ -551,7 +547,7 @@ void LocationBarViewGtk::OnChanged() { WideToUTF16(location_entry_->GetText()), location_entry_->model()->UseVerbatimInstant(), &suggested_text); - if (!instant->IsShowingInstant()) + if (!instant->MightSupportInstant()) location_entry_->model()->FinalizeInstantQuery(std::wstring()); } else { instant->DestroyPreviewContents(); diff --git a/chrome/browser/instant/instant_controller.cc b/chrome/browser/instant/instant_controller.cc index f854632..4e58b8f 100644 --- a/chrome/browser/instant/instant_controller.cc +++ b/chrome/browser/instant/instant_controller.cc @@ -321,6 +321,11 @@ bool InstantController::IsShowingInstant() { loader_manager_->current_loader()->is_showing_instant(); } +bool InstantController::MightSupportInstant() { + return loader_manager_.get() && + loader_manager_->active_loader()->is_showing_instant(); +} + void InstantController::ShowInstantLoader(InstantLoader* loader) { DCHECK(loader_manager_.get()); if (loader_manager_->current_loader() == loader) { diff --git a/chrome/browser/instant/instant_controller.h b/chrome/browser/instant/instant_controller.h index 51104c3..08630d1 100644 --- a/chrome/browser/instant/instant_controller.h +++ b/chrome/browser/instant/instant_controller.h @@ -162,9 +162,23 @@ class InstantController : public InstantLoaderDelegate { return last_transition_type_; } - // Are we showing instant results? + // Returns true if we're showing results from a provider that supports the + // instant API. See description of |MightSupportInstant| for how this + // differs from actual loading state. bool IsShowingInstant(); + // Returns true if we're attempting to use the instant API with the last URL + // passed to |Update|. The value of this may change if it turns the provider + // doesn't really support the instant API. + // The value of |IsShowingInstant| indicates whether what is currently + // displayed supports instant, whereas this returns the loading state. The + // state of |IsShowingInstant| differs when transitioning from a non-search + // provider to a search provider that supports instant (or the other way + // around). For example, if |Update| is passed www.foo.com, followed by a + // search string then this returns true, but |IsShowingInstant| returns false + // (until the search provider loads, then both return true). + bool MightSupportInstant(); + // InstantLoaderDelegate virtual void ShowInstantLoader(InstantLoader* loader); virtual void SetSuggestedTextFor(InstantLoader* loader, diff --git a/chrome/browser/ui/cocoa/location_bar/location_bar_view_mac.mm b/chrome/browser/ui/cocoa/location_bar/location_bar_view_mac.mm index d9d394e..d45e692 100644 --- a/chrome/browser/ui/cocoa/location_bar/location_bar_view_mac.mm +++ b/chrome/browser/ui/cocoa/location_bar/location_bar_view_mac.mm @@ -324,7 +324,7 @@ void LocationBarViewMac::OnChanged() { WideToUTF16(edit_view_->GetText()), edit_view_->model()->UseVerbatimInstant(), &suggested_text); - if (!instant->IsShowingInstant()) + if (!instant->MightSupportInstant()) edit_view_->model()->FinalizeInstantQuery(std::wstring()); } else { instant->DestroyPreviewContents(); diff --git a/chrome/browser/ui/views/frame/contents_container.cc b/chrome/browser/ui/views/frame/contents_container.cc index 084c87f..0e24ac7 100644 --- a/chrome/browser/ui/views/frame/contents_container.cc +++ b/chrome/browser/ui/views/frame/contents_container.cc @@ -68,7 +68,7 @@ gfx::Rect ContentsContainer::GetPreviewBounds() { } void ContentsContainer::FadeActiveContents() { - if (active_overlay_) + if (active_overlay_ || !Animation::ShouldRenderRichAnimation()) return; #if !defined(OS_WIN) diff --git a/chrome/browser/ui/views/location_bar/location_bar_view.cc b/chrome/browser/ui/views/location_bar/location_bar_view.cc index 2d377e0..8fe7bdb 100644 --- a/chrome/browser/ui/views/location_bar/location_bar_view.cc +++ b/chrome/browser/ui/views/location_bar/location_bar_view.cc @@ -852,7 +852,7 @@ void LocationBarView::OnChanged() { WideToUTF16(location_entry_->GetText()), location_entry_->model()->UseVerbatimInstant(), &suggested_text); - if (!instant->IsShowingInstant()) + if (!instant->MightSupportInstant()) location_entry_->model()->FinalizeInstantQuery(std::wstring()); } else { instant->DestroyPreviewContents(); |