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

Side by Side Diff: chrome/browser/ui/cocoa/omnibox/omnibox_view_mac.mm

Issue 11889003: Fixing ESC in instant-extended. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebased Created 7 years, 10 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/ui/cocoa/omnibox/omnibox_view_mac.h" 5 #include "chrome/browser/ui/cocoa/omnibox/omnibox_view_mac.h"
6 6
7 #include <Carbon/Carbon.h> // kVK_Return 7 #include <Carbon/Carbon.h> // kVK_Return
8 8
9 #include "base/string_util.h" 9 #include "base/string_util.h"
10 #include "base/sys_string_conversions.h" 10 #include "base/sys_string_conversions.h"
(...skipping 504 matching lines...) Expand 10 before | Expand all | Expand 10 after
515 } else { 515 } else {
516 NOTREACHED(); 516 NOTREACHED();
517 color = BaseTextColor(); 517 color = BaseTextColor();
518 } 518 }
519 [as addAttribute:NSForegroundColorAttributeName value:color 519 [as addAttribute:NSForegroundColorAttributeName value:color
520 range:ComponentToNSRange(scheme)]; 520 range:ComponentToNSRange(scheme)];
521 } 521 }
522 } 522 }
523 523
524 void OmniboxViewMac::OnTemporaryTextMaybeChanged(const string16& display_text, 524 void OmniboxViewMac::OnTemporaryTextMaybeChanged(const string16& display_text,
525 bool save_original_selection) { 525 bool save_original_selection,
526 bool notify_text_changed) {
526 if (save_original_selection) 527 if (save_original_selection)
527 saved_temporary_selection_ = GetSelectedRange(); 528 saved_temporary_selection_ = GetSelectedRange();
528 529
529 suggest_text_length_ = 0; 530 suggest_text_length_ = 0;
530 SetWindowTextAndCaretPos(display_text, display_text.size(), false, false); 531 SetWindowTextAndCaretPos(display_text, display_text.size(), false, false);
531 model()->OnChanged(); 532 if (notify_text_changed)
533 model()->OnChanged();
532 [field_ clearUndoChain]; 534 [field_ clearUndoChain];
533 } 535 }
534 536
535 void OmniboxViewMac::OnStartingIME() { 537 void OmniboxViewMac::OnStartingIME() {
536 // Reset the suggest text just before starting an IME composition session, 538 // Reset the suggest text just before starting an IME composition session,
537 // otherwise the IME composition may be interrupted when the suggest text 539 // otherwise the IME composition may be interrupted when the suggest text
538 // gets reset by the IME composition change. 540 // gets reset by the IME composition change.
539 SetInstantSuggestion(string16()); 541 SetInstantSuggestion(string16());
540 } 542 }
541 543
(...skipping 496 matching lines...) Expand 10 before | Expand all | Expand 10 after
1038 NSUInteger OmniboxViewMac::GetTextLength() const { 1040 NSUInteger OmniboxViewMac::GetTextLength() const {
1039 return ([field_ currentEditor] ? 1041 return ([field_ currentEditor] ?
1040 [[[field_ currentEditor] string] length] : 1042 [[[field_ currentEditor] string] length] :
1041 [[field_ stringValue] length]) - suggest_text_length_; 1043 [[field_ stringValue] length]) - suggest_text_length_;
1042 } 1044 }
1043 1045
1044 bool OmniboxViewMac::IsCaretAtEnd() const { 1046 bool OmniboxViewMac::IsCaretAtEnd() const {
1045 const NSRange selection = GetSelectedRange(); 1047 const NSRange selection = GetSelectedRange();
1046 return selection.length == 0 && selection.location == GetTextLength(); 1048 return selection.length == 0 && selection.location == GetTextLength();
1047 } 1049 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/cocoa/omnibox/omnibox_view_mac.h ('k') | chrome/browser/ui/gtk/omnibox/omnibox_view_gtk.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698