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

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

Issue 68103008: Hide IME autocompletion when Omnibox popup closes. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fixed a comment. Created 7 years, 1 month 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
« no previous file with comments | « chrome/browser/ui/views/omnibox/omnibox_view_views.h ('k') | 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) 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/command_line.h" 7 #include "base/command_line.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "base/strings/string_util.h" 9 #include "base/strings/string_util.h"
10 #include "base/strings/utf_string_conversions.h" 10 #include "base/strings/utf_string_conversions.h"
(...skipping 513 matching lines...) Expand 10 before | Expand all | Expand 10 after
524 void OmniboxViewViews::RevertAll() { 524 void OmniboxViewViews::RevertAll() {
525 saved_selection_for_focus_change_ = gfx::Range::InvalidRange(); 525 saved_selection_for_focus_change_ = gfx::Range::InvalidRange();
526 OmniboxView::RevertAll(); 526 OmniboxView::RevertAll();
527 } 527 }
528 528
529 void OmniboxViewViews::UpdatePopup() { 529 void OmniboxViewViews::UpdatePopup() {
530 model()->SetInputInProgress(true); 530 model()->SetInputInProgress(true);
531 if (!model()->has_focus()) 531 if (!model()->has_focus())
532 return; 532 return;
533 533
534 // Hide the inline autocompletion for IME users.
535 location_bar_view_->SetImeInlineAutocompletion(string16());
536
537 // Prevent inline autocomplete when the caret isn't at the end of the text, 534 // Prevent inline autocomplete when the caret isn't at the end of the text,
538 // and during IME composition editing unless 535 // and during IME composition editing unless
539 // |kEnableOmniboxAutoCompletionForIme| is enabled. 536 // |kEnableOmniboxAutoCompletionForIme| is enabled.
540 const gfx::Range sel = GetSelectedRange(); 537 const gfx::Range sel = GetSelectedRange();
541 model()->StartAutocomplete( 538 model()->StartAutocomplete(
542 !sel.is_empty(), 539 !sel.is_empty(),
543 sel.GetMax() < text().length() || 540 sel.GetMax() < text().length() ||
544 (IsIMEComposing() && !IsOmniboxAutoCompletionForImeEnabled())); 541 (IsIMEComposing() && !IsOmniboxAutoCompletionForImeEnabled()));
545 } 542 }
546 543
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
579 location_bar_view_->SetImeInlineAutocompletion( 576 location_bar_view_->SetImeInlineAutocompletion(
580 display_text.substr(user_text_length)); 577 display_text.substr(user_text_length));
581 } else { 578 } else {
582 gfx::Range range(display_text.size(), user_text_length); 579 gfx::Range range(display_text.size(), user_text_length);
583 SetTextAndSelectedRange(display_text, range); 580 SetTextAndSelectedRange(display_text, range);
584 } 581 }
585 TextChanged(); 582 TextChanged();
586 return true; 583 return true;
587 } 584 }
588 585
586 void OmniboxViewViews::OnInlineAutocompleteTextCleared() {
587 // Hide the inline autocompletion for IME users.
588 location_bar_view_->SetImeInlineAutocompletion(string16());
589 }
590
589 void OmniboxViewViews::OnRevertTemporaryText() { 591 void OmniboxViewViews::OnRevertTemporaryText() {
590 SelectRange(saved_temporary_selection_); 592 SelectRange(saved_temporary_selection_);
591 // We got here because the user hit the Escape key. We explicitly don't call 593 // We got here because the user hit the Escape key. We explicitly don't call
592 // TextChanged(), since OmniboxPopupModel::ResetToDefaultMatch() has already 594 // TextChanged(), since OmniboxPopupModel::ResetToDefaultMatch() has already
593 // been called by now, and it would've called TextChanged() if it was 595 // been called by now, and it would've called TextChanged() if it was
594 // warranted. 596 // warranted.
595 } 597 }
596 598
597 void OmniboxViewViews::OnBeforePossibleChange() { 599 void OmniboxViewViews::OnBeforePossibleChange() {
598 // Record our state. 600 // Record our state.
(...skipping 365 matching lines...) Expand 10 before | Expand all | Expand 10 after
964 const string16 text(GetClipboardText()); 966 const string16 text(GetClipboardText());
965 if (!text.empty()) { 967 if (!text.empty()) {
966 // Record this paste, so we can do different behavior. 968 // Record this paste, so we can do different behavior.
967 model()->on_paste(); 969 model()->on_paste();
968 // Force a Paste operation to trigger the text_changed code in 970 // Force a Paste operation to trigger the text_changed code in
969 // OnAfterPossibleChange(), even if identical contents are pasted. 971 // OnAfterPossibleChange(), even if identical contents are pasted.
970 text_before_change_.clear(); 972 text_before_change_.clear();
971 InsertOrReplaceText(text); 973 InsertOrReplaceText(text);
972 } 974 }
973 } 975 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/views/omnibox/omnibox_view_views.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698