OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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 #ifndef UI_VIEWS_CONTROLS_TEXTFIELD_NATIVE_TEXTFIELD_VIEWS_H_ | 5 #ifndef UI_VIEWS_CONTROLS_TEXTFIELD_NATIVE_TEXTFIELD_VIEWS_H_ |
6 #define UI_VIEWS_CONTROLS_TEXTFIELD_NATIVE_TEXTFIELD_VIEWS_H_ | 6 #define UI_VIEWS_CONTROLS_TEXTFIELD_NATIVE_TEXTFIELD_VIEWS_H_ |
7 | 7 |
8 #include "base/memory/weak_ptr.h" | 8 #include "base/memory/weak_ptr.h" |
9 #include "base/strings/string16.h" | 9 #include "base/strings/string16.h" |
10 #include "base/timer/timer.h" | 10 #include "base/timer/timer.h" |
(...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
224 private: | 224 private: |
225 friend class NativeTextfieldViewsTest; | 225 friend class NativeTextfieldViewsTest; |
226 friend class TouchSelectionControllerImplTest; | 226 friend class TouchSelectionControllerImplTest; |
227 | 227 |
228 // Overridden from ui::TextInputClient: | 228 // Overridden from ui::TextInputClient: |
229 virtual void SetCompositionText( | 229 virtual void SetCompositionText( |
230 const ui::CompositionText& composition) OVERRIDE; | 230 const ui::CompositionText& composition) OVERRIDE; |
231 virtual void ConfirmCompositionText() OVERRIDE; | 231 virtual void ConfirmCompositionText() OVERRIDE; |
232 virtual void ClearCompositionText() OVERRIDE; | 232 virtual void ClearCompositionText() OVERRIDE; |
233 virtual void InsertText(const base::string16& text) OVERRIDE; | 233 virtual void InsertText(const base::string16& text) OVERRIDE; |
234 virtual void InsertChar(char16 ch, int flags) OVERRIDE; | 234 virtual void InsertChar(base::char16 ch, int flags) OVERRIDE; |
235 virtual gfx::NativeWindow GetAttachedWindow() const OVERRIDE; | 235 virtual gfx::NativeWindow GetAttachedWindow() const OVERRIDE; |
236 virtual ui::TextInputType GetTextInputType() const OVERRIDE; | 236 virtual ui::TextInputType GetTextInputType() const OVERRIDE; |
237 virtual ui::TextInputMode GetTextInputMode() const OVERRIDE; | 237 virtual ui::TextInputMode GetTextInputMode() const OVERRIDE; |
238 virtual bool CanComposeInline() const OVERRIDE; | 238 virtual bool CanComposeInline() const OVERRIDE; |
239 virtual gfx::Rect GetCaretBounds() const OVERRIDE; | 239 virtual gfx::Rect GetCaretBounds() const OVERRIDE; |
240 virtual bool GetCompositionCharacterBounds(uint32 index, | 240 virtual bool GetCompositionCharacterBounds(uint32 index, |
241 gfx::Rect* rect) const OVERRIDE; | 241 gfx::Rect* rect) const OVERRIDE; |
242 virtual bool HasCompositionText() const OVERRIDE; | 242 virtual bool HasCompositionText() const OVERRIDE; |
243 virtual bool GetTextRange(gfx::Range* range) const OVERRIDE; | 243 virtual bool GetTextRange(gfx::Range* range) const OVERRIDE; |
244 virtual bool GetCompositionTextRange(gfx::Range* range) const OVERRIDE; | 244 virtual bool GetCompositionTextRange(gfx::Range* range) const OVERRIDE; |
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
325 | 325 |
326 // Returns true if the current text input type allows access by the IME. | 326 // Returns true if the current text input type allows access by the IME. |
327 bool ImeEditingAllowed() const; | 327 bool ImeEditingAllowed() const; |
328 | 328 |
329 // Returns true if distance between |event| and |last_click_location_| | 329 // Returns true if distance between |event| and |last_click_location_| |
330 // exceeds the drag threshold. | 330 // exceeds the drag threshold. |
331 bool ExceededDragThresholdFromLastClickLocation(const ui::MouseEvent& event); | 331 bool ExceededDragThresholdFromLastClickLocation(const ui::MouseEvent& event); |
332 | 332 |
333 // Checks if a char is ok to be inserted into the textfield. The |ch| is a | 333 // Checks if a char is ok to be inserted into the textfield. The |ch| is a |
334 // modified character, i.e., modifiers took effect when generating this char. | 334 // modified character, i.e., modifiers took effect when generating this char. |
335 static bool ShouldInsertChar(char16 ch, int flags); | 335 static bool ShouldInsertChar(base::char16 ch, int flags); |
336 | 336 |
337 void CreateTouchSelectionControllerAndNotifyIt(); | 337 void CreateTouchSelectionControllerAndNotifyIt(); |
338 | 338 |
339 // Platform specific gesture event handling. | 339 // Platform specific gesture event handling. |
340 void PlatformGestureEventHandling(const ui::GestureEvent* event); | 340 void PlatformGestureEventHandling(const ui::GestureEvent* event); |
341 | 341 |
342 // Reveals the obscured char at |index| for the given |duration|. If |index| | 342 // Reveals the obscured char at |index| for the given |duration|. If |index| |
343 // is -1, existing revealed index will be cleared. | 343 // is -1, existing revealed index will be cleared. |
344 void RevealObscuredChar(int index, const base::TimeDelta& duration); | 344 void RevealObscuredChar(int index, const base::TimeDelta& duration); |
345 | 345 |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
388 // obscured text. When the timer is running, the last typed char is shown | 388 // obscured text. When the timer is running, the last typed char is shown |
389 // and when the time expires, the last typed char is obscured. | 389 // and when the time expires, the last typed char is obscured. |
390 base::OneShotTimer<NativeTextfieldViews> obscured_reveal_timer_; | 390 base::OneShotTimer<NativeTextfieldViews> obscured_reveal_timer_; |
391 | 391 |
392 DISALLOW_COPY_AND_ASSIGN(NativeTextfieldViews); | 392 DISALLOW_COPY_AND_ASSIGN(NativeTextfieldViews); |
393 }; | 393 }; |
394 | 394 |
395 } // namespace views | 395 } // namespace views |
396 | 396 |
397 #endif // UI_VIEWS_CONTROLS_TEXTFIELD_NATIVE_TEXTFIELD_VIEWS_H_ | 397 #endif // UI_VIEWS_CONTROLS_TEXTFIELD_NATIVE_TEXTFIELD_VIEWS_H_ |
OLD | NEW |