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_popup_view_mac.h" | 5 #include "chrome/browser/autocomplete/autocomplete_popup_view_mac.h" |
6 | 6 |
7 #include "base/sys_string_conversions.h" | 7 #include "base/sys_string_conversions.h" |
8 #include "chrome/browser/autocomplete/autocomplete_edit.h" | 8 #include "chrome/browser/autocomplete/autocomplete_edit.h" |
9 #include "chrome/browser/autocomplete/autocomplete_edit_view_mac.h" | 9 #include "chrome/browser/autocomplete/autocomplete_edit_view_mac.h" |
10 #include "chrome/browser/autocomplete/autocomplete_popup_model.h" | 10 #include "chrome/browser/autocomplete/autocomplete_popup_model.h" |
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
104 [table addTableColumn:MakeTableColumn(1, [NSImageCell class])]; | 104 [table addTableColumn:MakeTableColumn(1, [NSImageCell class])]; |
105 [table addTableColumn:MakeTableColumn(2, [NSTextFieldCell class])]; | 105 [table addTableColumn:MakeTableColumn(2, [NSTextFieldCell class])]; |
106 } | 106 } |
107 } | 107 } |
108 | 108 |
109 void AutocompletePopupViewMac::UpdatePopupAppearance() { | 109 void AutocompletePopupViewMac::UpdatePopupAppearance() { |
110 const AutocompleteResult& result = model_->result(); | 110 const AutocompleteResult& result = model_->result(); |
111 if (result.empty()) { | 111 if (result.empty()) { |
112 [[popup_ parentWindow] removeChildWindow:popup_]; | 112 [[popup_ parentWindow] removeChildWindow:popup_]; |
113 [popup_ orderOut:nil]; | 113 [popup_ orderOut:nil]; |
| 114 |
| 115 // Break references to table_target_ releasing popup_. |
| 116 NSTableView* table = [popup_ contentView]; |
| 117 [table setTarget:nil]; |
| 118 [table setDataSource:nil]; |
| 119 |
| 120 popup_.reset(nil); |
| 121 |
114 return; | 122 return; |
115 } | 123 } |
116 | 124 |
117 CreatePopupIfNeeded(); | 125 CreatePopupIfNeeded(); |
118 | 126 |
119 // Layout the popup and size it to land underneath the field. | 127 // Layout the popup and size it to land underneath the field. |
120 // TODO(shess) Consider refactoring to remove this depenency, | 128 // TODO(shess) Consider refactoring to remove this depenency, |
121 // because the popup doesn't need any of the field-like aspects of | 129 // because the popup doesn't need any of the field-like aspects of |
122 // field_. The edit view could expose helper methods for attaching | 130 // field_. The edit view could expose helper methods for attaching |
123 // the window to the field. | 131 // the window to the field. |
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
247 | 255 |
248 return as; | 256 return as; |
249 } | 257 } |
250 | 258 |
251 - (void)select:sender { | 259 - (void)select:sender { |
252 DCHECK(popup_view_); | 260 DCHECK(popup_view_); |
253 popup_view_->AcceptInput(); | 261 popup_view_->AcceptInput(); |
254 } | 262 } |
255 | 263 |
256 @end | 264 @end |
OLD | NEW |