| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include <msctf.h> | 5 #include <msctf.h> |
| 6 | 6 |
| 7 #include <map> | 7 #include <map> |
| 8 | 8 |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "base/memory/ref_counted.h" | 10 #include "base/memory/ref_counted.h" |
| (...skipping 26 matching lines...) Expand all Loading... |
| 37 bool Initialize(); | 37 bool Initialize(); |
| 38 | 38 |
| 39 // TsfBridge: | 39 // TsfBridge: |
| 40 virtual void Shutdown() OVERRIDE; | 40 virtual void Shutdown() OVERRIDE; |
| 41 virtual void OnTextInputTypeChanged(TextInputClient* client) OVERRIDE; | 41 virtual void OnTextInputTypeChanged(TextInputClient* client) OVERRIDE; |
| 42 virtual bool CancelComposition() OVERRIDE; | 42 virtual bool CancelComposition() OVERRIDE; |
| 43 virtual void SetFocusedClient(HWND focused_window, | 43 virtual void SetFocusedClient(HWND focused_window, |
| 44 TextInputClient* client) OVERRIDE; | 44 TextInputClient* client) OVERRIDE; |
| 45 virtual void RemoveFocusedClient(TextInputClient* client) OVERRIDE; | 45 virtual void RemoveFocusedClient(TextInputClient* client) OVERRIDE; |
| 46 virtual base::win::ScopedComPtr<ITfThreadMgr> GetThreadManager() OVERRIDE; | 46 virtual base::win::ScopedComPtr<ITfThreadMgr> GetThreadManager() OVERRIDE; |
| 47 virtual TextInputClient* GetFocusedTextInputClient() const OVERRIDE; |
| 47 | 48 |
| 48 private: | 49 private: |
| 49 friend struct DefaultSingletonTraits<TSFBridgeDelegate>; | 50 friend struct DefaultSingletonTraits<TSFBridgeDelegate>; |
| 50 | 51 |
| 51 // Returns true if |tsf_document_map_| is successfully initialized. This | 52 // Returns true if |tsf_document_map_| is successfully initialized. This |
| 52 // method should be called from and only from Initialize(). | 53 // method should be called from and only from Initialize(). |
| 53 bool InitializeDocumentMapInternal(); | 54 bool InitializeDocumentMapInternal(); |
| 54 | 55 |
| 55 // Returns true if |context| is successfully updated to be a disabled | 56 // Returns true if |context| is successfully updated to be a disabled |
| 56 // context, where an IME should be deactivated. This is suitable for some | 57 // context, where an IME should be deactivated. This is suitable for some |
| (...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 265 return; | 266 return; |
| 266 client_ = NULL; | 267 client_ = NULL; |
| 267 for (TSFDocumentMap::iterator it = tsf_document_map_.begin(); | 268 for (TSFDocumentMap::iterator it = tsf_document_map_.begin(); |
| 268 it != tsf_document_map_.end(); ++it) { | 269 it != tsf_document_map_.end(); ++it) { |
| 269 if (it->second.text_store.get() == NULL) | 270 if (it->second.text_store.get() == NULL) |
| 270 continue; | 271 continue; |
| 271 it->second.text_store->SetFocusedTextInputClient(NULL, NULL); | 272 it->second.text_store->SetFocusedTextInputClient(NULL, NULL); |
| 272 } | 273 } |
| 273 } | 274 } |
| 274 | 275 |
| 276 TextInputClient* TSFBridgeDelegate::GetFocusedTextInputClient() const { |
| 277 return client_; |
| 278 } |
| 279 |
| 275 base::win::ScopedComPtr<ITfThreadMgr> TSFBridgeDelegate::GetThreadManager() { | 280 base::win::ScopedComPtr<ITfThreadMgr> TSFBridgeDelegate::GetThreadManager() { |
| 276 DCHECK_EQ(MessageLoop::TYPE_UI, MessageLoop::current()->type()); | 281 DCHECK_EQ(MessageLoop::TYPE_UI, MessageLoop::current()->type()); |
| 277 DCHECK(IsInitialized()); | 282 DCHECK(IsInitialized()); |
| 278 return thread_manager_; | 283 return thread_manager_; |
| 279 } | 284 } |
| 280 | 285 |
| 281 bool TSFBridgeDelegate::CreateDocumentManager(TSFTextStore* text_store, | 286 bool TSFBridgeDelegate::CreateDocumentManager(TSFTextStore* text_store, |
| 282 ITfDocumentMgr** document_manager, | 287 ITfDocumentMgr** document_manager, |
| 283 ITfContext** context, | 288 ITfContext** context, |
| 284 DWORD* source_cookie) { | 289 DWORD* source_cookie) { |
| (...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 467 return delegate; | 472 return delegate; |
| 468 } | 473 } |
| 469 | 474 |
| 470 // static | 475 // static |
| 471 void TSFBridge::Finalize(void* data) { | 476 void TSFBridge::Finalize(void* data) { |
| 472 TSFBridgeDelegate* delegate = static_cast<TSFBridgeDelegate*>(data); | 477 TSFBridgeDelegate* delegate = static_cast<TSFBridgeDelegate*>(data); |
| 473 delete delegate; | 478 delete delegate; |
| 474 } | 479 } |
| 475 | 480 |
| 476 } // namespace ui | 481 } // namespace ui |
| OLD | NEW |