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" |
11 #include "ui/views/controls/prefix_delegate.h" | 11 #include "ui/views/controls/prefix_delegate.h" |
12 #include "ui/views/widget/widget.h" | 12 #include "ui/views/widget/widget.h" |
13 | 13 |
14 namespace views { | 14 namespace views { |
15 | 15 |
16 namespace { | 16 namespace { |
17 | 17 |
18 const int64 kTimeBeforeClearingMS = 1000; | 18 const int64_t kTimeBeforeClearingMS = 1000; |
19 | 19 |
20 void ConvertRectToScreen(const views::View* src, gfx::Rect* r) { | 20 void ConvertRectToScreen(const views::View* src, gfx::Rect* r) { |
21 DCHECK(src); | 21 DCHECK(src); |
22 | 22 |
23 gfx::Point new_origin = r->origin(); | 23 gfx::Point new_origin = r->origin(); |
24 views::View::ConvertPointToScreen(src, &new_origin); | 24 views::View::ConvertPointToScreen(src, &new_origin); |
25 r->set_origin(new_origin); | 25 r->set_origin(new_origin); |
26 } | 26 } |
27 | 27 |
28 } // namespace | 28 } // namespace |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
73 } | 73 } |
74 | 74 |
75 gfx::Rect PrefixSelector::GetCaretBounds() const { | 75 gfx::Rect PrefixSelector::GetCaretBounds() const { |
76 gfx::Rect rect(prefix_delegate_->GetVisibleBounds().origin(), gfx::Size()); | 76 gfx::Rect rect(prefix_delegate_->GetVisibleBounds().origin(), gfx::Size()); |
77 // TextInputClient::GetCaretBounds is expected to return a value in screen | 77 // TextInputClient::GetCaretBounds is expected to return a value in screen |
78 // coordinates. | 78 // coordinates. |
79 ConvertRectToScreen(prefix_delegate_, &rect); | 79 ConvertRectToScreen(prefix_delegate_, &rect); |
80 return rect; | 80 return rect; |
81 } | 81 } |
82 | 82 |
83 bool PrefixSelector::GetCompositionCharacterBounds(uint32 index, | 83 bool PrefixSelector::GetCompositionCharacterBounds(uint32_t index, |
84 gfx::Rect* rect) const { | 84 gfx::Rect* rect) const { |
85 // TextInputClient::GetCompositionCharacterBounds is expected to fill |rect| | 85 // TextInputClient::GetCompositionCharacterBounds is expected to fill |rect| |
86 // in screen coordinates and GetCaretBounds returns screen coordinates. | 86 // in screen coordinates and GetCaretBounds returns screen coordinates. |
87 *rect = GetCaretBounds(); | 87 *rect = GetCaretBounds(); |
88 return false; | 88 return false; |
89 } | 89 } |
90 | 90 |
91 bool PrefixSelector::HasCompositionText() const { | 91 bool PrefixSelector::HasCompositionText() const { |
92 return false; | 92 return false; |
93 } | 93 } |
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
187 return (model_text.size() >= lower_text.size()) && | 187 return (model_text.size() >= lower_text.size()) && |
188 (model_text.compare(0, lower_text.size(), lower_text) == 0); | 188 (model_text.compare(0, lower_text.size(), lower_text) == 0); |
189 } | 189 } |
190 | 190 |
191 void PrefixSelector::ClearText() { | 191 void PrefixSelector::ClearText() { |
192 current_text_.clear(); | 192 current_text_.clear(); |
193 time_of_last_key_ = base::TimeTicks(); | 193 time_of_last_key_ = base::TimeTicks(); |
194 } | 194 } |
195 | 195 |
196 } // namespace views | 196 } // namespace views |
OLD | NEW |