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

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

Issue 9570064: Fix keyword search erroneously not triggering in two obscure cases: (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 8 years, 9 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/property_bag.h" 9 #include "base/property_bag.h"
10 #include "base/string_util.h" 10 #include "base/string_util.h"
(...skipping 678 matching lines...) Expand 10 before | Expand all | Expand 10 after
689 // and other methods to provide positive knowledge that a delete 689 // and other methods to provide positive knowledge that a delete
690 // occured, rather than intuiting it from context. Consider whether 690 // occured, rather than intuiting it from context. Consider whether
691 // that would be a stronger approach. 691 // that would be a stronger approach.
692 const bool just_deleted_text = 692 const bool just_deleted_text =
693 (length < text_before_change_.length() && 693 (length < text_before_change_.length() &&
694 new_selection.location <= selection_before_change_.location); 694 new_selection.location <= selection_before_change_.location);
695 695
696 delete_at_end_pressed_ = false; 696 delete_at_end_pressed_ = false;
697 697
698 const bool something_changed = model_->OnAfterPossibleChange( 698 const bool something_changed = model_->OnAfterPossibleChange(
699 new_text, new_selection.location, NSMaxRange(new_selection), 699 text_before_change_, new_text, new_selection.location,
700 selection_differs, text_differs, just_deleted_text, 700 NSMaxRange(new_selection), selection_differs, text_differs,
701 !IsImeComposing()); 701 just_deleted_text, !IsImeComposing());
702 702
703 if (delete_was_pressed_ && at_end_of_edit) 703 if (delete_was_pressed_ && at_end_of_edit)
704 delete_at_end_pressed_ = true; 704 delete_at_end_pressed_ = true;
705 705
706 // Restyle in case the user changed something. 706 // Restyle in case the user changed something.
707 // TODO(shess): I believe there are multiple-redraw cases, here. 707 // TODO(shess): I believe there are multiple-redraw cases, here.
708 // Linux watches for something_changed && text_differs, but that 708 // Linux watches for something_changed && text_differs, but that
709 // fails for us in case you copy the URL and paste the identical URL 709 // fails for us in case you copy the URL and paste the identical URL
710 // back (we'll lose the styling). 710 // back (we'll lose the styling).
711 TextChanged(); 711 TextChanged();
(...skipping 413 matching lines...) Expand 10 before | Expand all | Expand 10 after
1125 1125
1126 void OmniboxViewMac::PlaceCaretAt(NSUInteger pos) { 1126 void OmniboxViewMac::PlaceCaretAt(NSUInteger pos) {
1127 DCHECK(pos <= GetTextLength()); 1127 DCHECK(pos <= GetTextLength());
1128 SetSelectedRange(NSMakeRange(pos, pos)); 1128 SetSelectedRange(NSMakeRange(pos, pos));
1129 } 1129 }
1130 1130
1131 bool OmniboxViewMac::IsCaretAtEnd() const { 1131 bool OmniboxViewMac::IsCaretAtEnd() const {
1132 const NSRange selection = GetSelectedRange(); 1132 const NSRange selection = GetSelectedRange();
1133 return selection.length == 0 && selection.location == GetTextLength(); 1133 return selection.length == 0 && selection.location == GetTextLength();
1134 } 1134 }
OLDNEW
« no previous file with comments | « chrome/browser/autocomplete/autocomplete_edit.cc ('k') | chrome/browser/ui/gtk/omnibox/omnibox_view_gtk.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698