| 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 112 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  123   virtual void UpdateIsObscured() OVERRIDE; |  123   virtual void UpdateIsObscured() OVERRIDE; | 
|  124   virtual void UpdateEnabled() OVERRIDE; |  124   virtual void UpdateEnabled() OVERRIDE; | 
|  125   virtual gfx::Insets CalculateInsets() OVERRIDE; |  125   virtual gfx::Insets CalculateInsets() OVERRIDE; | 
|  126   virtual void UpdateHorizontalMargins() OVERRIDE; |  126   virtual void UpdateHorizontalMargins() OVERRIDE; | 
|  127   virtual void UpdateVerticalMargins() OVERRIDE; |  127   virtual void UpdateVerticalMargins() OVERRIDE; | 
|  128   virtual void UpdateVerticalAlignment() OVERRIDE; |  128   virtual void UpdateVerticalAlignment() OVERRIDE; | 
|  129   virtual bool SetFocus() OVERRIDE; |  129   virtual bool SetFocus() OVERRIDE; | 
|  130   virtual View* GetView() OVERRIDE; |  130   virtual View* GetView() OVERRIDE; | 
|  131   virtual gfx::NativeView GetTestingHandle() const OVERRIDE; |  131   virtual gfx::NativeView GetTestingHandle() const OVERRIDE; | 
|  132   virtual bool IsIMEComposing() const OVERRIDE; |  132   virtual bool IsIMEComposing() const OVERRIDE; | 
|  133   virtual ui::Range GetSelectedRange() const OVERRIDE; |  133   virtual gfx::Range GetSelectedRange() const OVERRIDE; | 
|  134   virtual void SelectRange(const ui::Range& range) OVERRIDE; |  134   virtual void SelectRange(const gfx::Range& range) OVERRIDE; | 
|  135   virtual gfx::SelectionModel GetSelectionModel() const OVERRIDE; |  135   virtual gfx::SelectionModel GetSelectionModel() const OVERRIDE; | 
|  136   virtual void SelectSelectionModel(const gfx::SelectionModel& sel) OVERRIDE; |  136   virtual void SelectSelectionModel(const gfx::SelectionModel& sel) OVERRIDE; | 
|  137   virtual size_t GetCursorPosition() const OVERRIDE; |  137   virtual size_t GetCursorPosition() const OVERRIDE; | 
|  138   virtual bool GetCursorEnabled() const OVERRIDE; |  138   virtual bool GetCursorEnabled() const OVERRIDE; | 
|  139   virtual void SetCursorEnabled(bool enabled) OVERRIDE; |  139   virtual void SetCursorEnabled(bool enabled) OVERRIDE; | 
|  140   virtual bool HandleKeyPressed(const ui::KeyEvent& e) OVERRIDE; |  140   virtual bool HandleKeyPressed(const ui::KeyEvent& e) OVERRIDE; | 
|  141   virtual bool HandleKeyReleased(const ui::KeyEvent& e) OVERRIDE; |  141   virtual bool HandleKeyReleased(const ui::KeyEvent& e) OVERRIDE; | 
|  142   virtual void HandleFocus() OVERRIDE; |  142   virtual void HandleFocus() OVERRIDE; | 
|  143   virtual void HandleBlur() OVERRIDE; |  143   virtual void HandleBlur() OVERRIDE; | 
|  144   virtual ui::TextInputClient* GetTextInputClient() OVERRIDE; |  144   virtual ui::TextInputClient* GetTextInputClient() OVERRIDE; | 
|  145   virtual void SetColor(SkColor value) OVERRIDE; |  145   virtual void SetColor(SkColor value) OVERRIDE; | 
|  146   virtual void ApplyColor(SkColor value, const ui::Range& range) OVERRIDE; |  146   virtual void ApplyColor(SkColor value, const gfx::Range& range) OVERRIDE; | 
|  147   virtual void SetStyle(gfx::TextStyle style, bool value) OVERRIDE; |  147   virtual void SetStyle(gfx::TextStyle style, bool value) OVERRIDE; | 
|  148   virtual void ApplyStyle(gfx::TextStyle style, |  148   virtual void ApplyStyle(gfx::TextStyle style, | 
|  149                           bool value, |  149                           bool value, | 
|  150                           const ui::Range& range) OVERRIDE; |  150                           const gfx::Range& range) OVERRIDE; | 
|  151   virtual void ClearEditHistory() OVERRIDE; |  151   virtual void ClearEditHistory() OVERRIDE; | 
|  152   virtual int GetFontHeight() OVERRIDE; |  152   virtual int GetFontHeight() OVERRIDE; | 
|  153   virtual int GetTextfieldBaseline() const OVERRIDE; |  153   virtual int GetTextfieldBaseline() const OVERRIDE; | 
|  154   virtual int GetWidthNeededForText() const OVERRIDE; |  154   virtual int GetWidthNeededForText() const OVERRIDE; | 
|  155   virtual void ExecuteTextCommand(int command_id) OVERRIDE; |  155   virtual void ExecuteTextCommand(int command_id) OVERRIDE; | 
|  156   virtual bool HasTextBeingDragged() OVERRIDE; |  156   virtual bool HasTextBeingDragged() OVERRIDE; | 
|  157  |  157  | 
|  158   // ui::SimpleMenuModel::Delegate overrides |  158   // ui::SimpleMenuModel::Delegate overrides | 
|  159   virtual bool IsCommandIdChecked(int command_id) const OVERRIDE; |  159   virtual bool IsCommandIdChecked(int command_id) const OVERRIDE; | 
|  160   virtual bool IsCommandIdEnabled(int command_id) const OVERRIDE; |  160   virtual bool IsCommandIdEnabled(int command_id) const OVERRIDE; | 
| (...skipping 23 matching lines...) Expand all  Loading... | 
|  184   virtual void InsertText(const string16& text) OVERRIDE; |  184   virtual void InsertText(const string16& text) OVERRIDE; | 
|  185   virtual void InsertChar(char16 ch, int flags) OVERRIDE; |  185   virtual void InsertChar(char16 ch, int flags) OVERRIDE; | 
|  186   virtual gfx::NativeWindow GetAttachedWindow() const OVERRIDE; |  186   virtual gfx::NativeWindow GetAttachedWindow() const OVERRIDE; | 
|  187   virtual ui::TextInputType GetTextInputType() const OVERRIDE; |  187   virtual ui::TextInputType GetTextInputType() const OVERRIDE; | 
|  188   virtual ui::TextInputMode GetTextInputMode() const OVERRIDE; |  188   virtual ui::TextInputMode GetTextInputMode() const OVERRIDE; | 
|  189   virtual bool CanComposeInline() const OVERRIDE; |  189   virtual bool CanComposeInline() const OVERRIDE; | 
|  190   virtual gfx::Rect GetCaretBounds() OVERRIDE; |  190   virtual gfx::Rect GetCaretBounds() OVERRIDE; | 
|  191   virtual bool GetCompositionCharacterBounds(uint32 index, |  191   virtual bool GetCompositionCharacterBounds(uint32 index, | 
|  192                                              gfx::Rect* rect) OVERRIDE; |  192                                              gfx::Rect* rect) OVERRIDE; | 
|  193   virtual bool HasCompositionText() OVERRIDE; |  193   virtual bool HasCompositionText() OVERRIDE; | 
|  194   virtual bool GetTextRange(ui::Range* range) OVERRIDE; |  194   virtual bool GetTextRange(gfx::Range* range) OVERRIDE; | 
|  195   virtual bool GetCompositionTextRange(ui::Range* range) OVERRIDE; |  195   virtual bool GetCompositionTextRange(gfx::Range* range) OVERRIDE; | 
|  196   virtual bool GetSelectionRange(ui::Range* range) OVERRIDE; |  196   virtual bool GetSelectionRange(gfx::Range* range) OVERRIDE; | 
|  197   virtual bool SetSelectionRange(const ui::Range& range) OVERRIDE; |  197   virtual bool SetSelectionRange(const gfx::Range& range) OVERRIDE; | 
|  198   virtual bool DeleteRange(const ui::Range& range) OVERRIDE; |  198   virtual bool DeleteRange(const gfx::Range& range) OVERRIDE; | 
|  199   virtual bool GetTextFromRange(const ui::Range& range, |  199   virtual bool GetTextFromRange(const gfx::Range& range, | 
|  200                                 string16* text) OVERRIDE; |  200                                 string16* text) OVERRIDE; | 
|  201   virtual void OnInputMethodChanged() OVERRIDE; |  201   virtual void OnInputMethodChanged() OVERRIDE; | 
|  202   virtual bool ChangeTextDirectionAndLayoutAlignment( |  202   virtual bool ChangeTextDirectionAndLayoutAlignment( | 
|  203       base::i18n::TextDirection direction) OVERRIDE; |  203       base::i18n::TextDirection direction) OVERRIDE; | 
|  204   virtual void ExtendSelectionAndDelete(size_t before, size_t after) OVERRIDE; |  204   virtual void ExtendSelectionAndDelete(size_t before, size_t after) OVERRIDE; | 
|  205   virtual void EnsureCaretInRect(const gfx::Rect& rect) OVERRIDE; |  205   virtual void EnsureCaretInRect(const gfx::Rect& rect) OVERRIDE; | 
|  206  |  206  | 
|  207   // Overridden from TextfieldViewsModel::Delegate: |  207   // Overridden from TextfieldViewsModel::Delegate: | 
|  208   virtual void OnCompositionTextConfirmedOrCleared() OVERRIDE; |  208   virtual void OnCompositionTextConfirmedOrCleared() OVERRIDE; | 
|  209  |  209  | 
| (...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  318   // Is the user potentially dragging and dropping from this view? |  318   // Is the user potentially dragging and dropping from this view? | 
|  319   bool initiating_drag_; |  319   bool initiating_drag_; | 
|  320  |  320  | 
|  321   // A runnable method factory for callback to update the cursor. |  321   // A runnable method factory for callback to update the cursor. | 
|  322   base::WeakPtrFactory<NativeTextfieldViews> cursor_timer_; |  322   base::WeakPtrFactory<NativeTextfieldViews> cursor_timer_; | 
|  323  |  323  | 
|  324   // State variables used to track double and triple clicks. |  324   // State variables used to track double and triple clicks. | 
|  325   size_t aggregated_clicks_; |  325   size_t aggregated_clicks_; | 
|  326   base::TimeDelta last_click_time_; |  326   base::TimeDelta last_click_time_; | 
|  327   gfx::Point last_click_location_; |  327   gfx::Point last_click_location_; | 
|  328   ui::Range double_click_word_; |  328   gfx::Range double_click_word_; | 
|  329  |  329  | 
|  330   // Context menu and its content list for the textfield. |  330   // Context menu and its content list for the textfield. | 
|  331   scoped_ptr<ui::SimpleMenuModel> context_menu_contents_; |  331   scoped_ptr<ui::SimpleMenuModel> context_menu_contents_; | 
|  332   scoped_ptr<views::MenuModelAdapter> context_menu_delegate_; |  332   scoped_ptr<views::MenuModelAdapter> context_menu_delegate_; | 
|  333   scoped_ptr<views::MenuRunner> context_menu_runner_; |  333   scoped_ptr<views::MenuRunner> context_menu_runner_; | 
|  334  |  334  | 
|  335   scoped_ptr<ui::TouchSelectionController> touch_selection_controller_; |  335   scoped_ptr<ui::TouchSelectionController> touch_selection_controller_; | 
|  336  |  336  | 
|  337   // A timer to control the duration of showing the last typed char in |  337   // A timer to control the duration of showing the last typed char in | 
|  338   // obscured text. When the timer is running, the last typed char is shown |  338   // obscured text. When the timer is running, the last typed char is shown | 
|  339   // and when the time expires, the last typed char is obscured. |  339   // and when the time expires, the last typed char is obscured. | 
|  340   base::OneShotTimer<NativeTextfieldViews> obscured_reveal_timer_; |  340   base::OneShotTimer<NativeTextfieldViews> obscured_reveal_timer_; | 
|  341  |  341  | 
|  342   DISALLOW_COPY_AND_ASSIGN(NativeTextfieldViews); |  342   DISALLOW_COPY_AND_ASSIGN(NativeTextfieldViews); | 
|  343 }; |  343 }; | 
|  344  |  344  | 
|  345 }  // namespace views |  345 }  // namespace views | 
|  346  |  346  | 
|  347 #endif  // UI_VIEWS_CONTROLS_TEXTFIELD_NATIVE_TEXTFIELD_VIEWS_H_ |  347 #endif  // UI_VIEWS_CONTROLS_TEXTFIELD_NATIVE_TEXTFIELD_VIEWS_H_ | 
| OLD | NEW |