summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorYukawa@chromium.org <Yukawa@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-09-11 17:58:51 +0000
committerYukawa@chromium.org <Yukawa@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-09-11 17:58:51 +0000
commitf1346bdc43f7e5a2a54809c81b62691ecf29eb36 (patch)
treef9a300d0e58b82df4a20a732ad919cc4f983a316
parentf41b93747c8494945f2537d7922cfd90e0219472 (diff)
downloadchromium_src-f1346bdc43f7e5a2a54809c81b62691ecf29eb36.zip
chromium_src-f1346bdc43f7e5a2a54809c81b62691ecf29eb36.tar.gz
chromium_src-f1346bdc43f7e5a2a54809c81b62691ecf29eb36.tar.bz2
Stop overriding InputMethodBase::SetFocusedTextInputClient
With this CL, neither InputMethodTSF nor InputMethodIMM32 no longer overrides default implementation. This CL also relaxes the condition of IsWindowFocused so that it can work when the attached window becomes active but has not received WM_FOCUS yet. This is a preparation CL for the main fix of Issue 287620. There should be no new regression with this CL as far as I've tested. In short, the main goal of this CL is just cleaning up the existing code w/o any regression so that we can keep the main fix of Issue 287620 as simple and minimum as possible. BUG=287620 TEST=manually done with/without --enable-text-services-framework on Aura/non-Aura Windows 7. Review URL: https://chromiumcodereview.appspot.com/23475033 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@222590 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--ui/base/ime/input_method_imm32.cc12
-rw-r--r--ui/base/ime/input_method_imm32.h5
-rw-r--r--ui/base/ime/input_method_tsf.cc20
-rw-r--r--ui/base/ime/input_method_tsf.h5
-rw-r--r--ui/base/ime/input_method_win.cc16
-rw-r--r--ui/base/ime/input_method_win.h4
6 files changed, 20 insertions, 42 deletions
diff --git a/ui/base/ime/input_method_imm32.cc b/ui/base/ime/input_method_imm32.cc
index f40baad..59d67f0 100644
--- a/ui/base/ime/input_method_imm32.cc
+++ b/ui/base/ime/input_method_imm32.cc
@@ -120,11 +120,6 @@ void InputMethodIMM32::CancelComposition(const TextInputClient* client) {
imm32_manager_.CancelIME(GetAttachedWindowHandle(client));
}
-void InputMethodIMM32::SetFocusedTextInputClient(TextInputClient* client) {
- ConfirmCompositionText();
- InputMethodWin::SetFocusedTextInputClient(client);
-}
-
bool InputMethodIMM32::IsCandidatePopupOpen() const {
return is_candidate_popup_open_;
}
@@ -286,11 +281,4 @@ void InputMethodIMM32::UpdateIMEState() {
imm32_manager_.SetTextInputMode(window_handle, GetTextInputMode());
}
-bool InputMethodIMM32::IsWindowFocused(const TextInputClient* client) const {
- if (!client)
- return false;
- HWND attached_window_handle = GetAttachedWindowHandle(client);
- return attached_window_handle && GetFocus() == attached_window_handle;
-}
-
} // namespace ui
diff --git a/ui/base/ime/input_method_imm32.h b/ui/base/ime/input_method_imm32.h
index a67d796..dc0a4dc 100644
--- a/ui/base/ime/input_method_imm32.h
+++ b/ui/base/ime/input_method_imm32.h
@@ -29,7 +29,6 @@ class UI_EXPORT InputMethodIMM32 : public InputMethodWin {
virtual void OnTextInputTypeChanged(const TextInputClient* client) OVERRIDE;
virtual void OnCaretBoundsChanged(const TextInputClient* client) OVERRIDE;
virtual void CancelComposition(const TextInputClient* client) OVERRIDE;
- virtual void SetFocusedTextInputClient(TextInputClient* client) OVERRIDE;
virtual bool IsCandidatePopupOpen() const OVERRIDE;
protected:
@@ -71,10 +70,6 @@ class UI_EXPORT InputMethodIMM32 : public InputMethodWin {
// Enables or disables the IME according to the current text input type.
void UpdateIMEState();
- // Returns true if the Win32 native window bound to |client| has Win32 input
- // focus.
- bool IsWindowFocused(const TextInputClient* client) const;
-
bool enabled_;
// True if we know for sure that a candidate window is open.
diff --git a/ui/base/ime/input_method_tsf.cc b/ui/base/ime/input_method_tsf.cc
index 527e6b1..aaec2e0 100644
--- a/ui/base/ime/input_method_tsf.cc
+++ b/ui/base/ime/input_method_tsf.cc
@@ -115,21 +115,6 @@ void InputMethodTSF::CancelComposition(const TextInputClient* client) {
ui::TSFBridge::GetInstance()->CancelComposition();
}
-void InputMethodTSF::SetFocusedTextInputClient(TextInputClient* client) {
- if (IsWindowFocused(client)) {
- if (IsTextInputClientFocused(client)) {
- ui::TSFBridge::GetInstance()->SetFocusedClient(
- GetAttachedWindowHandle(client), client);
- } else {
- // SetFocusedTextInputClient(NULL) must be interpreted as
- // "Remove the attached client".
- ui::TSFBridge::GetInstance()->RemoveFocusedClient(
- ui::TSFBridge::GetInstance()->GetFocusedTextInputClient());
- }
- }
- InputMethodWin::SetFocusedTextInputClient(client);
-}
-
void InputMethodTSF::DetachTextInputClient(TextInputClient* client) {
InputMethodWin::DetachTextInputClient(client);
ui::TSFBridge::GetInstance()->RemoveFocusedClient(client);
@@ -169,9 +154,4 @@ void InputMethodTSF::ConfirmCompositionText() {
ui::TSFBridge::GetInstance()->ConfirmComposition();
}
-bool InputMethodTSF::IsWindowFocused(const TextInputClient* client) const {
- HWND attached_window_handle = GetAttachedWindowHandle(client);
- return attached_window_handle && GetFocus() == attached_window_handle;
-}
-
} // namespace ui
diff --git a/ui/base/ime/input_method_tsf.h b/ui/base/ime/input_method_tsf.h
index 6add7d4..2b4a9bd 100644
--- a/ui/base/ime/input_method_tsf.h
+++ b/ui/base/ime/input_method_tsf.h
@@ -31,7 +31,6 @@ class UI_EXPORT InputMethodTSF : public InputMethodWin {
virtual void OnTextInputTypeChanged(const TextInputClient* client) OVERRIDE;
virtual void OnCaretBoundsChanged(const TextInputClient* client) OVERRIDE;
virtual void CancelComposition(const TextInputClient* client) OVERRIDE;
- virtual void SetFocusedTextInputClient(TextInputClient* client) OVERRIDE;
virtual void DetachTextInputClient(TextInputClient* client) OVERRIDE;
virtual bool IsCandidatePopupOpen() const OVERRIDE;
@@ -47,10 +46,6 @@ class UI_EXPORT InputMethodTSF : public InputMethodWin {
// Asks the client to confirm current composition text.
void ConfirmCompositionText();
- // Returns true if the Win32 native window bound to |client| has Win32 input
- // focus.
- bool IsWindowFocused(const TextInputClient* client) const;
-
// TSF event router and observer.
scoped_ptr<TSFEventObserver> tsf_event_observer_;
scoped_ptr<TSFEventRouter> tsf_event_router_;
diff --git a/ui/base/ime/input_method_win.cc b/ui/base/ime/input_method_win.cc
index 856c27d..90f87da 100644
--- a/ui/base/ime/input_method_win.cc
+++ b/ui/base/ime/input_method_win.cc
@@ -351,4 +351,20 @@ HWND InputMethodWin::GetAttachedWindowHandle(
#endif
}
+bool InputMethodWin::IsWindowFocused(const TextInputClient* client) const {
+ if (!client)
+ return false;
+ HWND attached_window_handle = GetAttachedWindowHandle(client);
+#if defined(USE_AURA)
+ // When Aura is enabled, |attached_window_handle| should always be a top-level
+ // window. So we can safely assume that |attached_window_handle| is ready for
+ // receiving keyboard input as long as it is an active window. This works well
+ // even when the |attached_window_handle| becomes active but has not received
+ // WM_FOCUS yet.
+ return attached_window_handle && GetActiveWindow() == attached_window_handle;
+#else
+ return attached_window_handle && GetFocus() == attached_window_handle;
+#endif
+}
+
} // namespace ui
diff --git a/ui/base/ime/input_method_win.h b/ui/base/ime/input_method_win.h
index 4d627e4..c69f2db 100644
--- a/ui/base/ime/input_method_win.h
+++ b/ui/base/ime/input_method_win.h
@@ -57,6 +57,10 @@ class UI_EXPORT InputMethodWin : public InputMethodBase {
// On Aura environment, |toplevel_window_handle_| is always returned.
HWND GetAttachedWindowHandle(const TextInputClient* text_input_client) const;
+ // Returns true if the Win32 native window bound to |client| is considered
+ // to be ready for receiving keyboard input.
+ bool IsWindowFocused(const TextInputClient* client) const;
+
// Indicates if the current input locale has an IME.
bool active_;