summaryrefslogtreecommitdiffstats
path: root/chrome/browser/autocomplete
diff options
context:
space:
mode:
authorrohitrao@chromium.org <rohitrao@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-12-02 03:22:15 +0000
committerrohitrao@chromium.org <rohitrao@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-12-02 03:22:15 +0000
commit5e849e0fa390a889a3cbd878f8e2dfcc0487f453 (patch)
tree2b826b895e8743c8df80eec490b36371a8d5da1a /chrome/browser/autocomplete
parentd9fd6c557aff762a4344471b5f99c835bf5ee809 (diff)
downloadchromium_src-5e849e0fa390a889a3cbd878f8e2dfcc0487f453.zip
chromium_src-5e849e0fa390a889a3cbd878f8e2dfcc0487f453.tar.gz
chromium_src-5e849e0fa390a889a3cbd878f8e2dfcc0487f453.tar.bz2
Revert 67949 - [gtk] tab in omnibox
BUG=64340 TEST=see bug Review URL: http://codereview.chromium.org/5339014 TBR=estade@chromium.org Review URL: http://codereview.chromium.org/5560001 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@67955 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/autocomplete')
-rw-r--r--chrome/browser/autocomplete/autocomplete_edit.h4
-rw-r--r--chrome/browser/autocomplete/autocomplete_edit_view_gtk.cc46
2 files changed, 16 insertions, 34 deletions
diff --git a/chrome/browser/autocomplete/autocomplete_edit.h b/chrome/browser/autocomplete/autocomplete_edit.h
index b9854ff..90fc643 100644
--- a/chrome/browser/autocomplete/autocomplete_edit.h
+++ b/chrome/browser/autocomplete/autocomplete_edit.h
@@ -50,10 +50,6 @@ class AutocompleteEditController {
// autocomplete. Returns true if the text was committed.
virtual bool OnCommitSuggestedText(const std::wstring& typed_text) = 0;
- // Accepts the currently showing instant preview, if any, and returns true.
- // Returns false if there is no instant preview showing.
- virtual bool AcceptCurrentInstantPreview() { return false; }
-
// Sets the suggested search text to |suggested_text|.
virtual void OnSetSuggestedSearchText(const string16& suggested_text) = 0;
diff --git a/chrome/browser/autocomplete/autocomplete_edit_view_gtk.cc b/chrome/browser/autocomplete/autocomplete_edit_view_gtk.cc
index 6e47128..5bad09c 100644
--- a/chrome/browser/autocomplete/autocomplete_edit_view_gtk.cc
+++ b/chrome/browser/autocomplete/autocomplete_edit_view_gtk.cc
@@ -892,20 +892,20 @@ gboolean AutocompleteEditViewGtk::HandleKeyPress(GtkWidget* widget,
GtkWidgetClass* klass = GTK_WIDGET_GET_CLASS(widget);
- enter_was_pressed_ = event->keyval == GDK_Return ||
- event->keyval == GDK_ISO_Enter ||
- event->keyval == GDK_KP_Enter;
+ enter_was_pressed_ = (event->keyval == GDK_Return ||
+ event->keyval == GDK_ISO_Enter ||
+ event->keyval == GDK_KP_Enter);
// Set |tab_was_pressed_| to true if it's a Tab key press event, so that our
// handler of "move-focus" signal can trigger Tab to search behavior when
// necessary.
- tab_was_pressed_ = (event->keyval == GDK_Tab ||
- event->keyval == GDK_ISO_Left_Tab ||
- event->keyval == GDK_KP_Tab) &&
- !(event->state & (GDK_CONTROL_MASK | GDK_SHIFT_MASK));
+ tab_was_pressed_ = ((event->keyval == GDK_Tab ||
+ event->keyval == GDK_ISO_Left_Tab ||
+ event->keyval == GDK_KP_Tab) &&
+ !(event->state & GDK_CONTROL_MASK));
- delete_was_pressed_ = event->keyval == GDK_Delete ||
- event->keyval == GDK_KP_Delete;
+ delete_was_pressed_ = (event->keyval == GDK_Delete ||
+ event->keyval == GDK_KP_Delete);
// Reset |enter_was_inserted_|, which may be set in the "insert-text" signal
// handler, so that we'll know if an Enter key event was handled by IME.
@@ -1385,32 +1385,18 @@ void AutocompleteEditViewGtk::HandleBackSpace(GtkWidget* sender) {
void AutocompleteEditViewGtk::HandleViewMoveFocus(GtkWidget* widget,
GtkDirectionType direction) {
- if (!tab_was_pressed_)
- return;
-
- // If special behavior is triggered, then stop the signal emission to
- // prevent the focus from being moved.
- bool handled = false;
-
// Trigger Tab to search behavior only when Tab key is pressed.
- if (model_->is_keyword_hint() && !model_->keyword().empty()) {
- if (enable_tab_to_search_) {
- model_->AcceptKeyword();
- handled = true;
- }
- } else {
- if (GTK_WIDGET_VISIBLE(instant_view_)) {
- controller_->OnCommitSuggestedText(GetText());
- handled = true;
- } else {
- handled = controller_->AcceptCurrentInstantPreview();
- }
- }
+ if (tab_was_pressed_ && enable_tab_to_search_ &&
+ model_->is_keyword_hint() && !model_->keyword().empty()) {
+ model_->AcceptKeyword();
- if (handled) {
+ // If Tab to search behavior is triggered, then stop the signal emission to
+ // prevent the focus from being moved.
static guint signal_id = g_signal_lookup("move-focus", GTK_TYPE_WIDGET);
g_signal_stop_emission(widget, signal_id, 0);
}
+
+ // Propagate the signal so that focus can be moved as normal.
}
void AutocompleteEditViewGtk::HandleCopyClipboard(GtkWidget* sender) {