OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "views/controls/textfield/native_textfield_views.h" | 5 #include "views/controls/textfield/native_textfield_views.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
(...skipping 537 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
548 cursor_timer_.InvalidateWeakPtrs(); | 548 cursor_timer_.InvalidateWeakPtrs(); |
549 if (is_cursor_visible_) { | 549 if (is_cursor_visible_) { |
550 is_cursor_visible_ = false; | 550 is_cursor_visible_ = false; |
551 RepaintCursor(); | 551 RepaintCursor(); |
552 } | 552 } |
553 | 553 |
554 if (touch_selection_controller_.get()) | 554 if (touch_selection_controller_.get()) |
555 touch_selection_controller_->ClientViewLostFocus(); | 555 touch_selection_controller_->ClientViewLostFocus(); |
556 } | 556 } |
557 | 557 |
558 ui::TextInputClient* NativeTextfieldViews::GetTextInputClient() { | 558 TextInputClient* NativeTextfieldViews::GetTextInputClient() { |
559 return textfield_->read_only() ? NULL : this; | 559 return textfield_->read_only() ? NULL : this; |
560 } | 560 } |
561 | 561 |
562 void NativeTextfieldViews::ClearEditHistory() { | 562 void NativeTextfieldViews::ClearEditHistory() { |
563 model_->ClearEditHistory(); | 563 model_->ClearEditHistory(); |
564 } | 564 } |
565 | 565 |
566 ///////////////////////////////////////////////////////////////// | 566 ///////////////////////////////////////////////////////////////// |
567 // NativeTextfieldViews, ui::SimpleMenuModel::Delegate overrides: | 567 // NativeTextfieldViews, ui::SimpleMenuModel::Delegate overrides: |
568 | 568 |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
645 gfx::Insets insets = GetInsets(); | 645 gfx::Insets insets = GetInsets(); |
646 gfx::Rect display_rect(insets.left(), | 646 gfx::Rect display_rect(insets.left(), |
647 insets.top(), | 647 insets.top(), |
648 width() - insets.width(), | 648 width() - insets.width(), |
649 height() - insets.height()); | 649 height() - insets.height()); |
650 GetRenderText()->SetDisplayRect(display_rect); | 650 GetRenderText()->SetDisplayRect(display_rect); |
651 OnCaretBoundsChanged(); | 651 OnCaretBoundsChanged(); |
652 } | 652 } |
653 | 653 |
654 /////////////////////////////////////////////////////////////////////////////// | 654 /////////////////////////////////////////////////////////////////////////////// |
655 // NativeTextfieldViews, ui::TextInputClient implementation, private: | 655 // NativeTextfieldViews, TextInputClient implementation, private: |
656 | 656 |
657 void NativeTextfieldViews::SetCompositionText( | 657 void NativeTextfieldViews::SetCompositionText( |
658 const ui::CompositionText& composition) { | 658 const ui::CompositionText& composition) { |
659 if (GetTextInputType() == ui::TEXT_INPUT_TYPE_NONE) | 659 if (GetTextInputType() == ui::TEXT_INPUT_TYPE_NONE) |
660 return; | 660 return; |
661 | 661 |
662 OnBeforeUserAction(); | 662 OnBeforeUserAction(); |
663 skip_input_method_cancel_composition_ = true; | 663 skip_input_method_cancel_composition_ = true; |
664 model_->SetCompositionText(composition); | 664 model_->SetCompositionText(composition); |
665 skip_input_method_cancel_composition_ = false; | 665 skip_input_method_cancel_composition_ = false; |
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
806 void NativeTextfieldViews::OnInputMethodChanged() { | 806 void NativeTextfieldViews::OnInputMethodChanged() { |
807 NOTIMPLEMENTED(); | 807 NOTIMPLEMENTED(); |
808 } | 808 } |
809 | 809 |
810 bool NativeTextfieldViews::ChangeTextDirectionAndLayoutAlignment( | 810 bool NativeTextfieldViews::ChangeTextDirectionAndLayoutAlignment( |
811 base::i18n::TextDirection direction) { | 811 base::i18n::TextDirection direction) { |
812 NOTIMPLEMENTED(); | 812 NOTIMPLEMENTED(); |
813 return false; | 813 return false; |
814 } | 814 } |
815 | 815 |
| 816 View* NativeTextfieldViews::GetOwnerViewOfTextInputClient() { |
| 817 return textfield_; |
| 818 } |
| 819 |
816 void NativeTextfieldViews::OnCompositionTextConfirmedOrCleared() { | 820 void NativeTextfieldViews::OnCompositionTextConfirmedOrCleared() { |
817 if (skip_input_method_cancel_composition_) | 821 if (skip_input_method_cancel_composition_) |
818 return; | 822 return; |
819 DCHECK(textfield_->GetInputMethod()); | 823 DCHECK(textfield_->GetInputMethod()); |
820 textfield_->GetInputMethod()->CancelComposition(textfield_); | 824 textfield_->GetInputMethod()->CancelComposition(textfield_); |
821 } | 825 } |
822 | 826 |
823 gfx::RenderText* NativeTextfieldViews::GetRenderText() const { | 827 gfx::RenderText* NativeTextfieldViews::GetRenderText() const { |
824 return model_->render_text(); | 828 return model_->render_text(); |
825 } | 829 } |
(...skipping 248 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1074 | 1078 |
1075 #if defined(USE_AURA) | 1079 #if defined(USE_AURA) |
1076 // static | 1080 // static |
1077 NativeTextfieldWrapper* NativeTextfieldWrapper::CreateWrapper( | 1081 NativeTextfieldWrapper* NativeTextfieldWrapper::CreateWrapper( |
1078 Textfield* field) { | 1082 Textfield* field) { |
1079 return new NativeTextfieldViews(field); | 1083 return new NativeTextfieldViews(field); |
1080 } | 1084 } |
1081 #endif | 1085 #endif |
1082 | 1086 |
1083 } // namespace views | 1087 } // namespace views |
OLD | NEW |