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

Side by Side Diff: views/ime/mock_input_method.cc

Issue 8491035: Revert 109583 - Move views/ime/text_input_client.h to ui/base/ime/. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 9 years, 1 month 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 | Annotate | Revision Log
« no previous file with comments | « views/ime/mock_input_method.h ('k') | views/ime/text_input_client.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "views/ime/mock_input_method.h" 5 #include "views/ime/mock_input_method.h"
6 6
7 #include "base/basictypes.h" 7 #include "base/basictypes.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "ui/base/ime/text_input_client.h"
10 #include "ui/base/keycodes/keyboard_codes.h" 9 #include "ui/base/keycodes/keyboard_codes.h"
11 #include "views/events/event.h" 10 #include "views/events/event.h"
12 #include "views/widget/widget.h" 11 #include "views/widget/widget.h"
13 12
14 namespace views { 13 namespace views {
15 14
16 MockInputMethod::MockInputMethod() 15 MockInputMethod::MockInputMethod()
17 : composition_changed_(false), 16 : composition_changed_(false),
18 focus_changed_(false), 17 focus_changed_(false),
19 text_input_type_changed_(false), 18 text_input_type_changed_(false),
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
51 if (handled) { 50 if (handled) {
52 KeyEvent mock_key(ui::ET_KEY_PRESSED, ui::VKEY_PROCESSKEY, key.flags()); 51 KeyEvent mock_key(ui::ET_KEY_PRESSED, ui::VKEY_PROCESSKEY, key.flags());
53 DispatchKeyEventPostIME(mock_key); 52 DispatchKeyEventPostIME(mock_key);
54 } else { 53 } else {
55 DispatchKeyEventPostIME(key); 54 DispatchKeyEventPostIME(key);
56 } 55 }
57 56
58 if (focus_changed_) 57 if (focus_changed_)
59 return; 58 return;
60 59
61 ui::TextInputClient* client = GetTextInputClient(); 60 TextInputClient* client = GetTextInputClient();
62 if (client) { 61 if (client) {
63 if (handled) { 62 if (handled) {
64 if (result_text_.length()) 63 if (result_text_.length())
65 client->InsertText(result_text_); 64 client->InsertText(result_text_);
66 if (composition_changed_) { 65 if (composition_changed_) {
67 if (composition_.text.length()) 66 if (composition_.text.length())
68 client->SetCompositionText(composition_); 67 client->SetCompositionText(composition_);
69 else 68 else
70 client->ClearCompositionText(); 69 client->ClearCompositionText();
71 } 70 }
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
106 105
107 bool MockInputMethod::IsActive() { 106 bool MockInputMethod::IsActive() {
108 return active_; 107 return active_;
109 } 108 }
110 109
111 bool MockInputMethod::IsMock() const { 110 bool MockInputMethod::IsMock() const {
112 return true; 111 return true;
113 } 112 }
114 113
115 void MockInputMethod::OnWillChangeFocus(View* focused_before, View* focused) { 114 void MockInputMethod::OnWillChangeFocus(View* focused_before, View* focused) {
116 ui::TextInputClient* client = GetTextInputClient(); 115 TextInputClient* client = GetTextInputClient();
117 if (client && client->HasCompositionText()) 116 if (client && client->HasCompositionText())
118 client->ConfirmCompositionText(); 117 client->ConfirmCompositionText();
119 focus_changed_ = true; 118 focus_changed_ = true;
120 ClearResult(); 119 ClearResult();
121 } 120 }
122 121
123 void MockInputMethod::Clear() { 122 void MockInputMethod::Clear() {
124 ClearStates(); 123 ClearStates();
125 ClearResult(); 124 ClearResult();
126 } 125 }
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
164 cancel_composition_called_ = false; 163 cancel_composition_called_ = false;
165 } 164 }
166 165
167 void MockInputMethod::ClearResult() { 166 void MockInputMethod::ClearResult() {
168 composition_.Clear(); 167 composition_.Clear();
169 composition_changed_ = false; 168 composition_changed_ = false;
170 result_text_.clear(); 169 result_text_.clear();
171 } 170 }
172 171
173 } // namespace views 172 } // namespace views
OLDNEW
« no previous file with comments | « views/ime/mock_input_method.h ('k') | views/ime/text_input_client.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698