Supervised user whitelists: Cleanup
[chromium-blink-merge.git] / ui / base / ime / mock_input_method.h
blob5d854820ecaf422fe332d8037eeccac1cb4585ef
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 #ifndef UI_BASE_IME_MOCK_INPUT_METHOD_H_
6 #define UI_BASE_IME_MOCK_INPUT_METHOD_H_
8 #include <string>
10 #include "base/basictypes.h"
11 #include "base/compiler_specific.h"
12 #include "base/observer_list.h"
13 #include "ui/base/ime/input_method.h"
14 #include "ui/base/ime/input_method_observer.h"
15 #include "ui/base/ime/ui_base_ime_export.h"
17 namespace ui {
19 class KeyEvent;
20 class TextInputClient;
22 // A mock ui::InputMethod implementation for testing. You can get the instance
23 // of this class as the global input method with calling
24 // SetUpInputMethodFactoryForTesting() which is declared in
25 // ui/base/ime/input_method_factory.h
26 class UI_BASE_IME_EXPORT MockInputMethod
27 : NON_EXPORTED_BASE(public InputMethod) {
28 public:
29 explicit MockInputMethod(internal::InputMethodDelegate* delegate);
30 ~MockInputMethod() override;
32 // Overriden from InputMethod.
33 void SetDelegate(internal::InputMethodDelegate* delegate) override;
34 void Init(bool focused) override;
35 void OnFocus() override;
36 void OnBlur() override;
37 bool OnUntranslatedIMEMessage(const base::NativeEvent& event,
38 NativeEventResult* result) override;
39 void SetFocusedTextInputClient(TextInputClient* client) override;
40 void DetachTextInputClient(TextInputClient* client) override;
41 TextInputClient* GetTextInputClient() const override;
42 bool DispatchKeyEvent(const ui::KeyEvent& event) override;
43 void OnTextInputTypeChanged(const TextInputClient* client) override;
44 void OnCaretBoundsChanged(const TextInputClient* client) override;
45 void CancelComposition(const TextInputClient* client) override;
46 void OnInputLocaleChanged() override;
47 std::string GetInputLocale() override;
48 bool IsActive() override;
49 TextInputType GetTextInputType() const override;
50 TextInputMode GetTextInputMode() const override;
51 int GetTextInputFlags() const override;
52 bool CanComposeInline() const override;
53 bool IsCandidatePopupOpen() const override;
54 void ShowImeIfNeeded() override;
55 void AddObserver(InputMethodObserver* observer) override;
56 void RemoveObserver(InputMethodObserver* observer) override;
58 private:
59 TextInputClient* text_input_client_;
60 ObserverList<InputMethodObserver> observer_list_;
62 DISALLOW_COPY_AND_ASSIGN(MockInputMethod);
65 } // namespace ui
67 #endif // UI_BASE_IME_MOCK_INPUT_METHOD_H_