| 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..e16df27d5e15fe47788ba9c60ed941695738c385 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,47 @@ 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:
|
| + // Do not pass NULL to |observer|.
|
| + explicit TsfEventRouter(TsfEventRouterObserver* observer);
|
| 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 |thread_manager| to be monitored. |thread_manager| can be NULL.
|
| + void SetManager(ITfThreadMgr* thread_manager);
|
|
|
| - // Returns true if the IME is composing texts.
|
| - virtual bool IsImeComposing() = 0;
|
| + // Returns true if the IME is composing text.
|
| + bool IsImeComposing();
|
|
|
| - // Factory function, creates a new instance which the caller owns.
|
| - static UI_EXPORT TsfEventRouter* Create();
|
| + // Callbacks from the TsfEventRouterDelegate:
|
| + void OnTextUpdated();
|
| + void OnCandidateWindowCountChanged(size_t window_count);
|
|
|
| - protected:
|
| - // Create should be used instead.
|
| - TsfEventRouter();
|
| + private:
|
| + class TsfEventRouterDelegate;
|
| +
|
| + CComPtr<TsfEventRouterDelegate> delegate_;
|
| +
|
| + TsfEventRouterObserver* observer_;
|
|
|
| DISALLOW_COPY_AND_ASSIGN(TsfEventRouter);
|
| };
|
|
|