Cast: Stop logging kVideoFrameSentToEncoder and rename a couple events.
[chromium-blink-merge.git] / ui / base / ime / mock_input_method.cc
blob0aa2005cb1d893d26ee29a84796158cc911265f8
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.
5 #include "ui/base/ime/mock_input_method.h"
7 namespace ui {
9 MockInputMethod::MockInputMethod(internal::InputMethodDelegate* delegate)
10 : text_input_client_(NULL) {
13 MockInputMethod::~MockInputMethod() {
16 void MockInputMethod::SetDelegate(internal::InputMethodDelegate* delegate) {
19 void MockInputMethod::SetFocusedTextInputClient(TextInputClient* client) {
20 if (text_input_client_ == client)
21 return;
22 text_input_client_ = client;
23 if (client)
24 OnTextInputTypeChanged(client);
27 void MockInputMethod::DetachTextInputClient(TextInputClient* client) {
28 if (text_input_client_ == client) {
29 text_input_client_ = NULL;
33 TextInputClient* MockInputMethod::GetTextInputClient() const {
34 return text_input_client_;
37 bool MockInputMethod::DispatchKeyEvent(const ui::KeyEvent& event) {
38 return false;
41 void MockInputMethod::Init(bool focused) {
44 void MockInputMethod::OnFocus() {
45 FOR_EACH_OBSERVER(InputMethodObserver, observer_list_, OnFocus());
48 void MockInputMethod::OnBlur() {
49 FOR_EACH_OBSERVER(InputMethodObserver, observer_list_, OnBlur());
52 bool MockInputMethod::OnUntranslatedIMEMessage(const base::NativeEvent& event,
53 NativeEventResult* result) {
54 if (result)
55 *result = NativeEventResult();
56 return false;
59 void MockInputMethod::OnTextInputTypeChanged(const TextInputClient* client) {
60 FOR_EACH_OBSERVER(InputMethodObserver,
61 observer_list_,
62 OnTextInputTypeChanged(client));
63 FOR_EACH_OBSERVER(InputMethodObserver,
64 observer_list_,
65 OnTextInputStateChanged(client));
68 void MockInputMethod::OnCaretBoundsChanged(const TextInputClient* client) {
69 FOR_EACH_OBSERVER(InputMethodObserver,
70 observer_list_,
71 OnCaretBoundsChanged(client));
74 void MockInputMethod::CancelComposition(const TextInputClient* client) {
77 void MockInputMethod::OnInputLocaleChanged() {
80 std::string MockInputMethod::GetInputLocale() {
81 return "";
84 bool MockInputMethod::IsActive() {
85 return true;
88 TextInputType MockInputMethod::GetTextInputType() const {
89 return TEXT_INPUT_TYPE_NONE;
92 TextInputMode MockInputMethod::GetTextInputMode() const {
93 return TEXT_INPUT_MODE_DEFAULT;
96 bool MockInputMethod::CanComposeInline() const {
97 return true;
100 bool MockInputMethod::IsCandidatePopupOpen() const {
101 return false;
104 void MockInputMethod::ShowImeIfNeeded() {
105 FOR_EACH_OBSERVER(InputMethodObserver, observer_list_, OnShowImeIfNeeded());
108 void MockInputMethod::AddObserver(InputMethodObserver* observer) {
109 observer_list_.AddObserver(observer);
112 void MockInputMethod::RemoveObserver(InputMethodObserver* observer) {
113 observer_list_.RemoveObserver(observer);
116 } // namespace ui