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/views/controls/prefix_selector.h" | 5 #include "ui/views/controls/prefix_selector.h" |
6 | 6 |
7 #include "base/i18n/case_conversion.h" | 7 #include "base/i18n/case_conversion.h" |
8 #include "ui/base/ime/text_input_type.h" | 8 #include "ui/base/ime/text_input_type.h" |
9 #include "ui/gfx/range/range.h" | 9 #include "ui/gfx/range/range.h" |
10 #include "ui/views/controls/prefix_delegate.h" | 10 #include "ui/views/controls/prefix_delegate.h" |
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
147 void PrefixSelector::OnCandidateWindowHidden() { | 147 void PrefixSelector::OnCandidateWindowHidden() { |
148 } | 148 } |
149 | 149 |
150 bool PrefixSelector::IsEditingCommandEnabled(int command_id) { | 150 bool PrefixSelector::IsEditingCommandEnabled(int command_id) { |
151 return false; | 151 return false; |
152 } | 152 } |
153 | 153 |
154 void PrefixSelector::ExecuteEditingCommand(int command_id) { | 154 void PrefixSelector::ExecuteEditingCommand(int command_id) { |
155 } | 155 } |
156 | 156 |
| 157 bool PrefixSelector::HandleAsKeyEventOnly(const ui::KeyEvent& key_event) { |
| 158 return false; |
| 159 } |
| 160 |
157 void PrefixSelector::OnTextInput(const base::string16& text) { | 161 void PrefixSelector::OnTextInput(const base::string16& text) { |
158 // Small hack to filter out 'tab' and 'enter' input, as the expectation is | 162 // Small hack to filter out 'tab' and 'enter' input, as the expectation is |
159 // that they are control characters and will not affect the currently-active | 163 // that they are control characters and will not affect the currently-active |
160 // prefix. | 164 // prefix. |
161 if (text.length() == 1 && | 165 if (text.length() == 1 && |
162 (text[0] == L'\t' || text[0] == L'\r' || text[0] == L'\n')) | 166 (text[0] == L'\t' || text[0] == L'\r' || text[0] == L'\n')) |
163 return; | 167 return; |
164 | 168 |
165 const int row_count = prefix_delegate_->GetRowCount(); | 169 const int row_count = prefix_delegate_->GetRowCount(); |
166 if (row_count == 0) | 170 if (row_count == 0) |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
199 return (model_text.size() >= lower_text.size()) && | 203 return (model_text.size() >= lower_text.size()) && |
200 (model_text.compare(0, lower_text.size(), lower_text) == 0); | 204 (model_text.compare(0, lower_text.size(), lower_text) == 0); |
201 } | 205 } |
202 | 206 |
203 void PrefixSelector::ClearText() { | 207 void PrefixSelector::ClearText() { |
204 current_text_.clear(); | 208 current_text_.clear(); |
205 time_of_last_key_ = base::TimeTicks(); | 209 time_of_last_key_ = base::TimeTicks(); |
206 } | 210 } |
207 | 211 |
208 } // namespace views | 212 } // namespace views |
OLD | NEW |