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 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
132 - initWithEditView:(AutocompleteEditViewMac*)view; | 132 - initWithEditView:(AutocompleteEditViewMac*)view; |
133 - (void)windowDidResignKey:(NSNotification*)notification; | 133 - (void)windowDidResignKey:(NSNotification*)notification; |
134 @end | 134 @end |
135 | 135 |
136 // TODO(shess): AutocompletePopupViewMac doesn't really need an | 136 // TODO(shess): AutocompletePopupViewMac doesn't really need an |
137 // NSTextField. It wants to know where the position the popup, what | 137 // NSTextField. It wants to know where the position the popup, what |
138 // font to use, and it also needs to be able to attach the popup to | 138 // font to use, and it also needs to be able to attach the popup to |
139 // the window |field_| is in. | 139 // the window |field_| is in. |
140 AutocompleteEditViewMac::AutocompleteEditViewMac( | 140 AutocompleteEditViewMac::AutocompleteEditViewMac( |
141 AutocompleteEditController* controller, | 141 AutocompleteEditController* controller, |
| 142 AutocompletePopupPositioner* positioner, |
142 ToolbarModel* toolbar_model, | 143 ToolbarModel* toolbar_model, |
143 Profile* profile, | 144 Profile* profile, |
144 CommandUpdater* command_updater, | 145 CommandUpdater* command_updater, |
145 AutocompleteTextField* field) | 146 AutocompleteTextField* field) |
146 : model_(new AutocompleteEditModel(this, controller, profile)), | 147 : model_(new AutocompleteEditModel(this, controller, profile)), |
147 popup_view_(new AutocompletePopupViewMac(this, model_.get(), profile, | 148 popup_view_(new AutocompletePopupViewMac(this, model_.get(), positioner, |
148 field)), | 149 profile, field)), |
149 controller_(controller), | 150 controller_(controller), |
150 toolbar_model_(toolbar_model), | 151 toolbar_model_(toolbar_model), |
151 command_updater_(command_updater), | 152 command_updater_(command_updater), |
152 field_(field), | 153 field_(field), |
153 edit_helper_([[AutocompleteFieldDelegate alloc] initWithEditView:this]) { | 154 edit_helper_([[AutocompleteFieldDelegate alloc] initWithEditView:this]) { |
154 DCHECK(controller); | 155 DCHECK(controller); |
155 DCHECK(toolbar_model); | 156 DCHECK(toolbar_model); |
156 DCHECK(profile); | 157 DCHECK(profile); |
157 DCHECK(command_updater); | 158 DCHECK(command_updater); |
158 DCHECK(field); | 159 DCHECK(field); |
(...skipping 641 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
800 // prepended and ".com" appended. This calls down to | 801 // prepended and ".com" appended. This calls down to |
801 // AutocompleteEditModel::OnControlKeyChanged() so that it can change | 802 // AutocompleteEditModel::OnControlKeyChanged() so that it can change |
802 // the popup to reflect this. See autocomplete_edit.cc | 803 // the popup to reflect this. See autocomplete_edit.cc |
803 // OnControlKeyChanged() and OnAfterPossibleChange(). | 804 // OnControlKeyChanged() and OnAfterPossibleChange(). |
804 - (void)control:(NSControl*)control flagsChanged:(NSEvent*)theEvent { | 805 - (void)control:(NSControl*)control flagsChanged:(NSEvent*)theEvent { |
805 BOOL controlFlag = ([theEvent modifierFlags]&NSControlKeyMask) != 0; | 806 BOOL controlFlag = ([theEvent modifierFlags]&NSControlKeyMask) != 0; |
806 edit_view_->OnControlKeyChanged(controlFlag); | 807 edit_view_->OnControlKeyChanged(controlFlag); |
807 } | 808 } |
808 | 809 |
809 @end | 810 @end |
OLD | NEW |