Chromium Code Reviews| Index: ui/base/ime/win/tsf_event_router.h |
| diff --git a/ui/base/ime/win/tsf_event_router.h b/ui/base/ime/win/tsf_event_router.h |
| index 39bb6dd2d54f7bde5d76dc93c2b661775907f6e9..6ac13b1f0054b19770c8b6271300c95af59e854b 100644 |
| --- a/ui/base/ime/win/tsf_event_router.h |
| +++ b/ui/base/ime/win/tsf_event_router.h |
| @@ -5,8 +5,12 @@ |
| #ifndef UI_BASE_IME_WIN_TSF_EVENT_ROUTER_H_ |
| #define UI_BASE_IME_WIN_TSF_EVENT_ROUTER_H_ |
| +#include <atlbase.h> |
| +#include <atlcom.h> |
| #include <msctf.h> |
| +#include <set> |
| + |
| #include "base/basictypes.h" |
| #include "base/callback.h" |
| #include "base/compiler_specific.h" |
| @@ -17,39 +21,48 @@ struct ITfDocumentMgr; |
| namespace ui { |
| -// This is an abstract interface that monitors events associated with TSF and |
| -// forwards them to the observer. In order to manage the life cycle of this |
| -// object by scoped_refptr and the implementation class of this interface is COM |
| -// class anyway, this interface is derived from IUnknown. |
| -class TsfEventRouter : public IUnknown { |
| +class TsfEventRouterObserver { |
| public: |
| - class Observer { |
| - public: |
| - virtual ~Observer() {} |
| + TsfEventRouterObserver() {} |
| + |
| + // Called when the text contents are updated. |
| + virtual void OnTextUpdated() = 0; |
| - // Called when the text contents are updated. |
| - virtual void OnTextUpdated() = 0; |
| + // Called when the number of currently opened candidate windows changes. |
| + virtual void OnCandidateWindowCountChanged(size_t window_count) = 0; |
| - // Called when the number of currently opened candidate windows changes. |
| - virtual void OnCandidateWindowCountChanged(size_t window_count) = 0; |
| - }; |
| + protected: |
| + virtual ~TsfEventRouterObserver() {} |
| + |
| + private: |
| + DISALLOW_COPY_AND_ASSIGN(TsfEventRouterObserver); |
| +}; |
| +// This class monitores TSF related events and forwards them to given |
| +// |observer|. |
| +class UI_EXPORT TsfEventRouter { |
| + public: |
| + explicit TsfEventRouter(TsfEventRouterObserver* observer); |
|
Peter Kasting
2012/10/26 01:53:47
Nit: Say whether |observer| can be NULL.
Seigo Nonaka
2012/10/26 02:23:10
Done.
|
| virtual ~TsfEventRouter(); |
| - // Sets |manager| to be monitored and |observer| to be notified. |manager| and |
| - // |observer| can be NULL. |
| - virtual void SetManager(ITfThreadMgr* manager, |
| - Observer* observer) = 0; |
| + // Sets |manager| to be monitored. |manager| and can be NULL. |
|
Peter Kasting
2012/10/26 01:53:47
Nit: Remove "and"
Seigo Nonaka
2012/10/26 02:23:10
Done.
|
| + void SetManager(ITfThreadMgr* manager); |
| // Returns true if the IME is composing texts. |
|
Peter Kasting
2012/10/26 01:53:47
Nit: texts -> text
Seigo Nonaka
2012/10/26 02:23:10
Done.
|
| - virtual bool IsImeComposing() = 0; |
| + bool IsImeComposing(); |
| - // Factory function, creates a new instance which the caller owns. |
| - static UI_EXPORT TsfEventRouter* Create(); |
| + // Called when the text contents are updated. |
|
Peter Kasting
2012/10/26 01:53:47
Nit: Called by whom? (2 places)
Seigo Nonaka
2012/10/26 02:23:10
Done.
|
| + void OnTextUpdated(); |
| - protected: |
| - // Create should be used instead. |
| - TsfEventRouter(); |
| + // Called when the number of currently opend candidate window changes. |
|
Peter Kasting
2012/10/26 01:53:47
Nit: opend -> opened
Seigo Nonaka
2012/10/26 02:23:10
Done.
|
| + void OnCandidateWindowCountChanged(size_t window_count); |
| + |
| + private: |
| + class TsfEventRouterDelegate; |
| + |
| + CComObject<TsfEventRouterDelegate>* delegate_; |
|
Peter Kasting
2012/10/26 01:53:47
This should use CComPtr like you used to, not CCom
Seigo Nonaka
2012/10/26 02:23:10
Sure, done.
On 2012/10/26 01:53:47, Peter Kasting
|
| + |
| + TsfEventRouterObserver* observer_; |
| DISALLOW_COPY_AND_ASSIGN(TsfEventRouter); |
| }; |