Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(338)

Side by Side Diff: ui/base/ime/mock_input_method.cc

Issue 851853002: It is time. (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Trying to reup because the last upload failed. Created 5 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « ui/base/ime/mock_input_method.h ('k') | ui/base/ime/remote_input_method_delegate_win.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
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
7 #include "ui/base/ime/text_input_focus_manager.h"
8 #include "ui/base/ui_base_switches_util.h"
9
10 namespace ui {
11
12 MockInputMethod::MockInputMethod(internal::InputMethodDelegate* delegate)
13 : text_input_client_(NULL) {
14 }
15
16 MockInputMethod::~MockInputMethod() {
17 }
18
19 void MockInputMethod::SetDelegate(internal::InputMethodDelegate* delegate) {
20 }
21
22 void MockInputMethod::SetFocusedTextInputClient(TextInputClient* client) {
23 if (switches::IsTextInputFocusManagerEnabled())
24 return;
25
26 if (text_input_client_ == client)
27 return;
28 text_input_client_ = client;
29 if (client)
30 OnTextInputTypeChanged(client);
31 }
32
33 void MockInputMethod::DetachTextInputClient(TextInputClient* client) {
34 if (text_input_client_ == client) {
35 text_input_client_ = NULL;
36 }
37 }
38
39 TextInputClient* MockInputMethod::GetTextInputClient() const {
40 if (switches::IsTextInputFocusManagerEnabled())
41 return TextInputFocusManager::GetInstance()->GetFocusedTextInputClient();
42
43 return text_input_client_;
44 }
45
46 bool MockInputMethod::DispatchKeyEvent(const ui::KeyEvent& event) {
47 return false;
48 }
49
50 void MockInputMethod::Init(bool focused) {
51 }
52
53 void MockInputMethod::OnFocus() {
54 FOR_EACH_OBSERVER(InputMethodObserver, observer_list_, OnFocus());
55 }
56
57 void MockInputMethod::OnBlur() {
58 FOR_EACH_OBSERVER(InputMethodObserver, observer_list_, OnBlur());
59 }
60
61 bool MockInputMethod::OnUntranslatedIMEMessage(const base::NativeEvent& event,
62 NativeEventResult* result) {
63 if (result)
64 *result = NativeEventResult();
65 return false;
66 }
67
68 void MockInputMethod::OnTextInputTypeChanged(const TextInputClient* client) {
69 FOR_EACH_OBSERVER(InputMethodObserver,
70 observer_list_,
71 OnTextInputTypeChanged(client));
72 FOR_EACH_OBSERVER(InputMethodObserver,
73 observer_list_,
74 OnTextInputStateChanged(client));
75 }
76
77 void MockInputMethod::OnCaretBoundsChanged(const TextInputClient* client) {
78 FOR_EACH_OBSERVER(InputMethodObserver,
79 observer_list_,
80 OnCaretBoundsChanged(client));
81 }
82
83 void MockInputMethod::CancelComposition(const TextInputClient* client) {
84 }
85
86 void MockInputMethod::OnInputLocaleChanged() {
87 }
88
89 std::string MockInputMethod::GetInputLocale() {
90 return "";
91 }
92
93 bool MockInputMethod::IsActive() {
94 return true;
95 }
96
97 TextInputType MockInputMethod::GetTextInputType() const {
98 return TEXT_INPUT_TYPE_NONE;
99 }
100
101 TextInputMode MockInputMethod::GetTextInputMode() const {
102 return TEXT_INPUT_MODE_DEFAULT;
103 }
104
105 bool MockInputMethod::CanComposeInline() const {
106 return true;
107 }
108
109 bool MockInputMethod::IsCandidatePopupOpen() const {
110 return false;
111 }
112
113 void MockInputMethod::ShowImeIfNeeded() {
114 FOR_EACH_OBSERVER(InputMethodObserver, observer_list_, OnShowImeIfNeeded());
115 }
116
117 void MockInputMethod::AddObserver(InputMethodObserver* observer) {
118 observer_list_.AddObserver(observer);
119 }
120
121 void MockInputMethod::RemoveObserver(InputMethodObserver* observer) {
122 observer_list_.RemoveObserver(observer);
123 }
124
125 } // namespace ui
OLDNEW
« no previous file with comments | « ui/base/ime/mock_input_method.h ('k') | ui/base/ime/remote_input_method_delegate_win.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698