| Index: trunk/src/ui/base/ime/win/tsf_bridge.cc
|
| ===================================================================
|
| --- trunk/src/ui/base/ime/win/tsf_bridge.cc (revision 202706)
|
| +++ trunk/src/ui/base/ime/win/tsf_bridge.cc (working copy)
|
| @@ -39,7 +39,6 @@
|
| // TsfBridge:
|
| virtual void Shutdown() OVERRIDE;
|
| virtual void OnTextInputTypeChanged(TextInputClient* client) OVERRIDE;
|
| - virtual void OnTextLayoutChanged() OVERRIDE;
|
| virtual bool CancelComposition() OVERRIDE;
|
| virtual void SetFocusedClient(HWND focused_window,
|
| TextInputClient* client) OVERRIDE;
|
| @@ -75,6 +74,13 @@
|
| // Returns true if already initialized.
|
| bool IsInitialized();
|
|
|
| + // Returns an instance of ITfDocumentMgr that is associated with the
|
| + // current TextInputType of |client_|.
|
| + base::win::ScopedComPtr<ITfDocumentMgr> GetAssociatedDocumentManager();
|
| +
|
| + // An ITfThreadMgr object to be used in focus and document management.
|
| + base::win::ScopedComPtr<ITfThreadMgr> thread_manager_;
|
| +
|
| // A triple of document manager, text store and binding cookie between
|
| // a context owned by the document manager and the text store. This is a
|
| // minimum working set of an editable document in TSF.
|
| @@ -89,17 +95,10 @@
|
| DWORD cookie;
|
| };
|
|
|
| - // Returns a pointer to TSFDocument that is associated with the current
|
| - // TextInputType of |client_|.
|
| - TSFDocument* GetAssociatedDocument();
|
| -
|
| - // An ITfThreadMgr object to be used in focus and document management.
|
| - base::win::ScopedComPtr<ITfThreadMgr> thread_manager_;
|
| -
|
| // A map from TextInputType to an editable document for TSF. We use multiple
|
| // TSF documents that have different InputScopes and TSF attributes based on
|
| // the TextInputType associated with the target document. For a TextInputType
|
| - // that is not converted by this map, a default document, e.g. the document
|
| + // that is not coverted by this map, a default document, e.g. the document
|
| // for TEXT_INPUT_TYPE_TEXT, should be used.
|
| // Note that some IMEs don't change their state unless the document focus is
|
| // changed. This is why we use multiple documents instead of changing TSF
|
| @@ -199,20 +198,8 @@
|
| // Called from not focusing client. Do nothing.
|
| return;
|
| }
|
| - TSFDocument* document = GetAssociatedDocument();
|
| - if (!document)
|
| - return;
|
| - thread_manager_->SetFocus(document->document_manager.get());
|
| - OnTextLayoutChanged();
|
| -}
|
|
|
| -void TSFBridgeDelegate::OnTextLayoutChanged() {
|
| - TSFDocument* document = GetAssociatedDocument();
|
| - if (!document)
|
| - return;
|
| - if (!document->text_store)
|
| - return;
|
| - document->text_store->SendOnLayoutChange();
|
| + thread_manager_->SetFocus(GetAssociatedDocumentManager().get());
|
| }
|
|
|
| bool TSFBridgeDelegate::CancelComposition() {
|
| @@ -430,14 +417,13 @@
|
| return client_id_ != TF_CLIENTID_NULL;
|
| }
|
|
|
| -TSFBridgeDelegate::TSFDocument* TSFBridgeDelegate::GetAssociatedDocument() {
|
| - if (!client_)
|
| - return NULL;
|
| - TSFDocumentMap::iterator it =
|
| +base::win::ScopedComPtr<ITfDocumentMgr>
|
| +TSFBridgeDelegate::GetAssociatedDocumentManager() {
|
| + TSFDocumentMap::const_iterator it =
|
| tsf_document_map_.find(client_->GetTextInputType());
|
| if (it == tsf_document_map_.end())
|
| - return &tsf_document_map_[TEXT_INPUT_TYPE_TEXT];
|
| - return &it->second;
|
| + return tsf_document_map_[TEXT_INPUT_TYPE_TEXT].document_manager;
|
| + return it->second.document_manager;
|
| }
|
|
|
| } // namespace
|
|
|