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

Unified Diff: ui/base/ime/win/tsf_bridge.cc

Issue 16901011: Support CancelCompositionText/ComfirmCompositionText in TSF (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Fix a typo Created 7 years, 6 months 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ui/base/ime/win/tsf_bridge.h ('k') | ui/base/ime/win/tsf_text_store.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..8a83b4f60fe632a59b3e68aec8965317e03ef5df 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,38 +214,26 @@ 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();
}
void TSFBridgeDelegate::SetFocusedClient(HWND focused_window,
« no previous file with comments | « ui/base/ime/win/tsf_bridge.h ('k') | ui/base/ime/win/tsf_text_store.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698