| Index: views/controls/textfield/native_textfield_views.h
|
| diff --git a/views/controls/textfield/native_textfield_views.h b/views/controls/textfield/native_textfield_views.h
|
| index c91281bdc9008fde09cd1bb0aed99235936f2127..68ffbb43ac034c1d1bb4caf351acd98c78d496ae 100644
|
| --- a/views/controls/textfield/native_textfield_views.h
|
| +++ b/views/controls/textfield/native_textfield_views.h
|
| @@ -12,6 +12,8 @@
|
| #include "ui/gfx/font.h"
|
| #include "views/border.h"
|
| #include "views/controls/textfield/native_textfield_wrapper.h"
|
| +#include "views/controls/textfield/textfield_views_model.h"
|
| +#include "views/ime/text_input_client.h"
|
| #include "views/view.h"
|
|
|
| namespace base {
|
| @@ -26,7 +28,6 @@ namespace views {
|
|
|
| class KeyEvent;
|
| class Menu2;
|
| -class TextfieldViewsModel;
|
|
|
| // A views/skia only implementation of NativeTextfieldWrapper.
|
| // No platform specific code is used.
|
| @@ -41,7 +42,9 @@ class TextfieldViewsModel;
|
| class NativeTextfieldViews : public views::View,
|
| public views::ContextMenuController,
|
| public NativeTextfieldWrapper,
|
| - public ui::SimpleMenuModel::Delegate {
|
| + public ui::SimpleMenuModel::Delegate,
|
| + public TextInputClient,
|
| + public TextfieldViewsModel::Delegate {
|
| public:
|
| explicit NativeTextfieldViews(Textfield* parent);
|
| ~NativeTextfieldViews();
|
| @@ -90,6 +93,7 @@ class NativeTextfieldViews : public views::View,
|
| virtual bool HandleKeyReleased(const views::KeyEvent& e) OVERRIDE;
|
| virtual void HandleFocus() OVERRIDE;
|
| virtual void HandleBlur() OVERRIDE;
|
| + virtual TextInputClient* GetTextInputClient() OVERRIDE;
|
|
|
| // ui::SimpleMenuModel::Delegate overrides
|
| virtual bool IsCommandIdChecked(int command_id) const OVERRIDE;
|
| @@ -147,6 +151,32 @@ class NativeTextfieldViews : public views::View,
|
| DISALLOW_COPY_AND_ASSIGN(TextfieldBorder);
|
| };
|
|
|
| + // Overridden from TextInputClient:
|
| + virtual void SetCompositionText(
|
| + const ui::CompositionText& composition) OVERRIDE;
|
| + virtual void ConfirmCompositionText() OVERRIDE;
|
| + virtual void ClearCompositionText() OVERRIDE;
|
| + virtual void InsertText(const string16& text) OVERRIDE;
|
| + virtual void InsertChar(char16 ch, int flags) OVERRIDE;
|
| + virtual ui::TextInputType GetTextInputType() OVERRIDE;
|
| + virtual gfx::Rect GetCaretBounds() OVERRIDE;
|
| + virtual bool HasCompositionText() OVERRIDE;
|
| + virtual bool GetTextRange(ui::Range* range) OVERRIDE;
|
| + virtual bool GetCompositionTextRange(ui::Range* range) OVERRIDE;
|
| + virtual bool GetSelectionRange(ui::Range* range) OVERRIDE;
|
| + virtual bool SetSelectionRange(const ui::Range& range) OVERRIDE;
|
| + virtual bool DeleteRange(const ui::Range& range) OVERRIDE;
|
| + virtual bool GetTextFromRange(
|
| + const ui::Range& range,
|
| + const base::Callback<void(const string16&)>& callback) OVERRIDE;
|
| + virtual void OnInputMethodChanged() OVERRIDE;
|
| + virtual bool ChangeTextDirectionAndLayoutAlignment(
|
| + base::i18n::TextDirection direction) OVERRIDE;
|
| + virtual View* GetOwnerViewOfTextInputClient() OVERRIDE;
|
| +
|
| + // Overridden from TextfieldViewsModel::Delegate:
|
| + virtual void OnCompositionTextConfirmedOrCleared() OVERRIDE;
|
| +
|
| // Returns the Textfield's font.
|
| const gfx::Font& GetFont() const;
|
|
|
| @@ -188,6 +218,12 @@ class NativeTextfieldViews : public views::View,
|
| // Utility function to create the context menu if one does not already exist.
|
| void InitContextMenuIfRequired();
|
|
|
| + // Convenience method to call InputMethod::OnTextInputTypeChanged();
|
| + void OnTextInputTypeChanged();
|
| +
|
| + // Convenience method to call InputMethod::OnCaretBoundsChanged();
|
| + void OnCaretBoundsChanged();
|
| +
|
| // Convenience method to call TextfieldController::OnBeforeUserAction();
|
| void OnBeforeUserAction();
|
|
|
| @@ -219,6 +255,9 @@ class NativeTextfieldViews : public views::View,
|
| // The drawing state of cursor. True to draw.
|
| bool is_cursor_visible_;
|
|
|
| + // True if InputMethod::CancelComposition() should not be called.
|
| + bool skip_input_method_cancel_composition_;
|
| +
|
| // A runnable method factory for callback to update the cursor.
|
| ScopedRunnableMethodFactory<NativeTextfieldViews> cursor_timer_;
|
|
|
|
|