| 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/input_method.h" | 8 #include "ui/base/ime/input_method.h" |
| 9 #include "ui/base/ime/text_input_type.h" | 9 #include "ui/base/ime/text_input_type.h" |
| 10 #include "ui/gfx/range/range.h" | 10 #include "ui/gfx/range/range.h" |
| (...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 132 base::i18n::TextDirection direction) { | 132 base::i18n::TextDirection direction) { |
| 133 return true; | 133 return true; |
| 134 } | 134 } |
| 135 | 135 |
| 136 void PrefixSelector::ExtendSelectionAndDelete(size_t before, size_t after) { | 136 void PrefixSelector::ExtendSelectionAndDelete(size_t before, size_t after) { |
| 137 } | 137 } |
| 138 | 138 |
| 139 void PrefixSelector::EnsureCaretInRect(const gfx::Rect& rect) { | 139 void PrefixSelector::EnsureCaretInRect(const gfx::Rect& rect) { |
| 140 } | 140 } |
| 141 | 141 |
| 142 bool PrefixSelector::IsEditCommandEnabled(int command_id) const { | 142 bool PrefixSelector::IsTextEditCommandEnabled( |
| 143 ui::TextEditCommand command) const { |
| 143 return false; | 144 return false; |
| 144 } | 145 } |
| 145 | 146 |
| 146 void PrefixSelector::SetEditCommandForNextKeyEvent(int command_id) { | 147 void PrefixSelector::SetTextEditCommandForNextKeyEvent( |
| 147 } | 148 ui::TextEditCommand command) {} |
| 148 | 149 |
| 149 void PrefixSelector::OnTextInput(const base::string16& text) { | 150 void PrefixSelector::OnTextInput(const base::string16& text) { |
| 150 // Small hack to filter out 'tab' and 'enter' input, as the expectation is | 151 // Small hack to filter out 'tab' and 'enter' input, as the expectation is |
| 151 // that they are control characters and will not affect the currently-active | 152 // that they are control characters and will not affect the currently-active |
| 152 // prefix. | 153 // prefix. |
| 153 if (text.length() == 1 && | 154 if (text.length() == 1 && |
| 154 (text[0] == L'\t' || text[0] == L'\r' || text[0] == L'\n')) | 155 (text[0] == L'\t' || text[0] == L'\r' || text[0] == L'\n')) |
| 155 return; | 156 return; |
| 156 | 157 |
| 157 const int row_count = prefix_delegate_->GetRowCount(); | 158 const int row_count = prefix_delegate_->GetRowCount(); |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 191 return (model_text.size() >= lower_text.size()) && | 192 return (model_text.size() >= lower_text.size()) && |
| 192 (model_text.compare(0, lower_text.size(), lower_text) == 0); | 193 (model_text.compare(0, lower_text.size(), lower_text) == 0); |
| 193 } | 194 } |
| 194 | 195 |
| 195 void PrefixSelector::ClearText() { | 196 void PrefixSelector::ClearText() { |
| 196 current_text_.clear(); | 197 current_text_.clear(); |
| 197 time_of_last_key_ = base::TimeTicks(); | 198 time_of_last_key_ = base::TimeTicks(); |
| 198 } | 199 } |
| 199 | 200 |
| 200 } // namespace views | 201 } // namespace views |
| OLD | NEW |