| 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 "app/gfx/text_elider.h" | 7 #include "app/gfx/text_elider.h" |
| 8 #include "base/sys_string_conversions.h" | 8 #include "base/sys_string_conversions.h" |
| 9 #include "base/gfx/rect.h" | 9 #include "base/gfx/rect.h" |
| 10 #include "chrome/browser/autocomplete/autocomplete_edit.h" | 10 #include "chrome/browser/autocomplete/autocomplete_edit.h" |
| (...skipping 308 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 319 [nc addObserver:matrix_target_ | 319 [nc addObserver:matrix_target_ |
| 320 selector:@selector(windowDidResize:) | 320 selector:@selector(windowDidResize:) |
| 321 name:NSWindowDidResizeNotification | 321 name:NSWindowDidResizeNotification |
| 322 object:[field_ window]]; | 322 object:[field_ window]]; |
| 323 } | 323 } |
| 324 } | 324 } |
| 325 | 325 |
| 326 void AutocompletePopupViewMac::UpdatePopupAppearance() { | 326 void AutocompletePopupViewMac::UpdatePopupAppearance() { |
| 327 const AutocompleteResult& result = model_->result(); | 327 const AutocompleteResult& result = model_->result(); |
| 328 if (result.empty()) { | 328 if (result.empty()) { |
| 329 NSLog(@"Empty results in UpdatePopupAppearance"); |
| 329 [[popup_ parentWindow] removeChildWindow:popup_]; | 330 [[popup_ parentWindow] removeChildWindow:popup_]; |
| 330 [popup_ orderOut:nil]; | 331 [popup_ orderOut:nil]; |
| 331 | 332 |
| 332 // Break references to matrix_target_ before releasing popup_. | 333 // Break references to matrix_target_ before releasing popup_. |
| 333 NSMatrix* matrix = [popup_ contentView]; | 334 NSMatrix* matrix = [popup_ contentView]; |
| 334 [matrix setTarget:nil]; | 335 [matrix setTarget:nil]; |
| 335 | 336 |
| 336 NSNotificationCenter *nc = [NSNotificationCenter defaultCenter]; | 337 NSNotificationCenter *nc = [NSNotificationCenter defaultCenter]; |
| 337 [nc removeObserver:matrix_target_ | 338 [nc removeObserver:matrix_target_ |
| 338 name:NSWindowDidResizeNotification | 339 name:NSWindowDidResizeNotification |
| (...skipping 351 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 690 DCHECK(popup_view_); | 691 DCHECK(popup_view_); |
| 691 | 692 |
| 692 // TODO(shess): UpdatePopupAppearance() is called frequently, so it | 693 // TODO(shess): UpdatePopupAppearance() is called frequently, so it |
| 693 // should be really cheap, but in this case we could probably make | 694 // should be really cheap, but in this case we could probably make |
| 694 // things even cheaper by refactoring between the popup-placement | 695 // things even cheaper by refactoring between the popup-placement |
| 695 // code and the matrix-population code. | 696 // code and the matrix-population code. |
| 696 popup_view_->UpdatePopupAppearance(); | 697 popup_view_->UpdatePopupAppearance(); |
| 697 } | 698 } |
| 698 | 699 |
| 699 @end | 700 @end |
| OLD | NEW |