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

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

Issue 8509034: Move views/ime/text_input_client.h to ui/base/ime/. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: more win_shared fix 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"
9 #include "ui/base/keycodes/keyboard_codes.h" 10 #include "ui/base/keycodes/keyboard_codes.h"
10 #include "views/events/event.h" 11 #include "views/events/event.h"
11 #include "views/widget/widget.h" 12 #include "views/widget/widget.h"
12 13
13 namespace views { 14 namespace views {
14 15
15 MockInputMethod::MockInputMethod() 16 MockInputMethod::MockInputMethod()
16 : composition_changed_(false), 17 : composition_changed_(false),
17 focus_changed_(false), 18 focus_changed_(false),
18 text_input_type_changed_(false), 19 text_input_type_changed_(false),
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
50 if (handled) { 51 if (handled) {
51 KeyEvent mock_key(ui::ET_KEY_PRESSED, ui::VKEY_PROCESSKEY, key.flags()); 52 KeyEvent mock_key(ui::ET_KEY_PRESSED, ui::VKEY_PROCESSKEY, key.flags());
52 DispatchKeyEventPostIME(mock_key); 53 DispatchKeyEventPostIME(mock_key);
53 } else { 54 } else {
54 DispatchKeyEventPostIME(key); 55 DispatchKeyEventPostIME(key);
55 } 56 }
56 57
57 if (focus_changed_) 58 if (focus_changed_)
58 return; 59 return;
59 60
60 TextInputClient* client = GetTextInputClient(); 61 ui::TextInputClient* client = GetTextInputClient();
61 if (client) { 62 if (client) {
62 if (handled) { 63 if (handled) {
63 if (result_text_.length()) 64 if (result_text_.length())
64 client->InsertText(result_text_); 65 client->InsertText(result_text_);
65 if (composition_changed_) { 66 if (composition_changed_) {
66 if (composition_.text.length()) 67 if (composition_.text.length())
67 client->SetCompositionText(composition_); 68 client->SetCompositionText(composition_);
68 else 69 else
69 client->ClearCompositionText(); 70 client->ClearCompositionText();
70 } 71 }
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
105 106
106 bool MockInputMethod::IsActive() { 107 bool MockInputMethod::IsActive() {
107 return active_; 108 return active_;
108 } 109 }
109 110
110 bool MockInputMethod::IsMock() const { 111 bool MockInputMethod::IsMock() const {
111 return true; 112 return true;
112 } 113 }
113 114
114 void MockInputMethod::OnWillChangeFocus(View* focused_before, View* focused) { 115 void MockInputMethod::OnWillChangeFocus(View* focused_before, View* focused) {
115 TextInputClient* client = GetTextInputClient(); 116 ui::TextInputClient* client = GetTextInputClient();
116 if (client && client->HasCompositionText()) 117 if (client && client->HasCompositionText())
117 client->ConfirmCompositionText(); 118 client->ConfirmCompositionText();
118 focus_changed_ = true; 119 focus_changed_ = true;
119 ClearResult(); 120 ClearResult();
120 } 121 }
121 122
122 void MockInputMethod::Clear() { 123 void MockInputMethod::Clear() {
123 ClearStates(); 124 ClearStates();
124 ClearResult(); 125 ClearResult();
125 } 126 }
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
163 cancel_composition_called_ = false; 164 cancel_composition_called_ = false;
164 } 165 }
165 166
166 void MockInputMethod::ClearResult() { 167 void MockInputMethod::ClearResult() {
167 composition_.Clear(); 168 composition_.Clear();
168 composition_changed_ = false; 169 composition_changed_ = false;
169 result_text_.clear(); 170 result_text_.clear();
170 } 171 }
171 172
172 } // namespace views 173 } // 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