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 #ifndef UI_BASE_IME_WIN_TSF_EVENT_ROUTER_H_ | 5 #ifndef UI_BASE_IME_WIN_TSF_EVENT_ROUTER_H_ |
6 #define UI_BASE_IME_WIN_TSF_EVENT_ROUTER_H_ | 6 #define UI_BASE_IME_WIN_TSF_EVENT_ROUTER_H_ |
7 | 7 |
8 #include <msctf.h> | 8 #include <msctf.h> |
9 | 9 |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
11 #include "base/callback.h" | 11 #include "base/callback.h" |
12 #include "base/compiler_specific.h" | 12 #include "base/compiler_specific.h" |
13 #include "ui/base/ime/text_input_type.h" | 13 #include "ui/base/ime/text_input_type.h" |
14 #include "ui/base/ui_export.h" | 14 #include "ui/base/ui_export.h" |
15 | 15 |
16 struct ITfDocumentMgr; | 16 struct ITfDocumentMgr; |
17 | 17 |
18 namespace ui { | 18 namespace ui { |
19 | 19 |
20 // This is an abstract interface that monitors events associated with TSF and | 20 // This is an abstract interface that monitors events associated with TSF and |
21 // forwards them to the observer. In order to manage the life cycle of this | 21 // forwards them to the observer. In order to manage the life cycle of this |
22 // object by scoped_refptr and the implementation class of this interface is COM | 22 // object by scoped_refptr and the implementation class of this interface is COM |
23 // class anyway, this interface is derived from IUnknown. | 23 // class anyway, this interface is derived from IUnknown. |
24 class TsfEventRouter : public IUnknown { | 24 class TsfEventRouter : public IUnknown { |
25 public: | 25 public: |
26 typedef base::Callback<void ()> TextUpdatedCallback; | 26 class Observer { |
27 typedef base::Callback<void (size_t window_count)> | 27 public: |
28 CandidateWindowCountChangedCallback; | 28 virtual ~Observer() {} |
29 | |
30 // Called when the text contents are updated. | |
31 virtual void OnTextUpdated() = 0; | |
32 | |
33 // Called when the number of currently opend candidate windowsd is changed. | |
Peter Kasting
2012/10/19 18:40:57
Nit: opend -> open, windowsd -> windows, is change
Seigo Nonaka
2012/10/22 03:11:04
Done.
| |
34 virtual void OnCandidateWindowCountChanged(size_t window_count) = 0; | |
35 }; | |
29 | 36 |
30 virtual ~TsfEventRouter(); | 37 virtual ~TsfEventRouter(); |
31 | 38 |
32 // Sets |manager| to be monitored. |manager| can be NULL. | 39 // Sets |manager| to be monitored and |observer| to be notified. |manager| and |
33 virtual void SetManager(ITfThreadMgr* manager) = 0; | 40 // |observer| can be NULL. |
41 virtual void SetManager(ITfThreadMgr* manager, | |
42 Observer* observer) = 0; | |
34 | 43 |
35 // Returns true if the IME is composing texts. | 44 // Returns true if the IME is composing texts. |
36 virtual bool IsImeComposing() = 0; | 45 virtual bool IsImeComposing() = 0; |
37 | 46 |
38 // Sets the callback function which is invoked when the text contents is | |
39 // updated. | |
40 virtual void SetTextUpdatedCallback( | |
41 const TextUpdatedCallback& callback) = 0; | |
42 | |
43 // Sets the callback function which is invoked when the number of currently | |
44 // candidate window opened is changed. | |
45 virtual void SetCandidateWindowStatusChangedCallback( | |
46 const CandidateWindowCountChangedCallback& callback) = 0; | |
47 | |
48 // Factory function, creates a new instance and retunrns ownership. | 47 // Factory function, creates a new instance and retunrns ownership. |
Peter Kasting
2012/10/19 18:40:57
Nit: While here: and retunrns ownership -> which t
Seigo Nonaka
2012/10/22 03:11:04
Done.
| |
49 static UI_EXPORT TsfEventRouter* Create(); | 48 static UI_EXPORT TsfEventRouter* Create(); |
50 | 49 |
51 protected: | 50 protected: |
52 // Create should be used instead. | 51 // Create should be used instead. |
53 TsfEventRouter(); | 52 TsfEventRouter(); |
54 | 53 |
55 DISALLOW_COPY_AND_ASSIGN(TsfEventRouter); | 54 DISALLOW_COPY_AND_ASSIGN(TsfEventRouter); |
56 }; | 55 }; |
57 | 56 |
58 } // namespace ui | 57 } // namespace ui |
59 | 58 |
60 #endif // UI_BASE_IME_WIN_TSF_EVENT_ROUTER_H_ | 59 #endif // UI_BASE_IME_WIN_TSF_EVENT_ROUTER_H_ |
OLD | NEW |