mock_input_method.cc revision 2a99a7e74a7f215066514fe81d2bfa6639d9eddd
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#include "ui/base/ime/mock_input_method.h" 6 7namespace ui { 8 9MockInputMethod::MockInputMethod(internal::InputMethodDelegate* delegate) 10 : text_input_client_(NULL) { 11} 12 13MockInputMethod::~MockInputMethod() { 14} 15 16void MockInputMethod::SetDelegate(internal::InputMethodDelegate* delegate) { 17} 18 19void MockInputMethod::SetFocusedTextInputClient(TextInputClient* client) { 20 text_input_client_ = client; 21} 22 23TextInputClient* MockInputMethod::GetTextInputClient() const { 24 return text_input_client_; 25} 26 27bool MockInputMethod::DispatchKeyEvent(const base::NativeEvent& native_event) { 28 return false; 29} 30 31bool MockInputMethod::DispatchFabricatedKeyEvent(const ui::KeyEvent& event) { 32 return false; 33} 34 35void MockInputMethod::Init(bool focused) { 36} 37 38void MockInputMethod::OnFocus() { 39 FOR_EACH_OBSERVER(Observer, observer_list_, OnFocus()); 40} 41 42void MockInputMethod::OnBlur() { 43 FOR_EACH_OBSERVER(Observer, observer_list_, OnBlur()); 44} 45 46void MockInputMethod::OnTextInputTypeChanged(const TextInputClient* client) { 47 FOR_EACH_OBSERVER(Observer, observer_list_, OnTextInputTypeChanged(client)); 48} 49 50void MockInputMethod::OnCaretBoundsChanged(const TextInputClient* client) { 51 FOR_EACH_OBSERVER(Observer, observer_list_, OnCaretBoundsChanged(client)); 52} 53 54void MockInputMethod::CancelComposition(const TextInputClient* client) { 55} 56 57std::string MockInputMethod::GetInputLocale() { 58 return ""; 59} 60 61base::i18n::TextDirection MockInputMethod::GetInputTextDirection() { 62 return base::i18n::UNKNOWN_DIRECTION; 63} 64 65bool MockInputMethod::IsActive() { 66 return true; 67} 68 69ui::TextInputType MockInputMethod::GetTextInputType() const { 70 return ui::TEXT_INPUT_TYPE_NONE; 71} 72 73bool MockInputMethod::CanComposeInline() const { 74 return true; 75} 76 77void MockInputMethod::AddObserver(Observer* observer) { 78 observer_list_.AddObserver(observer); 79} 80 81void MockInputMethod::RemoveObserver(Observer* observer) { 82 observer_list_.RemoveObserver(observer); 83} 84 85} // namespace ui 86