Chromium Code Reviews| Index: ui/base/ime/win/tsf_bridge.cc |
| diff --git a/ui/base/ime/win/tsf_bridge.cc b/ui/base/ime/win/tsf_bridge.cc |
| index b2ba98385773fb51a35830dd1f601180c85648a3..7cc280a0ebbf6be0368fab094c7fd8f8bbc91206 100644 |
| --- a/ui/base/ime/win/tsf_bridge.cc |
| +++ b/ui/base/ime/win/tsf_bridge.cc |
| @@ -39,6 +39,7 @@ class TSFBridgeDelegate : public TSFBridge { |
| virtual void OnTextInputTypeChanged(const TextInputClient* client) OVERRIDE; |
| virtual void OnTextLayoutChanged() OVERRIDE; |
| virtual bool CancelComposition() OVERRIDE; |
| + virtual bool ConfirmComposition() OVERRIDE; |
| virtual void SetFocusedClient(HWND focused_window, |
| TextInputClient* client) OVERRIDE; |
| virtual void RemoveFocusedClient(TextInputClient* client) OVERRIDE; |
| @@ -213,40 +214,29 @@ bool TSFBridgeDelegate::CancelComposition() { |
| DCHECK_EQ(base::MessageLoop::TYPE_UI, base::MessageLoop::current()->type()); |
| DCHECK(IsInitialized()); |
| - base::win::ScopedComPtr<ITfDocumentMgr> focused_document_manager; |
| - for (TSFDocumentMap::iterator it = tsf_document_map_.begin(); |
| - it != tsf_document_map_.end(); ++it) { |
| - if (IsFocused(it->second.document_manager.get())) { |
| - focused_document_manager = it->second.document_manager.get(); |
| - break; |
| - } |
| - } |
| - |
| - if (focused_document_manager.get() == NULL) |
| + TSFDocument* document = GetAssociatedDocument(); |
| + if (!document) |
| return false; |
| - |
| - base::win::ScopedComPtr<ITfContext> context; |
| - // We should use ITfDocumentMgr::GetBase instead of ITfDocumentMgr::GetTop, |
| - // which may return a temporal context created by an IME for its modal UI |
| - // handling, to obtain a context against which on-going composition is |
| - // canceled. This is because ITfDocumentMgr::GetBase always returns the |
| - // context that is created by us and owns the on-going composition. |
| - // See http://crbug.com/169664 for details. |
| - if (FAILED(focused_document_manager->GetBase(context.Receive()))) { |
| - DVLOG(1) << "Failed to get top context."; |
| + if (!document->text_store) |
| return false; |
| - } |
| - base::win::ScopedComPtr<ITfContextOwnerCompositionServices> owner; |
| - if (FAILED(owner.QueryFrom(context))) { |
| - DVLOG(1) << "Failed to get ITfContextOwnerCompositionService."; |
| + return document->text_store->CancelComposition(); |
| +} |
| + |
| +bool TSFBridgeDelegate::ConfirmComposition() { |
| + DCHECK_EQ(base::MessageLoop::TYPE_UI, base::MessageLoop::current()->type()); |
| + DCHECK(IsInitialized()); |
| + |
| + TSFDocument* document = GetAssociatedDocument(); |
| + if (!document) |
| return false; |
| - } |
| - // Cancel all compositions. |
| - owner->TerminateComposition(NULL); |
| - return true; |
| + if (!document->text_store) |
| + return false; |
| + |
| + return document->text_store->ConfirmComposition(); |
| } |
| + |
|
Seigo Nonaka
2013/06/21 08:09:53
nit: please remove
Yohei Yukawa
2013/06/21 08:26:55
Done.
|
| void TSFBridgeDelegate::SetFocusedClient(HWND focused_window, |
| TextInputClient* client) { |
| DCHECK_EQ(base::MessageLoop::TYPE_UI, base::MessageLoop::current()->type()); |