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 28 matching lines...) Expand all Loading... |
39 virtual void OnTextInputTypeChanged(const TextInputClient* client) OVERRIDE; | 39 virtual void OnTextInputTypeChanged(const TextInputClient* client) OVERRIDE; |
40 virtual void OnTextLayoutChanged() OVERRIDE; | 40 virtual void OnTextLayoutChanged() OVERRIDE; |
41 virtual bool CancelComposition() OVERRIDE; | 41 virtual bool CancelComposition() OVERRIDE; |
42 virtual bool ConfirmComposition() OVERRIDE; | 42 virtual bool ConfirmComposition() 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 virtual TextInputClient* GetFocusedTextInputClient() const OVERRIDE; |
48 | 48 |
| 49 virtual void OnCandidateWindowShow() OVERRIDE; |
| 50 virtual void OnCandidateWindowUpdate() OVERRIDE; |
| 51 virtual void OnCandidateWindowHide() OVERRIDE; |
| 52 |
49 private: | 53 private: |
50 // Returns true if |tsf_document_map_| is successfully initialized. This | 54 // Returns true if |tsf_document_map_| is successfully initialized. This |
51 // method should be called from and only from Initialize(). | 55 // method should be called from and only from Initialize(). |
52 bool InitializeDocumentMapInternal(); | 56 bool InitializeDocumentMapInternal(); |
53 | 57 |
54 // Returns true if |context| is successfully updated to be a disabled | 58 // Returns true if |context| is successfully updated to be a disabled |
55 // context, where an IME should be deactivated. This is suitable for some | 59 // context, where an IME should be deactivated. This is suitable for some |
56 // special input context such as password fields. | 60 // special input context such as password fields. |
57 bool InitializeDisabledContext(ITfContext* context); | 61 bool InitializeDisabledContext(ITfContext* context); |
58 | 62 |
(...skipping 418 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
477 if (it == tsf_document_map_.end()) { | 481 if (it == tsf_document_map_.end()) { |
478 it = tsf_document_map_.find(TEXT_INPUT_TYPE_TEXT); | 482 it = tsf_document_map_.find(TEXT_INPUT_TYPE_TEXT); |
479 // This check is necessary because it's possible that we failed to | 483 // This check is necessary because it's possible that we failed to |
480 // initialize |tsf_document_map_| and it has no TEXT_INPUT_TYPE_TEXT. | 484 // initialize |tsf_document_map_| and it has no TEXT_INPUT_TYPE_TEXT. |
481 if (it == tsf_document_map_.end()) | 485 if (it == tsf_document_map_.end()) |
482 return NULL; | 486 return NULL; |
483 } | 487 } |
484 return &it->second; | 488 return &it->second; |
485 } | 489 } |
486 | 490 |
| 491 void TSFBridgeDelegate::OnCandidateWindowShow() { |
| 492 TextInputClient* client = GetFocusedTextInputClient(); |
| 493 if (client) |
| 494 client->OnCandidateWindowShow(); |
| 495 } |
| 496 |
| 497 void TSFBridgeDelegate::OnCandidateWindowUpdate() { |
| 498 TextInputClient* client = GetFocusedTextInputClient(); |
| 499 if (client) |
| 500 client->OnCandidateWindowUpdate(); |
| 501 } |
| 502 |
| 503 void TSFBridgeDelegate::OnCandidateWindowHide() { |
| 504 TextInputClient* client = GetFocusedTextInputClient(); |
| 505 if (client) |
| 506 client->OnCandidateWindowHide(); |
| 507 } |
| 508 |
487 } // namespace | 509 } // namespace |
488 | 510 |
489 | 511 |
490 // TsfBridge ----------------------------------------------------------------- | 512 // TsfBridge ----------------------------------------------------------------- |
491 | 513 |
492 TSFBridge::TSFBridge() { | 514 TSFBridge::TSFBridge() { |
493 } | 515 } |
494 | 516 |
495 TSFBridge::~TSFBridge() { | 517 TSFBridge::~TSFBridge() { |
496 } | 518 } |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
549 return delegate; | 571 return delegate; |
550 } | 572 } |
551 | 573 |
552 // static | 574 // static |
553 void TSFBridge::Finalize(void* data) { | 575 void TSFBridge::Finalize(void* data) { |
554 TSFBridgeDelegate* delegate = static_cast<TSFBridgeDelegate*>(data); | 576 TSFBridgeDelegate* delegate = static_cast<TSFBridgeDelegate*>(data); |
555 delete delegate; | 577 delete delegate; |
556 } | 578 } |
557 | 579 |
558 } // namespace ui | 580 } // namespace ui |
OLD | NEW |