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/ui/views/omnibox/omnibox_view_win.cc

Issue 11305002: Support TSF related event handling on NativeTextField (Closed) Base URL: http://git.chromium.org/chromium/src.git@findbar_fix
Patch Set: Address comments Created 8 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
« no previous file with comments | « chrome/browser/ui/views/omnibox/omnibox_view_win.h ('k') | ui/base/ime/win/tsf_event_router.h » ('j') | 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_win.h" 5 #include "chrome/browser/ui/views/omnibox/omnibox_view_win.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <locale> 8 #include <locale>
9 #include <string> 9 #include <string>
10 10
(...skipping 899 matching lines...) Expand 10 before | Expand all | Expand 10 after
910 native_view_host_, 910 native_view_host_,
911 ui::AccessibilityTypes::EVENT_SELECTION_CHANGED, 911 ui::AccessibilityTypes::EVENT_SELECTION_CHANGED,
912 true); 912 true);
913 } else if (delete_at_end_pressed_) { 913 } else if (delete_at_end_pressed_) {
914 model()->OnChanged(); 914 model()->OnChanged();
915 } 915 }
916 916
917 return something_changed; 917 return something_changed;
918 } 918 }
919 919
920 void OmniboxViewWin::OnTextUpdated() {
921 if (ignore_ime_messages_)
922 return;
923 OnAfterPossibleChangeInternal(true);
924 // Call OnBeforePossibleChange function here to get correct diff in next IME
925 // update. The Text Services Framework does not provide any notification
926 // before entering edit session, therefore we don't have good place to call
927 // OnBeforePossibleChange.
928 OnBeforePossibleChange();
929 }
930
931 void OmniboxViewWin::OnCandidateWindowCountChanged(size_t window_count) { 920 void OmniboxViewWin::OnCandidateWindowCountChanged(size_t window_count) {
932 ime_candidate_window_open_ = (window_count != 0); 921 ime_candidate_window_open_ = (window_count != 0);
933 if (ime_candidate_window_open_) { 922 if (ime_candidate_window_open_) {
934 CloseOmniboxPopup(); 923 CloseOmniboxPopup();
935 } else if (model()->user_input_in_progress()) { 924 } else if (model()->user_input_in_progress()) {
936 // UpdatePopup assumes user input is in progress, so only call it if 925 // UpdatePopup assumes user input is in progress, so only call it if
937 // that's the case. Otherwise, autocomplete may run on an empty user 926 // that's the case. Otherwise, autocomplete may run on an empty user
938 // text. 927 // text.
939 UpdatePopup(); 928 UpdatePopup();
940 } 929 }
941 } 930 }
942 931
932 void OmniboxViewWin::OnTextUpdated(const ui::Range& /*composition_range*/) {
933 if (ignore_ime_messages_)
934 return;
935 OnAfterPossibleChangeInternal(true);
936 // Call OnBeforePossibleChange function here to get correct diff in next IME
937 // update. The Text Services Framework does not provide any notification
938 // before entering edit session, therefore we don't have good place to call
939 // OnBeforePossibleChange.
940 OnBeforePossibleChange();
941 }
942
943 gfx::NativeView OmniboxViewWin::GetNativeView() const { 943 gfx::NativeView OmniboxViewWin::GetNativeView() const {
944 return m_hWnd; 944 return m_hWnd;
945 } 945 }
946 946
947 // static 947 // static
948 gfx::NativeView OmniboxViewWin::GetRelativeWindowForNativeView( 948 gfx::NativeView OmniboxViewWin::GetRelativeWindowForNativeView(
949 gfx::NativeView edit_native_view) { 949 gfx::NativeView edit_native_view) {
950 // When an IME is attached to the rich-edit control, retrieve its window 950 // When an IME is attached to the rich-edit control, retrieve its window
951 // handle, and the popup window of OmniboxPopupView will be shown under the 951 // handle, and the popup window of OmniboxPopupView will be shown under the
952 // IME windows. 952 // IME windows.
(...skipping 1797 matching lines...) Expand 10 before | Expand all | Expand 10 after
2750 return (rect.left - client_rect.left) + (client_rect.right - rect.right); 2750 return (rect.left - client_rect.left) + (client_rect.right - rect.right);
2751 } 2751 }
2752 2752
2753 int OmniboxViewWin::WidthNeededToDisplay(const string16& text) const { 2753 int OmniboxViewWin::WidthNeededToDisplay(const string16& text) const {
2754 // Use font_.GetStringWidth() instead of 2754 // Use font_.GetStringWidth() instead of
2755 // PosFromChar(location_entry_->GetTextLength()) because PosFromChar() is 2755 // PosFromChar(location_entry_->GetTextLength()) because PosFromChar() is
2756 // apparently buggy. In both LTR UI and RTL UI with left-to-right layout, 2756 // apparently buggy. In both LTR UI and RTL UI with left-to-right layout,
2757 // PosFromChar(i) might return 0 when i is greater than 1. 2757 // PosFromChar(i) might return 0 when i is greater than 1.
2758 return font_.GetStringWidth(text) + GetHorizontalMargin(); 2758 return font_.GetStringWidth(text) + GetHorizontalMargin();
2759 } 2759 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/views/omnibox/omnibox_view_win.h ('k') | ui/base/ime/win/tsf_event_router.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698