summaryrefslogtreecommitdiffstats
path: root/chrome
diff options
context:
space:
mode:
authorshess@chromium.org <shess@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-08-28 17:35:24 +0000
committershess@chromium.org <shess@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-08-28 17:35:24 +0000
commite017e07f7b7390b24c36b123cd1310ae15cd904e (patch)
tree31c4b4f990f2989afe417bd3a3df3f68460f51d8 /chrome
parent17acbb549e69322632c56e0e6c93a3d0c5c3dda1 (diff)
downloadchromium_src-e017e07f7b7390b24c36b123cd1310ae15cd904e.zip
chromium_src-e017e07f7b7390b24c36b123cd1310ae15cd904e.tar.gz
chromium_src-e017e07f7b7390b24c36b123cd1310ae15cd904e.tar.bz2
[Mac] Don't eat tab if tab-to-search hint not visible.
http://crbug.com/20284 TEST=Type "test text". You should see "Type to search" hint. TAB should take you into the content view. Unfortunately, there are other unrelated bugs around the tab sequencing, so this only works with NTP on a new window. Hit TAB twice and you should start tabbing between thumbnails. Review URL: http://codereview.chromium.org/180010 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@24741 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome')
-rw-r--r--chrome/browser/autocomplete/autocomplete_edit_view_mac.h7
-rw-r--r--chrome/browser/autocomplete/autocomplete_edit_view_mac.mm17
2 files changed, 15 insertions, 9 deletions
diff --git a/chrome/browser/autocomplete/autocomplete_edit_view_mac.h b/chrome/browser/autocomplete/autocomplete_edit_view_mac.h
index aac879b..0c0cb2b 100644
--- a/chrome/browser/autocomplete/autocomplete_edit_view_mac.h
+++ b/chrome/browser/autocomplete/autocomplete_edit_view_mac.h
@@ -112,10 +112,11 @@ class AutocompleteEditViewMac : public AutocompleteEditView {
// Called when the user attempts to paste into |field_|.
void OnPaste();
- void AcceptInput(WindowOpenDisposition disposition, bool for_drop);
+ // Checks if a keyword search is possible and forwards to |model_|
+ // if so. Returns true if the tab should be eaten.
+ bool OnTabPressed();
- // Forwards to |model_| when user hits Tab.
- void AcceptKeyword();
+ void AcceptInput(WindowOpenDisposition disposition, bool for_drop);
// Helper for LocationBarViewMac. Selects all in |field_|.
void FocusLocation();
diff --git a/chrome/browser/autocomplete/autocomplete_edit_view_mac.mm b/chrome/browser/autocomplete/autocomplete_edit_view_mac.mm
index d115c88..9ca8a6b 100644
--- a/chrome/browser/autocomplete/autocomplete_edit_view_mac.mm
+++ b/chrome/browser/autocomplete/autocomplete_edit_view_mac.mm
@@ -622,6 +622,14 @@ void AutocompleteEditViewMac::OnPaste() {
OnAfterPossibleChange();
}
+bool AutocompleteEditViewMac::OnTabPressed() {
+ if (model_->is_keyword_hint() && !model_->keyword().empty()) {
+ model_->AcceptKeyword();
+ return true;
+ }
+ return false;
+}
+
bool AutocompleteEditViewMac::IsPopupOpen() const {
return popup_view_->IsOpen();
}
@@ -635,10 +643,6 @@ void AutocompleteEditViewMac::AcceptInput(
model_->AcceptInput(disposition, for_drop);
}
-void AutocompleteEditViewMac::AcceptKeyword() {
- model_->AcceptKeyword();
-}
-
void AutocompleteEditViewMac::FocusLocation() {
[[field_ window] makeFirstResponder:field_];
DCHECK_EQ([field_ currentEditor], [[field_ window] firstResponder]);
@@ -725,8 +729,9 @@ std::wstring AutocompleteEditViewMac::GetClipboardText(Clipboard* clipboard) {
}
if (cmd == @selector(insertTab:)) {
- edit_view_->AcceptKeyword();
- return YES;
+ if (edit_view_->OnTabPressed()) {
+ return YES;
+ }
}
// |-noop:| is sent when the user presses Cmd+Return. Override the no-op