| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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 #include "chrome/browser/autocomplete/autocomplete_edit_view_mac.h" | 5 #include "chrome/browser/autocomplete/autocomplete_edit_view_mac.h" |
| 6 | 6 |
| 7 #include <Carbon/Carbon.h> // kVK_Return | 7 #include <Carbon/Carbon.h> // kVK_Return |
| 8 #include "app/gfx/font.h" | 8 #include "app/gfx/font.h" |
| 9 #include "app/resource_bundle.h" | 9 #include "app/resource_bundle.h" |
| 10 #include "base/clipboard.h" | 10 #include "base/clipboard.h" |
| (...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 150 controller_(controller), | 150 controller_(controller), |
| 151 toolbar_model_(toolbar_model), | 151 toolbar_model_(toolbar_model), |
| 152 command_updater_(command_updater), | 152 command_updater_(command_updater), |
| 153 field_(field), | 153 field_(field), |
| 154 edit_helper_([[AutocompleteFieldDelegate alloc] initWithEditView:this]) { | 154 edit_helper_([[AutocompleteFieldDelegate alloc] initWithEditView:this]) { |
| 155 DCHECK(controller); | 155 DCHECK(controller); |
| 156 DCHECK(toolbar_model); | 156 DCHECK(toolbar_model); |
| 157 DCHECK(profile); | 157 DCHECK(profile); |
| 158 DCHECK(command_updater); | 158 DCHECK(command_updater); |
| 159 DCHECK(field); | 159 DCHECK(field); |
| 160 [field_ setDelegate:edit_helper_]; | 160 [field_ setDelegate:edit_helper_.get()]; |
| 161 | 161 |
| 162 // Needed so that editing doesn't lose the styling. | 162 // Needed so that editing doesn't lose the styling. |
| 163 [field_ setAllowsEditingTextAttributes:YES]; | 163 [field_ setAllowsEditingTextAttributes:YES]; |
| 164 | 164 |
| 165 // Track the window's key status for signalling focus changes to | 165 // Track the window's key status for signalling focus changes to |
| 166 // |model_|. | 166 // |model_|. |
| 167 NSNotificationCenter* nc = [NSNotificationCenter defaultCenter]; | 167 NSNotificationCenter* nc = [NSNotificationCenter defaultCenter]; |
| 168 [nc addObserver:edit_helper_ | 168 [nc addObserver:edit_helper_ |
| 169 selector:@selector(windowDidResignKey:) | 169 selector:@selector(windowDidResignKey:) |
| 170 name:NSWindowDidResignKeyNotification | 170 name:NSWindowDidResignKeyNotification |
| (...skipping 676 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 847 // prepended and ".com" appended. This calls down to | 847 // prepended and ".com" appended. This calls down to |
| 848 // AutocompleteEditModel::OnControlKeyChanged() so that it can change | 848 // AutocompleteEditModel::OnControlKeyChanged() so that it can change |
| 849 // the popup to reflect this. See autocomplete_edit.cc | 849 // the popup to reflect this. See autocomplete_edit.cc |
| 850 // OnControlKeyChanged() and OnAfterPossibleChange(). | 850 // OnControlKeyChanged() and OnAfterPossibleChange(). |
| 851 - (void)control:(NSControl*)control flagsChanged:(NSEvent*)theEvent { | 851 - (void)control:(NSControl*)control flagsChanged:(NSEvent*)theEvent { |
| 852 bool controlFlag = ([theEvent modifierFlags]&NSControlKeyMask) != 0; | 852 bool controlFlag = ([theEvent modifierFlags]&NSControlKeyMask) != 0; |
| 853 edit_view_->OnControlKeyChanged(controlFlag); | 853 edit_view_->OnControlKeyChanged(controlFlag); |
| 854 } | 854 } |
| 855 | 855 |
| 856 @end | 856 @end |
| OLD | NEW |