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

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

Issue 173194: [Mac] Omnibox keyword, keyword hint, and search hint support.... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
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
Index: chrome/browser/autocomplete/autocomplete_edit_view_mac.mm
===================================================================
--- chrome/browser/autocomplete/autocomplete_edit_view_mac.mm (revision 23951)
+++ chrome/browser/autocomplete/autocomplete_edit_view_mac.mm (working copy)
@@ -292,6 +292,7 @@
if (update_popup) {
UpdatePopup();
}
+ controller_->OnChanged();
}
NSRange AutocompleteEditViewMac::GetSelectedRange() const {
@@ -427,6 +428,22 @@
}
[field_ setObjectValue:as];
+
+ // TODO(shess): This may be an appropriate place to call:
+ // controller_->OnChanged();
+ // In the current implementation, this tells LocationBarViewMac to
+ // mess around with |model_| and update |field_|. Unfortunately,
+ // when I look at our peer implementations, it's not entirely clear
+ // to me if this is safe. SetText() is sort of an utility method,
+ // and different callers sometimes have different needs. Research
+ // this issue so that it can be added safely.
+
+ // TODO(shess): Also, consider whether this code couldn't just
+ // manage things directly. Windows uses a series of overlaid view
+ // objects to accomplish the hinting stuff that OnChanged() does, so
+ // it makes sense to have it in the controller that lays those
+ // things out. Mac instead pushes the support into a custom
+ // text-field implementation.
}
void AutocompleteEditViewMac::SetTextAndSelectedRange(
@@ -454,6 +471,7 @@
}
SetWindowTextAndCaretPos(display_text, display_text.size());
+ controller_->OnChanged();
}
bool AutocompleteEditViewMac::OnInlineAutocompleteTextMaybeChanged(
@@ -468,6 +486,7 @@
DCHECK_LE(user_text_length, display_text.size());
const NSRange range = NSMakeRange(user_text_length, display_text.size());
SetTextAndSelectedRange(display_text, range);
+ controller_->OnChanged();
return true;
}
@@ -525,6 +544,7 @@
// fails for us in case you copy the URL and paste the identical URL
// back (we'll lose the styling).
EmphasizeURLComponents();
+ controller_->OnChanged();
return something_changed;
}
@@ -614,6 +634,10 @@
model_->AcceptInput(disposition, for_drop);
}
+void AutocompleteEditViewMac::AcceptKeyword() {
+ model_->AcceptKeyword();
+}
+
void AutocompleteEditViewMac::FocusLocation() {
[[field_ window] makeFirstResponder:field_];
DCHECK_EQ([field_ currentEditor], [[field_ window] firstResponder]);
@@ -699,6 +723,11 @@
return YES;
}
+ if (cmd == @selector(insertTab:)) {
+ edit_view_->AcceptKeyword();
+ return YES;
+ }
+
// |-noop:| is sent when the user presses Cmd+Return. Override the no-op
// behavior with the proper WindowOpenDisposition.
NSEvent* event = [NSApp currentEvent];
« no previous file with comments | « chrome/browser/autocomplete/autocomplete_edit_view_mac.h ('k') | chrome/browser/cocoa/autocomplete_text_field.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698