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 *text = model_->GetTextFromRange(range); |
James Su
2011/10/28 04:20:45
You need to make sure the range is inside the cont
Peng
2011/10/28 15:42:19
Done.
| |
799 return true; | 799 return true; |
800 } | 800 } |
801 | 801 |
802 void NativeTextfieldViews::OnInputMethodChanged() { | 802 void NativeTextfieldViews::OnInputMethodChanged() { |
803 NOTIMPLEMENTED(); | 803 NOTIMPLEMENTED(); |
804 } | 804 } |
805 | 805 |
806 bool NativeTextfieldViews::ChangeTextDirectionAndLayoutAlignment( | 806 bool NativeTextfieldViews::ChangeTextDirectionAndLayoutAlignment( |
807 base::i18n::TextDirection direction) { | 807 base::i18n::TextDirection direction) { |
808 NOTIMPLEMENTED(); | 808 NOTIMPLEMENTED(); |
(...skipping 265 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1074 | 1074 |
1075 #if defined(USE_AURA) | 1075 #if defined(USE_AURA) |
1076 // static | 1076 // static |
1077 NativeTextfieldWrapper* NativeTextfieldWrapper::CreateWrapper( | 1077 NativeTextfieldWrapper* NativeTextfieldWrapper::CreateWrapper( |
1078 Textfield* field) { | 1078 Textfield* field) { |
1079 return new NativeTextfieldViews(field); | 1079 return new NativeTextfieldViews(field); |
1080 } | 1080 } |
1081 #endif | 1081 #endif |
1082 | 1082 |
1083 } // namespace views | 1083 } // namespace views |
OLD | NEW |