OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #import "chrome/browser/ui/cocoa/location_bar/autocomplete_text_field_editor.h" | 5 #import "chrome/browser/ui/cocoa/location_bar/autocomplete_text_field_editor.h" |
6 | 6 |
7 #include "base/strings/string_util.h" | 7 #include "base/strings/string_util.h" |
8 #include "base/strings/sys_string_conversions.h" | 8 #include "base/strings/sys_string_conversions.h" |
9 #include "chrome/app/chrome_command_ids.h" // IDC_* | 9 #include "chrome/app/chrome_command_ids.h" // IDC_* |
10 #include "chrome/browser/ui/browser_list.h" | 10 #include "chrome/browser/ui/browser_list.h" |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
49 return [super shouldDrawInsertionPoint] && | 49 return [super shouldDrawInsertionPoint] && |
50 ![[[self delegate] cell] hideFocusState]; | 50 ![[[self delegate] cell] hideFocusState]; |
51 } | 51 } |
52 | 52 |
53 - (id)initWithFrame:(NSRect)frameRect { | 53 - (id)initWithFrame:(NSRect)frameRect { |
54 if ((self = [super initWithFrame:frameRect])) { | 54 if ((self = [super initWithFrame:frameRect])) { |
55 dropHandler_.reset([[URLDropTargetHandler alloc] initWithView:self]); | 55 dropHandler_.reset([[URLDropTargetHandler alloc] initWithView:self]); |
56 | 56 |
57 forbiddenCharacters_.reset([[NSCharacterSet controlCharacterSet] retain]); | 57 forbiddenCharacters_.reset([[NSCharacterSet controlCharacterSet] retain]); |
58 | 58 |
59 // These checks seem inappropriate to the omnibox, and also | 59 // Disable all substitutions by default. In regular NSTextFields a user may |
60 // unlikely to work reliably due to our autocomplete interfering. | 60 // selectively enable them via context menu, but that submenu is not enabled |
| 61 // for the omnibox. The substitutions are unlikely to be useful in any case. |
61 // | 62 // |
62 // Also see <http://crbug.com/173405>. | 63 // Also see http://crbug.com/173405 and http://crbug.com/528014. |
63 NSTextCheckingTypes checkingTypes = [self enabledTextCheckingTypes]; | 64 NSTextCheckingTypes checkingTypes = 0; |
64 checkingTypes &= ~NSTextCheckingTypeReplacement; | |
65 checkingTypes &= ~NSTextCheckingTypeCorrection; | |
66 [self setEnabledTextCheckingTypes:checkingTypes]; | 65 [self setEnabledTextCheckingTypes:checkingTypes]; |
67 } | 66 } |
68 return self; | 67 return self; |
69 } | 68 } |
70 | 69 |
71 // If the entire field is selected, drag the same data as would be | 70 // If the entire field is selected, drag the same data as would be |
72 // dragged from the field's location icon. In some cases the textual | 71 // dragged from the field's location icon. In some cases the textual |
73 // contents will not contain relevant data (for instance, "http://" is | 72 // contents will not contain relevant data (for instance, "http://" is |
74 // stripped from URLs). | 73 // stripped from URLs). |
75 - (BOOL)dragSelectionWithEvent:(NSEvent *)event | 74 - (BOOL)dragSelectionWithEvent:(NSEvent *)event |
(...skipping 470 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
546 [[self delegate] suggestText], | 545 [[self delegate] suggestText], |
547 [[self delegate] suggestColor], | 546 [[self delegate] suggestColor], |
548 self, | 547 self, |
549 [self bounds]); | 548 [self bounds]); |
550 AutocompleteTextFieldObserver* observer = [self observer]; | 549 AutocompleteTextFieldObserver* observer = [self observer]; |
551 if (observer) | 550 if (observer) |
552 observer->OnDidDrawRect(); | 551 observer->OnDidDrawRect(); |
553 } | 552 } |
554 | 553 |
555 @end | 554 @end |
OLD | NEW |