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

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

Issue 181024: [Mac] Fix Option-return in Omnibox. (Closed)
Patch Set: Created 11 years, 3 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 <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/resource_bundle.h" 9 #include "app/resource_bundle.h"
10 #include "base/clipboard.h" 10 #include "base/clipboard.h"
(...skipping 739 matching lines...) Expand 10 before | Expand all | Expand 10 after
750 edit_view_->OnEscapeKeyPressed(); 750 edit_view_->OnEscapeKeyPressed();
751 return YES; 751 return YES;
752 } 752 }
753 753
754 if (cmd == @selector(insertTab:)) { 754 if (cmd == @selector(insertTab:)) {
755 if (edit_view_->OnTabPressed()) { 755 if (edit_view_->OnTabPressed()) {
756 return YES; 756 return YES;
757 } 757 }
758 } 758 }
759 759
760 // TODO(shess): Option-tab, would normally insert a literal tab
761 // character. Consider combining with -insertTab:
762 if (cmd == @selector(insertTabIgnoringFieldEditor:)) {
763 return YES;
764 }
765
760 // |-noop:| is sent when the user presses Cmd+Return. Override the no-op 766 // |-noop:| is sent when the user presses Cmd+Return. Override the no-op
761 // behavior with the proper WindowOpenDisposition. 767 // behavior with the proper WindowOpenDisposition.
762 NSEvent* event = [NSApp currentEvent]; 768 NSEvent* event = [NSApp currentEvent];
763 if (cmd == @selector(insertNewline:) || 769 if (cmd == @selector(insertNewline:) ||
764 (cmd == @selector(noop:) && [event keyCode] == kVK_Return)) { 770 (cmd == @selector(noop:) && [event keyCode] == kVK_Return)) {
765 WindowOpenDisposition disposition = 771 WindowOpenDisposition disposition =
766 event_utils::WindowOpenDispositionFromNSEvent(event); 772 event_utils::WindowOpenDispositionFromNSEvent(event);
767 edit_view_->AcceptInput(disposition, false); 773 edit_view_->AcceptInput(disposition, false);
768 return YES; 774 return YES;
769 } 775 }
770 776
777 // TODO(shess): Option-return, would normally insert a literal
778 // newline. Consider combining with -insertNewline:.
779 if (cmd == @selector(insertNewlineIgnoringFieldEditor:)) {
780 return YES;
781 }
782
771 // When the user does Control-Enter, the existing content has "www." 783 // When the user does Control-Enter, the existing content has "www."
772 // prepended and ".com" appended. |model_| should already have 784 // prepended and ".com" appended. |model_| should already have
773 // received notification when the Control key was depressed, but it 785 // received notification when the Control key was depressed, but it
774 // is safe to tell it twice. 786 // is safe to tell it twice.
775 if (cmd == @selector(insertLineBreak:)) { 787 if (cmd == @selector(insertLineBreak:)) {
776 edit_view_->OnControlKeyChanged(true); 788 edit_view_->OnControlKeyChanged(true);
777 WindowOpenDisposition disposition = 789 WindowOpenDisposition disposition =
778 event_utils::WindowOpenDispositionFromNSEvent([NSApp currentEvent]); 790 event_utils::WindowOpenDispositionFromNSEvent([NSApp currentEvent]);
779 edit_view_->AcceptInput(disposition, false); 791 edit_view_->AcceptInput(disposition, false);
780 return YES; 792 return YES;
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
845 // prepended and ".com" appended. This calls down to 857 // prepended and ".com" appended. This calls down to
846 // AutocompleteEditModel::OnControlKeyChanged() so that it can change 858 // AutocompleteEditModel::OnControlKeyChanged() so that it can change
847 // the popup to reflect this. See autocomplete_edit.cc 859 // the popup to reflect this. See autocomplete_edit.cc
848 // OnControlKeyChanged() and OnAfterPossibleChange(). 860 // OnControlKeyChanged() and OnAfterPossibleChange().
849 - (void)control:(NSControl*)control flagsChanged:(NSEvent*)theEvent { 861 - (void)control:(NSControl*)control flagsChanged:(NSEvent*)theEvent {
850 BOOL controlFlag = ([theEvent modifierFlags]&NSControlKeyMask) != 0; 862 BOOL controlFlag = ([theEvent modifierFlags]&NSControlKeyMask) != 0;
851 edit_view_->OnControlKeyChanged(controlFlag); 863 edit_view_->OnControlKeyChanged(controlFlag);
852 } 864 }
853 865
854 @end 866 @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