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 786 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
797 // behavior with the proper WindowOpenDisposition. | 797 // behavior with the proper WindowOpenDisposition. |
798 NSEvent* event = [NSApp currentEvent]; | 798 NSEvent* event = [NSApp currentEvent]; |
799 if (cmd == @selector(insertNewline:) || | 799 if (cmd == @selector(insertNewline:) || |
800 (cmd == @selector(noop:) && [event keyCode] == kVK_Return)) { | 800 (cmd == @selector(noop:) && [event keyCode] == kVK_Return)) { |
801 WindowOpenDisposition disposition = | 801 WindowOpenDisposition disposition = |
802 event_utils::WindowOpenDispositionFromNSEvent(event); | 802 event_utils::WindowOpenDispositionFromNSEvent(event); |
803 edit_view_->AcceptInput(disposition, false); | 803 edit_view_->AcceptInput(disposition, false); |
804 return YES; | 804 return YES; |
805 } | 805 } |
806 | 806 |
807 // TODO(shess): Option-return, would normally insert a literal | 807 // Option-Return |
808 // newline. Consider combining with -insertNewline:. | |
809 if (cmd == @selector(insertNewlineIgnoringFieldEditor:)) { | 808 if (cmd == @selector(insertNewlineIgnoringFieldEditor:)) { |
| 809 edit_view_->AcceptInput(NEW_FOREGROUND_TAB, false); |
810 return YES; | 810 return YES; |
811 } | 811 } |
812 | 812 |
813 // When the user does Control-Enter, the existing content has "www." | 813 // When the user does Control-Enter, the existing content has "www." |
814 // prepended and ".com" appended. |model_| should already have | 814 // prepended and ".com" appended. |model_| should already have |
815 // received notification when the Control key was depressed, but it | 815 // received notification when the Control key was depressed, but it |
816 // is safe to tell it twice. | 816 // is safe to tell it twice. |
817 if (cmd == @selector(insertLineBreak:)) { | 817 if (cmd == @selector(insertLineBreak:)) { |
818 edit_view_->OnControlKeyChanged(true); | 818 edit_view_->OnControlKeyChanged(true); |
819 WindowOpenDisposition disposition = | 819 WindowOpenDisposition disposition = |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
865 // TODO(shess): Figure out where the selection belongs. On GTK, | 865 // TODO(shess): Figure out where the selection belongs. On GTK, |
866 // it's set to the start of the text. | 866 // it's set to the start of the text. |
867 } | 867 } |
868 | 868 |
869 // Signal that we've lost focus when the window resigns key. | 869 // Signal that we've lost focus when the window resigns key. |
870 - (void)windowDidResignKey:(NSNotification*)notification { | 870 - (void)windowDidResignKey:(NSNotification*)notification { |
871 edit_view_->OnDidResignKey(); | 871 edit_view_->OnDidResignKey(); |
872 } | 872 } |
873 | 873 |
874 @end | 874 @end |
OLD | NEW |