OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/base/ime/dummy_text_input_client.h" | 5 #include "ui/base/ime/dummy_text_input_client.h" |
6 #include "ui/events/event.h" | 6 #include "ui/events/event.h" |
7 #include "ui/gfx/geometry/rect.h" | 7 #include "ui/gfx/geometry/rect.h" |
8 | 8 |
9 namespace ui { | 9 namespace ui { |
10 | 10 |
11 DummyTextInputClient::DummyTextInputClient() | 11 DummyTextInputClient::DummyTextInputClient() |
12 : text_input_type_(TEXT_INPUT_TYPE_NONE), | 12 : text_input_type_(TEXT_INPUT_TYPE_NONE), insert_char_count_(0) {} |
13 insert_char_count_(0), | |
14 insert_text_count_(0), | |
15 set_composition_count_(0) {} | |
16 | 13 |
17 DummyTextInputClient::DummyTextInputClient(TextInputType text_input_type) | 14 DummyTextInputClient::DummyTextInputClient(TextInputType text_input_type) |
18 : text_input_type_(text_input_type), | 15 : text_input_type_(text_input_type), insert_char_count_(0) {} |
19 insert_char_count_(0), | |
20 insert_text_count_(0), | |
21 set_composition_count_(0) {} | |
22 | 16 |
23 DummyTextInputClient::~DummyTextInputClient() { | 17 DummyTextInputClient::~DummyTextInputClient() { |
24 } | 18 } |
25 | 19 |
26 void DummyTextInputClient::SetCompositionText( | 20 void DummyTextInputClient::SetCompositionText( |
27 const CompositionText& composition) { | 21 const CompositionText& composition) { |
28 ++set_composition_count_; | 22 composition_history_.push_back(composition); |
29 last_composition_.CopyFrom(composition); | |
30 } | 23 } |
31 | 24 |
32 void DummyTextInputClient::ConfirmCompositionText() { | 25 void DummyTextInputClient::ConfirmCompositionText() { |
33 } | 26 } |
34 | 27 |
35 void DummyTextInputClient::ClearCompositionText() { | 28 void DummyTextInputClient::ClearCompositionText() { |
| 29 SetCompositionText(CompositionText()); |
36 } | 30 } |
37 | 31 |
38 void DummyTextInputClient::InsertText(const base::string16& text) { | 32 void DummyTextInputClient::InsertText(const base::string16& text) { |
39 ++insert_text_count_; | 33 insert_text_history_.push_back(text); |
40 last_insert_text_ = text; | |
41 } | 34 } |
42 | 35 |
43 void DummyTextInputClient::InsertChar(const KeyEvent& event) { | 36 void DummyTextInputClient::InsertChar(const KeyEvent& event) { |
44 ++insert_char_count_; | 37 ++insert_char_count_; |
45 last_insert_char_ = event.GetCharacter(); | 38 last_insert_char_ = event.GetCharacter(); |
46 } | 39 } |
47 | 40 |
48 TextInputType DummyTextInputClient::GetTextInputType() const { | 41 TextInputType DummyTextInputClient::GetTextInputType() const { |
49 return text_input_type_; | 42 return text_input_type_; |
50 } | 43 } |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
120 | 113 |
121 bool DummyTextInputClient::IsTextEditCommandEnabled( | 114 bool DummyTextInputClient::IsTextEditCommandEnabled( |
122 TextEditCommand command) const { | 115 TextEditCommand command) const { |
123 return false; | 116 return false; |
124 } | 117 } |
125 | 118 |
126 void DummyTextInputClient::SetTextEditCommandForNextKeyEvent( | 119 void DummyTextInputClient::SetTextEditCommandForNextKeyEvent( |
127 TextEditCommand command) {} | 120 TextEditCommand command) {} |
128 | 121 |
129 } // namespace ui | 122 } // namespace ui |
OLD | NEW |