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 3// found in the LICENSE file. 4 5#ifndef BASE_WIN_TEXT_SERVICES_MESSAGE_FILTER_H_ 6#define BASE_WIN_TEXT_SERVICES_MESSAGE_FILTER_H_ 7 8#include <msctf.h> 9#include <Windows.h> 10 11#include "base/memory/scoped_ptr.h" 12#include "base/message_loop/message_pump_win.h" 13#include "base/win/metro.h" 14#include "base/win/scoped_comptr.h" 15 16namespace base { 17namespace win { 18 19// TextServicesMessageFilter extends MessageFilter with methods that are using 20// Text Services Framework COM component. 21class BASE_EXPORT TextServicesMessageFilter 22 : public base::MessagePumpForUI::MessageFilter { 23 public: 24 TextServicesMessageFilter(); 25 virtual ~TextServicesMessageFilter(); 26 virtual BOOL DoPeekMessage(MSG* msg, 27 HWND window_handle, 28 UINT msg_filter_min, 29 UINT msg_filter_max, 30 UINT remove_msg) OVERRIDE; 31 virtual bool ProcessMessage(const MSG& msg) OVERRIDE; 32 33 bool Init(); 34 35 private: 36 TfClientId client_id_; 37 bool is_initialized_; 38 base::win::ScopedComPtr<ITfThreadMgr> thread_mgr_; 39 base::win::ScopedComPtr<ITfMessagePump> message_pump_; 40 base::win::ScopedComPtr<ITfKeystrokeMgr> keystroke_mgr_; 41 42 DISALLOW_COPY_AND_ASSIGN(TextServicesMessageFilter); 43}; 44 45} // namespace win 46} // namespace base 47 48#endif // BASE_WIN_TEXT_SERVICES_MESSAGE_FILTER_H_ 49