| OLD | NEW |
| 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 "ui/views/ime/mock_input_method.h" | 5 #include "ui/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/ime/text_input_client.h" |
| 10 #include "ui/events/event.h" | 10 #include "ui/events/event.h" |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 81 if (handled) { | 81 if (handled) { |
| 82 if (result_text_.length()) | 82 if (result_text_.length()) |
| 83 client->InsertText(result_text_); | 83 client->InsertText(result_text_); |
| 84 if (composition_changed_) { | 84 if (composition_changed_) { |
| 85 if (composition_.text.length()) | 85 if (composition_.text.length()) |
| 86 client->SetCompositionText(composition_); | 86 client->SetCompositionText(composition_); |
| 87 else | 87 else |
| 88 client->ClearCompositionText(); | 88 client->ClearCompositionText(); |
| 89 } | 89 } |
| 90 } else if (key.type() == ui::ET_KEY_PRESSED) { | 90 } else if (key.type() == ui::ET_KEY_PRESSED) { |
| 91 char16 ch = key.GetCharacter(); | 91 base::char16 ch = key.GetCharacter(); |
| 92 client->InsertChar(ch, key.flags()); | 92 client->InsertChar(ch, key.flags()); |
| 93 } | 93 } |
| 94 } | 94 } |
| 95 | 95 |
| 96 ClearResult(); | 96 ClearResult(); |
| 97 } | 97 } |
| 98 | 98 |
| 99 void MockInputMethod::OnTextInputTypeChanged(View* view) { | 99 void MockInputMethod::OnTextInputTypeChanged(View* view) { |
| 100 if (IsViewFocused(view)) | 100 if (IsViewFocused(view)) |
| 101 text_input_type_changed_ = true; | 101 text_input_type_changed_ = true; |
| (...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 180 input_locale_changed_ = false; | 180 input_locale_changed_ = false; |
| 181 } | 181 } |
| 182 | 182 |
| 183 void MockInputMethod::ClearResult() { | 183 void MockInputMethod::ClearResult() { |
| 184 composition_.Clear(); | 184 composition_.Clear(); |
| 185 composition_changed_ = false; | 185 composition_changed_ = false; |
| 186 result_text_.clear(); | 186 result_text_.clear(); |
| 187 } | 187 } |
| 188 | 188 |
| 189 } // namespace views | 189 } // namespace views |
| OLD | NEW |