11e9bf3e0803691d0a228da41fc608347b6db4340Torne (Richard Coles)// Copyright 2013 The Chromium Authors. All rights reserved. 21e9bf3e0803691d0a228da41fc608347b6db4340Torne (Richard Coles)// Use of this source code is governed by a BSD-style license that can be 31e9bf3e0803691d0a228da41fc608347b6db4340Torne (Richard Coles)// found in the LICENSE file. 41e9bf3e0803691d0a228da41fc608347b6db4340Torne (Richard Coles) 5a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)#ifndef UI_BASE_IME_INPUT_METHOD_AURALINUX_H_ 6a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)#define UI_BASE_IME_INPUT_METHOD_AURALINUX_H_ 71e9bf3e0803691d0a228da41fc608347b6db4340Torne (Richard Coles) 81e9bf3e0803691d0a228da41fc608347b6db4340Torne (Richard Coles)#include "base/memory/scoped_ptr.h" 91e9bf3e0803691d0a228da41fc608347b6db4340Torne (Richard Coles)#include "ui/base/ime/input_method_base.h" 101e9bf3e0803691d0a228da41fc608347b6db4340Torne (Richard Coles)#include "ui/base/ime/linux/linux_input_method_context.h" 111e9bf3e0803691d0a228da41fc608347b6db4340Torne (Richard Coles) 121e9bf3e0803691d0a228da41fc608347b6db4340Torne (Richard Coles)namespace ui { 131e9bf3e0803691d0a228da41fc608347b6db4340Torne (Richard Coles) 14a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)// A ui::InputMethod implementation for Aura on Linux platforms. The 15a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)// implementation details are separated to ui::LinuxInputMethodContext 16a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)// interface. 17a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)class InputMethodAuraLinux : public InputMethodBase, 18a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles) public LinuxInputMethodContextDelegate { 191e9bf3e0803691d0a228da41fc608347b6db4340Torne (Richard Coles) public: 20a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles) explicit InputMethodAuraLinux(internal::InputMethodDelegate* delegate); 21a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles) virtual ~InputMethodAuraLinux(); 221e9bf3e0803691d0a228da41fc608347b6db4340Torne (Richard Coles) 23f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles) // Initializes input methods. This function must be called once prior to 24f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles) // any use of this instance. This function is supposed to be called from 25f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles) // ui::InitializeInputMethod(). 26f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles) static void Initialize(); 27f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles) 281e9bf3e0803691d0a228da41fc608347b6db4340Torne (Richard Coles) // Overriden from InputMethod. 291e9bf3e0803691d0a228da41fc608347b6db4340Torne (Richard Coles) virtual void Init(bool focused) OVERRIDE; 301e9bf3e0803691d0a228da41fc608347b6db4340Torne (Richard Coles) virtual bool OnUntranslatedIMEMessage(const base::NativeEvent& event, 311e9bf3e0803691d0a228da41fc608347b6db4340Torne (Richard Coles) NativeEventResult* result) OVERRIDE; 32f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles) virtual bool DispatchKeyEvent(const ui::KeyEvent& event) OVERRIDE; 331e9bf3e0803691d0a228da41fc608347b6db4340Torne (Richard Coles) virtual void OnTextInputTypeChanged(const TextInputClient* client) OVERRIDE; 341e9bf3e0803691d0a228da41fc608347b6db4340Torne (Richard Coles) virtual void OnCaretBoundsChanged(const TextInputClient* client) OVERRIDE; 351e9bf3e0803691d0a228da41fc608347b6db4340Torne (Richard Coles) virtual void CancelComposition(const TextInputClient* client) OVERRIDE; 361e9bf3e0803691d0a228da41fc608347b6db4340Torne (Richard Coles) virtual void OnInputLocaleChanged() OVERRIDE; 371e9bf3e0803691d0a228da41fc608347b6db4340Torne (Richard Coles) virtual std::string GetInputLocale() OVERRIDE; 381e9bf3e0803691d0a228da41fc608347b6db4340Torne (Richard Coles) virtual base::i18n::TextDirection GetInputTextDirection() OVERRIDE; 391e9bf3e0803691d0a228da41fc608347b6db4340Torne (Richard Coles) virtual bool IsActive() OVERRIDE; 401e9bf3e0803691d0a228da41fc608347b6db4340Torne (Richard Coles) virtual bool IsCandidatePopupOpen() const OVERRIDE; 411e9bf3e0803691d0a228da41fc608347b6db4340Torne (Richard Coles) 421e9bf3e0803691d0a228da41fc608347b6db4340Torne (Richard Coles) // Overriden from ui::LinuxInputMethodContextDelegate 431e9bf3e0803691d0a228da41fc608347b6db4340Torne (Richard Coles) virtual void OnCommit(const base::string16& text) OVERRIDE; 441e9bf3e0803691d0a228da41fc608347b6db4340Torne (Richard Coles) virtual void OnPreeditChanged(const CompositionText& composition_text) 451e9bf3e0803691d0a228da41fc608347b6db4340Torne (Richard Coles) OVERRIDE; 461e9bf3e0803691d0a228da41fc608347b6db4340Torne (Richard Coles) virtual void OnPreeditEnd() OVERRIDE; 471e9bf3e0803691d0a228da41fc608347b6db4340Torne (Richard Coles) virtual void OnPreeditStart() OVERRIDE; 481e9bf3e0803691d0a228da41fc608347b6db4340Torne (Richard Coles) 491e9bf3e0803691d0a228da41fc608347b6db4340Torne (Richard Coles) protected: 501e9bf3e0803691d0a228da41fc608347b6db4340Torne (Richard Coles) // Overridden from InputMethodBase. 511e9bf3e0803691d0a228da41fc608347b6db4340Torne (Richard Coles) virtual void OnDidChangeFocusedClient(TextInputClient* focused_before, 521e9bf3e0803691d0a228da41fc608347b6db4340Torne (Richard Coles) TextInputClient* focused) OVERRIDE; 531e9bf3e0803691d0a228da41fc608347b6db4340Torne (Richard Coles) 541e9bf3e0803691d0a228da41fc608347b6db4340Torne (Richard Coles) scoped_ptr<LinuxInputMethodContext> input_method_context_; 551e9bf3e0803691d0a228da41fc608347b6db4340Torne (Richard Coles) 56a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles) DISALLOW_COPY_AND_ASSIGN(InputMethodAuraLinux); 571e9bf3e0803691d0a228da41fc608347b6db4340Torne (Richard Coles)}; 581e9bf3e0803691d0a228da41fc608347b6db4340Torne (Richard Coles) 591e9bf3e0803691d0a228da41fc608347b6db4340Torne (Richard Coles)} // namespace ui 601e9bf3e0803691d0a228da41fc608347b6db4340Torne (Richard Coles) 61a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)#endif // UI_BASE_IME_INPUT_METHOD_AURALINUX_H_ 62