summaryrefslogtreecommitdiffstats
path: root/chrome/browser/autocomplete
diff options
context:
space:
mode:
authorshess@chromium.org <shess@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-11-12 21:17:02 +0000
committershess@chromium.org <shess@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-11-12 21:17:02 +0000
commit17a79cefd3d95018bf94076d4a0deabce76d2310 (patch)
treeafe5123a0fa0177352fcb236d1332c130be880a8 /chrome/browser/autocomplete
parentb6d393707ce18deb4c0873dc6062302315dca9a2 (diff)
downloadchromium_src-17a79cefd3d95018bf94076d4a0deabce76d2310.zip
chromium_src-17a79cefd3d95018bf94076d4a0deabce76d2310.tar.gz
chromium_src-17a79cefd3d95018bf94076d4a0deabce76d2310.tar.bz2
[Mac] Ignore incorrect focus notifications in Omnibox.
After the user runs a Print or Page Layout panel, autocomplete_edit_view_mac.mm starts seeing -controlTextDidBeginEditing: notifications when the field does not have a field editor. The code thoroughly depends on having a field editor when it has focus, so this breaks things badly. -controlTextDidBeginEditing: appears to be sent multiple times when in this state, once inappropriately, and later when everything is set up correctly (when the user edits), so this simply ignores the inappropriate notification. In the case that is being ignored, AutocompleteEditViewMac will fire DCHECKs all over the place, so it's somewhat unlikely that this case is happening in correct operation. BUG=19116, 17803 TEST=Login to gmail, select a message, j, k, and other keys should work (and not send you to the omnibox). Bring up the Print panel and cancel. Bring up a new tab and close it. gmail's accelerator keys should still work right (not send focus to omnibox). Review URL: http://codereview.chromium.org/391001 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@31825 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/autocomplete')
-rw-r--r--chrome/browser/autocomplete/autocomplete_edit_view_mac.mm9
1 files changed, 9 insertions, 0 deletions
diff --git a/chrome/browser/autocomplete/autocomplete_edit_view_mac.mm b/chrome/browser/autocomplete/autocomplete_edit_view_mac.mm
index 798a534..a8a15c7 100644
--- a/chrome/browser/autocomplete/autocomplete_edit_view_mac.mm
+++ b/chrome/browser/autocomplete/autocomplete_edit_view_mac.mm
@@ -871,6 +871,15 @@ std::wstring AutocompleteEditViewMac::GetClipboardText(Clipboard* clipboard) {
}
- (void)controlTextDidBeginEditing:(NSNotification*)aNotification {
+ // After the user runs the Print or Page Layout panels, this
+ // notification starts coming at inappropriate times. Ignore the
+ // notification when the field does not have a field editor. See
+ // http://crbug.com/19116 for additional info.
+ NSTextField* field = static_cast<NSTextField*>([aNotification object]);
+ if ([field isKindOfClass:[NSTextField class]] && ![field currentEditor]) {
+ return;
+ }
+
edit_view_->OnWillBeginEditing();
}