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/l10n_util_mac.h" | 9 #include "app/l10n_util_mac.h" |
10 #include "app/resource_bundle.h" | 10 #include "app/resource_bundle.h" |
(...skipping 532 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
543 EmphasizeURLComponents(); | 543 EmphasizeURLComponents(); |
544 controller_->OnChanged(); | 544 controller_->OnChanged(); |
545 | 545 |
546 return something_changed; | 546 return something_changed; |
547 } | 547 } |
548 | 548 |
549 gfx::NativeView AutocompleteEditViewMac::GetNativeView() const { | 549 gfx::NativeView AutocompleteEditViewMac::GetNativeView() const { |
550 return field_; | 550 return field_; |
551 } | 551 } |
552 | 552 |
553 gfx::NativeView AutocompleteEditViewMac::GetFocusNativeView() const { | |
554 return field_; | |
555 } | |
556 | |
557 void AutocompleteEditViewMac::OnUpOrDownKeyPressed(bool up, bool by_page) { | 553 void AutocompleteEditViewMac::OnUpOrDownKeyPressed(bool up, bool by_page) { |
558 // We should only arrive here when the field is focussed. | 554 // We should only arrive here when the field is focussed. |
559 DCHECK(IsFirstResponder()); | 555 DCHECK(IsFirstResponder()); |
560 | 556 |
561 const int count = by_page ? model_->result().size() : 1; | 557 const int count = by_page ? model_->result().size() : 1; |
562 model_->OnUpOrDownKeyPressed(up ? -count : count); | 558 model_->OnUpOrDownKeyPressed(up ? -count : count); |
563 } | 559 } |
564 | 560 |
565 void AutocompleteEditViewMac::OnEscapeKeyPressed() { | 561 void AutocompleteEditViewMac::OnEscapeKeyPressed() { |
566 // We should only arrive here when the field is focussed. | 562 // We should only arrive here when the field is focussed. |
(...skipping 302 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
869 // TODO(shess): Figure out where the selection belongs. On GTK, | 865 // TODO(shess): Figure out where the selection belongs. On GTK, |
870 // it's set to the start of the text. | 866 // it's set to the start of the text. |
871 } | 867 } |
872 | 868 |
873 // Signal that we've lost focus when the window resigns key. | 869 // Signal that we've lost focus when the window resigns key. |
874 - (void)windowDidResignKey:(NSNotification*)notification { | 870 - (void)windowDidResignKey:(NSNotification*)notification { |
875 edit_view_->OnDidResignKey(); | 871 edit_view_->OnDidResignKey(); |
876 } | 872 } |
877 | 873 |
878 @end | 874 @end |
OLD | NEW |