Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(215)

Unified Diff: chrome/browser/autocomplete/autocomplete_edit_view_mac.mm

Issue 180010: [Mac] Don't eat tab if tab-to-search hint not visible. (Closed)
Patch Set: Created 11 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/autocomplete/autocomplete_edit_view_mac.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/autocomplete/autocomplete_edit_view_mac.mm
diff --git a/chrome/browser/autocomplete/autocomplete_edit_view_mac.mm b/chrome/browser/autocomplete/autocomplete_edit_view_mac.mm
index d115c882f7f563eebe4caa18320117e47006a8d1..9ca8a6be54110823de56ea716d01cfdbb213fa7d 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
« no previous file with comments | « chrome/browser/autocomplete/autocomplete_edit_view_mac.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698