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

Side by Side Diff: chrome/browser/ui/views/omnibox/omnibox_view_views.cc

Issue 11889003: Fixing ESC in instant-extended. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Minor correction to comments. 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/views/omnibox/omnibox_view_views.h" 5 #include "chrome/browser/ui/views/omnibox/omnibox_view_views.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "base/string_util.h" 8 #include "base/string_util.h"
9 #include "base/utf_string_conversions.h" 9 #include "base/utf_string_conversions.h"
10 #include "chrome/app/chrome_command_ids.h" 10 #include "chrome/app/chrome_command_ids.h"
(...skipping 570 matching lines...) Expand 10 before | Expand all | Expand 10 after
581 // omnibox regains focus after losing focus. 581 // omnibox regains focus after losing focus.
582 model()->SetCaretVisibility(true); 582 model()->SetCaretVisibility(true);
583 } 583 }
584 584
585 void OmniboxViewViews::ApplyCaretVisibility() { 585 void OmniboxViewViews::ApplyCaretVisibility() {
586 textfield_->SetCursorEnabled(model()->is_caret_visible()); 586 textfield_->SetCursorEnabled(model()->is_caret_visible());
587 } 587 }
588 588
589 void OmniboxViewViews::OnTemporaryTextMaybeChanged( 589 void OmniboxViewViews::OnTemporaryTextMaybeChanged(
590 const string16& display_text, 590 const string16& display_text,
591 bool save_original_selection) { 591 bool save_original_selection,
592 bool notify_text_changed) {
592 if (save_original_selection) 593 if (save_original_selection)
593 textfield_->GetSelectedRange(&saved_temporary_selection_); 594 textfield_->GetSelectedRange(&saved_temporary_selection_);
594 595
595 SetWindowTextAndCaretPos(display_text, display_text.length(), false, true); 596 SetWindowTextAndCaretPos(display_text, display_text.length(), false,
597 notify_text_changed);
596 } 598 }
597 599
598 bool OmniboxViewViews::OnInlineAutocompleteTextMaybeChanged( 600 bool OmniboxViewViews::OnInlineAutocompleteTextMaybeChanged(
599 const string16& display_text, 601 const string16& display_text,
600 size_t user_text_length) { 602 size_t user_text_length) {
601 if (display_text == GetText()) 603 if (display_text == GetText())
602 return false; 604 return false;
603 ui::Range range(display_text.size(), user_text_length); 605 ui::Range range(display_text.size(), user_text_length);
604 SetTextAndSelectedRange(display_text, range); 606 SetTextAndSelectedRange(display_text, range);
605 TextChanged(); 607 TextChanged();
606 return true; 608 return true;
607 } 609 }
608 610
609 void OmniboxViewViews::OnRevertTemporaryText() { 611 void OmniboxViewViews::OnRevertTemporaryText() {
610 textfield_->SelectRange(saved_temporary_selection_); 612 textfield_->SelectRange(saved_temporary_selection_);
611 TextChanged();
Peter Kasting 2013/02/11 19:54:54 Why is removing this correct?
beaudoin 2013/02/11 23:38:22 OnRevertTemporaryText only changes the selection r
612 } 613 }
613 614
614 void OmniboxViewViews::OnBeforePossibleChange() { 615 void OmniboxViewViews::OnBeforePossibleChange() {
615 // Record our state. 616 // Record our state.
616 text_before_change_ = GetText(); 617 text_before_change_ = GetText();
617 textfield_->GetSelectedRange(&sel_before_change_); 618 textfield_->GetSelectedRange(&sel_before_change_);
618 ime_composing_before_change_ = textfield_->IsIMEComposing(); 619 ime_composing_before_change_ = textfield_->IsIMEComposing();
619 } 620 }
620 621
621 bool OmniboxViewViews::OnAfterPossibleChange() { 622 bool OmniboxViewViews::OnAfterPossibleChange() {
(...skipping 339 matching lines...) Expand 10 before | Expand all | Expand 10 after
961 if (!text.empty()) { 962 if (!text.empty()) {
962 // Record this paste, so we can do different behavior. 963 // Record this paste, so we can do different behavior.
963 model()->on_paste(); 964 model()->on_paste();
964 // Force a Paste operation to trigger the text_changed code in 965 // Force a Paste operation to trigger the text_changed code in
965 // OnAfterPossibleChange(), even if identical contents are pasted into the 966 // OnAfterPossibleChange(), even if identical contents are pasted into the
966 // text box. 967 // text box.
967 text_before_change_.clear(); 968 text_before_change_.clear();
968 textfield_->ReplaceSelection(text); 969 textfield_->ReplaceSelection(text);
969 } 970 }
970 } 971 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698