diff options
-rw-r--r-- | chrome/browser/ime_input.cc | 13 | ||||
-rw-r--r-- | chrome/browser/ime_input.h | 10 | ||||
-rw-r--r-- | chrome/browser/renderer_host/render_widget_host_view_win.cc | 2 |
3 files changed, 22 insertions, 3 deletions
diff --git a/chrome/browser/ime_input.cc b/chrome/browser/ime_input.cc index 21b5229..3f60670 100644 --- a/chrome/browser/ime_input.cc +++ b/chrome/browser/ime_input.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. +// Copyright (c) 2010 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -304,6 +304,17 @@ void ImeInput::DisableIME(HWND window_handle) { ::ImmAssociateContextEx(window_handle, NULL, 0); } +void ImeInput::CancelIME(HWND window_handle) { + if (is_composing_) { + HIMC imm_context = ::ImmGetContext(window_handle); + if (imm_context) { + ::ImmNotifyIME(imm_context, NI_COMPOSITIONSTR, CPS_CANCEL, 0); + ::ImmReleaseContext(window_handle, imm_context); + } + ResetComposition(window_handle); + } +} + void ImeInput::EnableIME(HWND window_handle, const gfx::Rect& caret_rect, bool complete) { diff --git a/chrome/browser/ime_input.h b/chrome/browser/ime_input.h index b1ebf4a..45fe21f 100644 --- a/chrome/browser/ime_input.h +++ b/chrome/browser/ime_input.h @@ -1,4 +1,4 @@ -// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. +// Copyright (c) 2010 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -235,6 +235,12 @@ class ImeInput { // Represents the window handle of the caller. void DisableIME(HWND window_handle); + // Cancels an ongoing composition of the IME attached to the given window. + // Parameters + // * window_handle [in] (HWND) + // Represents the window handle of the caller. + void CancelIME(HWND window_handle); + protected: // Determines whether or not the given attribute represents a target // (a.k.a. a selection). @@ -300,7 +306,7 @@ class ImeInput { // The rectangle of the input caret retrieved from a renderer process. gfx::Rect caret_rect_; - DISALLOW_EVIL_CONSTRUCTORS(ImeInput); + DISALLOW_COPY_AND_ASSIGN(ImeInput); }; #endif // CHROME_BROWSER_IME_INPUT_H_ diff --git a/chrome/browser/renderer_host/render_widget_host_view_win.cc b/chrome/browser/renderer_host/render_widget_host_view_win.cc index b482b87..e195317 100644 --- a/chrome/browser/renderer_host/render_widget_host_view_win.cc +++ b/chrome/browser/renderer_host/render_widget_host_view_win.cc @@ -614,6 +614,8 @@ void RenderWidgetHostViewWin::IMEUpdateStatus(int control, const gfx::Rect& caret_rect) { if (control == IME_DISABLE) { ime_input_.DisableIME(m_hWnd); + } else if (control == IME_CANCEL_COMPOSITION) { + ime_input_.CancelIME(m_hWnd); } else { ime_input_.EnableIME(m_hWnd, caret_rect, control == IME_COMPLETE_COMPOSITION); |