clang/win: Add remaining tracking bugs for -Wno flags.
[chromium-blink-merge.git] / ui / base / ime / mock_input_method.cc
blob046942ab3c3a73e931dca68a9e901fea163824f7
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 #include "ui/base/ime/input_method_delegate.h"
8 #include "ui/events/event.h"
10 namespace ui {
12 MockInputMethod::MockInputMethod(internal::InputMethodDelegate* delegate)
13 : text_input_client_(NULL), delegate_(delegate) {
16 MockInputMethod::~MockInputMethod() {
17 FOR_EACH_OBSERVER(InputMethodObserver, observer_list_,
18 OnInputMethodDestroyed(this));
21 void MockInputMethod::SetDelegate(internal::InputMethodDelegate* delegate) {
22 delegate_ = delegate;
25 void MockInputMethod::SetFocusedTextInputClient(TextInputClient* client) {
26 if (text_input_client_ == client)
27 return;
28 text_input_client_ = client;
29 if (client)
30 OnTextInputTypeChanged(client);
33 void MockInputMethod::DetachTextInputClient(TextInputClient* client) {
34 if (text_input_client_ == client) {
35 text_input_client_ = NULL;
39 TextInputClient* MockInputMethod::GetTextInputClient() const {
40 return text_input_client_;
43 bool MockInputMethod::DispatchKeyEvent(const ui::KeyEvent& event) {
44 return delegate_->DispatchKeyEventPostIME(event);
47 void MockInputMethod::OnFocus() {
48 FOR_EACH_OBSERVER(InputMethodObserver, observer_list_, OnFocus());
51 void MockInputMethod::OnBlur() {
52 FOR_EACH_OBSERVER(InputMethodObserver, observer_list_, OnBlur());
55 bool MockInputMethod::OnUntranslatedIMEMessage(const base::NativeEvent& event,
56 NativeEventResult* result) {
57 if (result)
58 *result = NativeEventResult();
59 return false;
62 void MockInputMethod::OnTextInputTypeChanged(const TextInputClient* client) {
63 FOR_EACH_OBSERVER(InputMethodObserver,
64 observer_list_,
65 OnTextInputTypeChanged(client));
66 FOR_EACH_OBSERVER(InputMethodObserver,
67 observer_list_,
68 OnTextInputStateChanged(client));
71 void MockInputMethod::OnCaretBoundsChanged(const TextInputClient* client) {
72 FOR_EACH_OBSERVER(InputMethodObserver,
73 observer_list_,
74 OnCaretBoundsChanged(client));
77 void MockInputMethod::CancelComposition(const TextInputClient* client) {
80 void MockInputMethod::OnInputLocaleChanged() {
83 std::string MockInputMethod::GetInputLocale() {
84 return "";
87 bool MockInputMethod::IsActive() {
88 return true;
91 TextInputType MockInputMethod::GetTextInputType() const {
92 return TEXT_INPUT_TYPE_NONE;
95 TextInputMode MockInputMethod::GetTextInputMode() const {
96 return TEXT_INPUT_MODE_DEFAULT;
99 int MockInputMethod::GetTextInputFlags() const {
100 return 0;
103 bool MockInputMethod::CanComposeInline() const {
104 return true;
107 bool MockInputMethod::IsCandidatePopupOpen() const {
108 return false;
111 void MockInputMethod::ShowImeIfNeeded() {
112 FOR_EACH_OBSERVER(InputMethodObserver, observer_list_, OnShowImeIfNeeded());
115 void MockInputMethod::AddObserver(InputMethodObserver* observer) {
116 observer_list_.AddObserver(observer);
119 void MockInputMethod::RemoveObserver(InputMethodObserver* observer) {
120 observer_list_.RemoveObserver(observer);
123 } // namespace ui