summaryrefslogtreecommitdiffstats
path: root/chrome/browser
diff options
context:
space:
mode:
authorsky@chromium.org <sky@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-01-06 16:38:53 +0000
committersky@chromium.org <sky@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-01-06 16:38:53 +0000
commit3524260667759b3f2b896c1456eeae26b0e6793d (patch)
treeac58e0bcd6cdcc4637439bad2bde209fe94eaff3 /chrome/browser
parent9115d6dd0c7f7c12cc0f5d3ebb1bec3aae783dab (diff)
downloadchromium_src-3524260667759b3f2b896c1456eeae26b0e6793d.zip
chromium_src-3524260667759b3f2b896c1456eeae26b0e6793d.tar.gz
chromium_src-3524260667759b3f2b896c1456eeae26b0e6793d.tar.bz2
Fixes bug in handling of openning background tabs by way of clicking
on omnibox. BUG=60553 TEST=see bug Review URL: http://codereview.chromium.org/6028010 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@70616 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser')
-rw-r--r--chrome/browser/autocomplete/autocomplete_edit.cc6
-rw-r--r--chrome/browser/autocomplete/autocomplete_edit.h5
-rw-r--r--chrome/browser/gtk/location_bar_view_gtk.cc2
-rw-r--r--chrome/browser/ui/browser.cc8
-rw-r--r--chrome/browser/ui/cocoa/location_bar/location_bar_view_mac.mm2
-rw-r--r--chrome/browser/ui/views/location_bar/location_bar_view.cc4
6 files changed, 18 insertions, 9 deletions
diff --git a/chrome/browser/autocomplete/autocomplete_edit.cc b/chrome/browser/autocomplete/autocomplete_edit.cc
index 62b9564..f08a2e4 100644
--- a/chrome/browser/autocomplete/autocomplete_edit.cc
+++ b/chrome/browser/autocomplete/autocomplete_edit.cc
@@ -429,10 +429,10 @@ void AutocompleteEditModel::OpenURL(const GURL& url,
// search engine, if applicable; see comments in template_url.h.
}
- controller_->OnAutocompleteWillAccept();
-
- if (disposition != NEW_BACKGROUND_TAB)
+ if (disposition != NEW_BACKGROUND_TAB) {
+ controller_->OnAutocompleteWillAccept();
view_->RevertAll(); // Revert the box to its unedited state
+ }
controller_->OnAutocompleteAccept(url, disposition, transition,
alternate_nav_url);
}
diff --git a/chrome/browser/autocomplete/autocomplete_edit.h b/chrome/browser/autocomplete/autocomplete_edit.h
index da0625e..1a8da22 100644
--- a/chrome/browser/autocomplete/autocomplete_edit.h
+++ b/chrome/browser/autocomplete/autocomplete_edit.h
@@ -44,6 +44,8 @@ class AutocompleteEditController {
gfx::NativeView view_gaining_focus) = 0;
// Sent prior to OnAutoCompleteAccept and before the model has been reverted.
+ // This is only invoked if the popup is closed before invoking
+ // OnAutoCompleteAccept.
virtual void OnAutocompleteWillAccept() = 0;
// Commits the suggested text. |typed_text| is the current text showing in the
@@ -138,7 +140,8 @@ class AutocompleteEditModel : public NotificationObserver {
void SetPopupModel(AutocompletePopupModel* popup_model);
- // It should only be used by testing code.
+ // TODO: The edit and popup should be siblings owned by the LocationBarView,
+ // making this accessor unnecessary.
AutocompletePopupModel* popup_model() const { return popup_; }
// Invoked when the profile has changed.
diff --git a/chrome/browser/gtk/location_bar_view_gtk.cc b/chrome/browser/gtk/location_bar_view_gtk.cc
index e9cc476..6bc7513 100644
--- a/chrome/browser/gtk/location_bar_view_gtk.cc
+++ b/chrome/browser/gtk/location_bar_view_gtk.cc
@@ -509,7 +509,7 @@ void LocationBarViewGtk::OnAutocompleteAccept(const GURL& url,
}
}
- if (browser_->instant())
+ if (browser_->instant() && !location_entry_->model()->popup_model()->IsOpen())
browser_->instant()->DestroyPreviewContents();
update_instant_ = true;
diff --git a/chrome/browser/ui/browser.cc b/chrome/browser/ui/browser.cc
index b8179530..bed9899 100644
--- a/chrome/browser/ui/browser.cc
+++ b/chrome/browser/ui/browser.cc
@@ -4143,14 +4143,18 @@ TabContentsWrapper* Browser::TabContentsFactory(
}
bool Browser::OpenInstant(WindowOpenDisposition disposition) {
- if (!instant() || !instant()->is_active() || !instant()->IsCurrent())
+ if (!instant() || !instant()->is_active() || !instant()->IsCurrent() ||
+ disposition == NEW_BACKGROUND_TAB) {
+ // NEW_BACKGROUND_TAB results in leaving the omnibox open, so we don't
+ // attempt to use the instant preview.
return false;
+ }
if (disposition == CURRENT_TAB) {
instant()->CommitCurrentPreview(INSTANT_COMMIT_PRESSED_ENTER);
return true;
}
- if (disposition == NEW_FOREGROUND_TAB || disposition == NEW_BACKGROUND_TAB) {
+ if (disposition == NEW_FOREGROUND_TAB) {
TabContentsWrapper* preview_contents = instant()->ReleasePreviewContents(
INSTANT_COMMIT_PRESSED_ENTER);
// HideInstant is invoked after release so that InstantController is not
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 32002e6..91753c3 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
@@ -301,7 +301,7 @@ void LocationBarViewMac::OnAutocompleteAccept(const GURL& url,
}
}
- if (browser_->instant())
+ if (browser_->instant() && !edit_view_->model()->popup_model()->IsOpen())
browser_->instant()->DestroyPreviewContents();
update_instant_ = true;
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 0bcccaa..0067c66 100644
--- a/chrome/browser/ui/views/location_bar/location_bar_view.cc
+++ b/chrome/browser/ui/views/location_bar/location_bar_view.cc
@@ -846,8 +846,10 @@ void LocationBarView::OnAutocompleteAccept(
}
}
- if (delegate_->GetInstant())
+ if (delegate_->GetInstant() &&
+ !location_entry_->model()->popup_model()->IsOpen()) {
delegate_->GetInstant()->DestroyPreviewContents();
+ }
update_instant_ = true;
}