Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(66)

Side by Side Diff: chrome/browser/autocomplete/autocomplete_edit_view_mac.mm

Issue 116006: Mac: Make sure the popup is closed when losing focus in omnibox. (Closed)
Patch Set: Created 11 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 "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_popup_model.h" 9 #include "chrome/browser/autocomplete/autocomplete_popup_model.h"
10 #include "chrome/browser/autocomplete/autocomplete_popup_view_mac.h" 10 #include "chrome/browser/autocomplete/autocomplete_popup_view_mac.h"
(...skipping 425 matching lines...) Expand 10 before | Expand all | Expand 10 after
436 const int count = by_page ? model_->result().size() : 1; 436 const int count = by_page ? model_->result().size() : 1;
437 model_->OnUpOrDownKeyPressed(up ? -count : count); 437 model_->OnUpOrDownKeyPressed(up ? -count : count);
438 } 438 }
439 void AutocompleteEditViewMac::OnEscapeKeyPressed() { 439 void AutocompleteEditViewMac::OnEscapeKeyPressed() {
440 model_->OnEscapeKeyPressed(); 440 model_->OnEscapeKeyPressed();
441 } 441 }
442 void AutocompleteEditViewMac::OnSetFocus(bool f) { 442 void AutocompleteEditViewMac::OnSetFocus(bool f) {
443 model_->OnSetFocus(f); 443 model_->OnSetFocus(f);
444 } 444 }
445 void AutocompleteEditViewMac::OnKillFocus() { 445 void AutocompleteEditViewMac::OnKillFocus() {
446 // TODO(shess): This would seem to be a job for |model_|.
447 ClosePopup();
448
449 // Tell the model to reset itself.
446 model_->OnKillFocus(); 450 model_->OnKillFocus();
447 } 451 }
448 void AutocompleteEditViewMac::AcceptInput( 452 void AutocompleteEditViewMac::AcceptInput(
449 WindowOpenDisposition disposition, bool for_drop) { 453 WindowOpenDisposition disposition, bool for_drop) {
450 model_->AcceptInput(disposition, for_drop); 454 model_->AcceptInput(disposition, for_drop);
451 } 455 }
452 456
453 void AutocompleteEditViewMac::FocusLocation() { 457 void AutocompleteEditViewMac::FocusLocation() {
454 // -makeFirstResponder: will select the entire field_. If we're 458 // -makeFirstResponder: will select the entire field_. If we're
455 // already firstResponder, it's likely that we want to retain the 459 // already firstResponder, it's likely that we want to retain the
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
517 } 521 }
518 522
519 - (void)controlTextDidChange:(NSNotification*)aNotification { 523 - (void)controlTextDidChange:(NSNotification*)aNotification {
520 // Figure out what changed and notify the model_. 524 // Figure out what changed and notify the model_.
521 edit_view_->OnAfterPossibleChange(); 525 edit_view_->OnAfterPossibleChange();
522 526
523 // Then capture the new state. 527 // Then capture the new state.
524 edit_view_->OnBeforePossibleChange(); 528 edit_view_->OnBeforePossibleChange();
525 } 529 }
526 530
527 - (void)controlTextDidEndEditing:(NSNotification*)aNotification { 531 - (BOOL)control:(NSControl*)control textShouldEndEditing:(NSText*)fieldEditor {
528 edit_view_->OnKillFocus(); 532 edit_view_->OnKillFocus();
529 533
534 return YES;
535
530 // TODO(shess): Figure out where the selection belongs. On GTK, 536 // TODO(shess): Figure out where the selection belongs. On GTK,
531 // it's set to the start of the text. 537 // it's set to the start of the text.
532 } 538 }
533 539
534 @end 540 @end
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698