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

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

Issue 159250: [Mac] Omnibox keyword, keyword hint, and search hint support. (Closed)
Patch Set: Get rid of funky cells and other comment responses. 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
diff --git a/chrome/browser/autocomplete/autocomplete_edit_view_mac.mm b/chrome/browser/autocomplete/autocomplete_edit_view_mac.mm
index 2de70d1e9c4022b2fce7d72fe468989f9a4c77fa..6668f140b3463c30ba82a57ff77e80ed92023d21 100644
--- a/chrome/browser/autocomplete/autocomplete_edit_view_mac.mm
+++ b/chrome/browser/autocomplete/autocomplete_edit_view_mac.mm
@@ -290,6 +290,7 @@ void AutocompleteEditViewMac::SetUserText(const std::wstring& text,
if (update_popup) {
UpdatePopup();
}
+ controller_->OnChanged();
}
NSRange AutocompleteEditViewMac::GetSelectedRange() const {
@@ -413,6 +414,22 @@ void AutocompleteEditViewMac::SetText(const std::wstring& display_text) {
}
[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(
@@ -440,6 +457,7 @@ void AutocompleteEditViewMac::OnTemporaryTextMaybeChanged(
}
SetWindowTextAndCaretPos(display_text, display_text.size());
+ controller_->OnChanged();
}
bool AutocompleteEditViewMac::OnInlineAutocompleteTextMaybeChanged(
@@ -454,6 +472,7 @@ bool AutocompleteEditViewMac::OnInlineAutocompleteTextMaybeChanged(
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;
}
@@ -511,6 +530,7 @@ bool AutocompleteEditViewMac::OnAfterPossibleChange() {
// 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;
}
@@ -600,6 +620,10 @@ 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]);
@@ -685,6 +709,11 @@ std::wstring AutocompleteEditViewMac::GetClipboardText(Clipboard* clipboard) {
return YES;
}
+ if (cmd == @selector(insertTab:)) {
+ edit_view_->AcceptKeyword();
+ return YES;
+ }
+
if (cmd == @selector(insertNewline:)) {
edit_view_->AcceptInput(CURRENT_TAB, false);
return YES;
« 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