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 773 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
784 if (model_->HasSelection()) { | 784 if (model_->HasSelection()) { |
785 model_->DeleteSelection(); | 785 model_->DeleteSelection(); |
786 UpdateAfterChange(true, true); | 786 UpdateAfterChange(true, true); |
787 } | 787 } |
788 OnAfterUserAction(); | 788 OnAfterUserAction(); |
789 return true; | 789 return true; |
790 } | 790 } |
791 | 791 |
792 bool NativeTextfieldViews::GetTextFromRange( | 792 bool NativeTextfieldViews::GetTextFromRange( |
793 const ui::Range& range, | 793 const ui::Range& range, |
794 const base::Callback<void(const string16&)>& callback) { | 794 string16* text) { |
795 if (GetTextInputType() != ui::TEXT_INPUT_TYPE_TEXT || range.is_empty()) | 795 if (GetTextInputType() != ui::TEXT_INPUT_TYPE_TEXT || !range.IsValid()) |
796 return false; | 796 return false; |
797 | 797 |
798 callback.Run(model_->GetTextFromRange(range)); | 798 ui::Range text_range; |
| 799 if (!GetTextRange(&text_range) || !text_range.Contains(range)) |
| 800 return false; |
| 801 |
| 802 *text = model_->GetTextFromRange(range); |
799 return true; | 803 return true; |
800 } | 804 } |
801 | 805 |
802 void NativeTextfieldViews::OnInputMethodChanged() { | 806 void NativeTextfieldViews::OnInputMethodChanged() { |
803 NOTIMPLEMENTED(); | 807 NOTIMPLEMENTED(); |
804 } | 808 } |
805 | 809 |
806 bool NativeTextfieldViews::ChangeTextDirectionAndLayoutAlignment( | 810 bool NativeTextfieldViews::ChangeTextDirectionAndLayoutAlignment( |
807 base::i18n::TextDirection direction) { | 811 base::i18n::TextDirection direction) { |
808 NOTIMPLEMENTED(); | 812 NOTIMPLEMENTED(); |
(...skipping 265 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 |