| 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 ui::Range* actual_range) { |
| 796 DCHECK(text); |
| 797 DCHECK(actual_range); |
| 798 |
| 795 if (GetTextInputType() != ui::TEXT_INPUT_TYPE_TEXT || range.is_empty()) | 799 if (GetTextInputType() != ui::TEXT_INPUT_TYPE_TEXT || range.is_empty()) |
| 796 return false; | 800 return false; |
| 797 | 801 |
| 798 callback.Run(model_->GetTextFromRange(range)); | 802 *text = model_->GetTextFromRange(range); |
| 803 *actual_range = ui::Range(range.GetMin(), range.GetMin() + text->length()); |
| 799 return true; | 804 return true; |
| 800 } | 805 } |
| 801 | 806 |
| 802 void NativeTextfieldViews::OnInputMethodChanged() { | 807 void NativeTextfieldViews::OnInputMethodChanged() { |
| 803 NOTIMPLEMENTED(); | 808 NOTIMPLEMENTED(); |
| 804 } | 809 } |
| 805 | 810 |
| 806 bool NativeTextfieldViews::ChangeTextDirectionAndLayoutAlignment( | 811 bool NativeTextfieldViews::ChangeTextDirectionAndLayoutAlignment( |
| 807 base::i18n::TextDirection direction) { | 812 base::i18n::TextDirection direction) { |
| 808 NOTIMPLEMENTED(); | 813 NOTIMPLEMENTED(); |
| (...skipping 265 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1074 | 1079 |
| 1075 #if defined(USE_AURA) | 1080 #if defined(USE_AURA) |
| 1076 // static | 1081 // static |
| 1077 NativeTextfieldWrapper* NativeTextfieldWrapper::CreateWrapper( | 1082 NativeTextfieldWrapper* NativeTextfieldWrapper::CreateWrapper( |
| 1078 Textfield* field) { | 1083 Textfield* field) { |
| 1079 return new NativeTextfieldViews(field); | 1084 return new NativeTextfieldViews(field); |
| 1080 } | 1085 } |
| 1081 #endif | 1086 #endif |
| 1082 | 1087 |
| 1083 } // namespace views | 1088 } // namespace views |
| OLD | NEW |