| 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/base/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" |
| 11 #include "ui/views/widget/widget.h" | 11 #include "ui/views/widget/widget.h" |
| 12 | 12 |
| 13 namespace views { | 13 namespace views { |
| 14 | 14 |
| 15 namespace { | 15 namespace { |
| 16 | 16 |
| 17 const int64 kTimeBeforeClearingMS = 1000; | 17 const int64 kTimeBeforeClearingMS = 1000; |
| 18 | 18 |
| 19 void ConvertRectToScreen(const views::View* src, gfx::Rect* r) { | 19 void ConvertRectToScreen(const views::View* src, gfx::Rect* r) { |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 84 // TextInputClient::GetCompositionCharacterBounds is expected to fill |rect| | 84 // TextInputClient::GetCompositionCharacterBounds is expected to fill |rect| |
| 85 // in screen coordinates and GetCaretBounds returns screen coordinates. | 85 // in screen coordinates and GetCaretBounds returns screen coordinates. |
| 86 *rect = GetCaretBounds(); | 86 *rect = GetCaretBounds(); |
| 87 return false; | 87 return false; |
| 88 } | 88 } |
| 89 | 89 |
| 90 bool PrefixSelector::HasCompositionText() { | 90 bool PrefixSelector::HasCompositionText() { |
| 91 return false; | 91 return false; |
| 92 } | 92 } |
| 93 | 93 |
| 94 bool PrefixSelector::GetTextRange(ui::Range* range) { | 94 bool PrefixSelector::GetTextRange(gfx::Range* range) { |
| 95 *range = ui::Range(); | 95 *range = gfx::Range(); |
| 96 return false; | 96 return false; |
| 97 } | 97 } |
| 98 | 98 |
| 99 bool PrefixSelector::GetCompositionTextRange(ui::Range* range) { | 99 bool PrefixSelector::GetCompositionTextRange(gfx::Range* range) { |
| 100 *range = ui::Range(); | 100 *range = gfx::Range(); |
| 101 return false; | 101 return false; |
| 102 } | 102 } |
| 103 | 103 |
| 104 bool PrefixSelector::GetSelectionRange(ui::Range* range) { | 104 bool PrefixSelector::GetSelectionRange(gfx::Range* range) { |
| 105 *range = ui::Range(); | 105 *range = gfx::Range(); |
| 106 return false; | 106 return false; |
| 107 } | 107 } |
| 108 | 108 |
| 109 bool PrefixSelector::SetSelectionRange(const ui::Range& range) { | 109 bool PrefixSelector::SetSelectionRange(const gfx::Range& range) { |
| 110 return false; | 110 return false; |
| 111 } | 111 } |
| 112 | 112 |
| 113 bool PrefixSelector::DeleteRange(const ui::Range& range) { | 113 bool PrefixSelector::DeleteRange(const gfx::Range& range) { |
| 114 return false; | 114 return false; |
| 115 } | 115 } |
| 116 | 116 |
| 117 bool PrefixSelector::GetTextFromRange(const ui::Range& range, | 117 bool PrefixSelector::GetTextFromRange(const gfx::Range& range, |
| 118 string16* text) { | 118 string16* text) { |
| 119 return false; | 119 return false; |
| 120 } | 120 } |
| 121 | 121 |
| 122 void PrefixSelector::OnInputMethodChanged() { | 122 void PrefixSelector::OnInputMethodChanged() { |
| 123 ClearText(); | 123 ClearText(); |
| 124 } | 124 } |
| 125 | 125 |
| 126 bool PrefixSelector::ChangeTextDirectionAndLayoutAlignment( | 126 bool PrefixSelector::ChangeTextDirectionAndLayoutAlignment( |
| 127 base::i18n::TextDirection direction) { | 127 base::i18n::TextDirection direction) { |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 177 return (model_text.size() >= lower_text.size()) && | 177 return (model_text.size() >= lower_text.size()) && |
| 178 (model_text.compare(0, lower_text.size(), lower_text) == 0); | 178 (model_text.compare(0, lower_text.size(), lower_text) == 0); |
| 179 } | 179 } |
| 180 | 180 |
| 181 void PrefixSelector::ClearText() { | 181 void PrefixSelector::ClearText() { |
| 182 current_text_.clear(); | 182 current_text_.clear(); |
| 183 time_of_last_key_ = base::TimeTicks(); | 183 time_of_last_key_ = base::TimeTicks(); |
| 184 } | 184 } |
| 185 | 185 |
| 186 } // namespace views | 186 } // namespace views |
| OLD | NEW |