OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "ui/views/controls/textfield/native_textfield_views.h" | 5 #include "ui/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 390 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
401 | 401 |
402 void NativeTextfieldViews::UpdateFont() { | 402 void NativeTextfieldViews::UpdateFont() { |
403 #if !defined(OS_CHROMEOS) | 403 #if !defined(OS_CHROMEOS) |
404 // For ChromeOS, we support a font list per locale, UpdateFont() should not | 404 // For ChromeOS, we support a font list per locale, UpdateFont() should not |
405 // take any effect. | 405 // take any effect. |
406 GetRenderText()->SetFontList(gfx::FontList(textfield_->font())); | 406 GetRenderText()->SetFontList(gfx::FontList(textfield_->font())); |
407 OnCaretBoundsChanged(); | 407 OnCaretBoundsChanged(); |
408 #endif | 408 #endif |
409 } | 409 } |
410 | 410 |
411 void NativeTextfieldViews::UpdateIsPassword() { | 411 void NativeTextfieldViews::UpdateIsObscured() { |
412 model_->set_is_password(textfield_->IsPassword()); | 412 model_->set_is_obscured(textfield_->IsObscured()); |
413 OnCaretBoundsChanged(); | 413 OnCaretBoundsChanged(); |
414 SchedulePaint(); | 414 SchedulePaint(); |
415 OnTextInputTypeChanged(); | 415 OnTextInputTypeChanged(); |
416 } | 416 } |
417 | 417 |
418 void NativeTextfieldViews::UpdateEnabled() { | 418 void NativeTextfieldViews::UpdateEnabled() { |
419 SetEnabled(textfield_->enabled()); | 419 SetEnabled(textfield_->enabled()); |
420 SchedulePaint(); | 420 SchedulePaint(); |
421 OnTextInputTypeChanged(); | 421 OnTextInputTypeChanged(); |
422 } | 422 } |
(...skipping 285 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
708 | 708 |
709 gfx::Rect NativeTextfieldViews::GetCaretBounds() { | 709 gfx::Rect NativeTextfieldViews::GetCaretBounds() { |
710 return GetRenderText()->GetUpdatedCursorBounds(); | 710 return GetRenderText()->GetUpdatedCursorBounds(); |
711 } | 711 } |
712 | 712 |
713 bool NativeTextfieldViews::HasCompositionText() { | 713 bool NativeTextfieldViews::HasCompositionText() { |
714 return model_->HasCompositionText(); | 714 return model_->HasCompositionText(); |
715 } | 715 } |
716 | 716 |
717 bool NativeTextfieldViews::GetTextRange(ui::Range* range) { | 717 bool NativeTextfieldViews::GetTextRange(ui::Range* range) { |
718 // We don't allow the input method to retrieve or delete content from a | 718 // We don't allow the input method to retrieve or delete content from an |
719 // password box. | 719 // obscured textfield. |
720 if (GetTextInputType() != ui::TEXT_INPUT_TYPE_TEXT) | 720 if (GetTextInputType() != ui::TEXT_INPUT_TYPE_TEXT) |
721 return false; | 721 return false; |
722 | 722 |
723 model_->GetTextRange(range); | 723 model_->GetTextRange(range); |
724 return true; | 724 return true; |
725 } | 725 } |
726 | 726 |
727 bool NativeTextfieldViews::GetCompositionTextRange(ui::Range* range) { | 727 bool NativeTextfieldViews::GetCompositionTextRange(ui::Range* range) { |
728 if (GetTextInputType() != ui::TEXT_INPUT_TYPE_TEXT) | 728 if (GetTextInputType() != ui::TEXT_INPUT_TYPE_TEXT) |
729 return false; | 729 return false; |
(...skipping 380 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1110 | 1110 |
1111 #if defined(USE_AURA) | 1111 #if defined(USE_AURA) |
1112 // static | 1112 // static |
1113 NativeTextfieldWrapper* NativeTextfieldWrapper::CreateWrapper( | 1113 NativeTextfieldWrapper* NativeTextfieldWrapper::CreateWrapper( |
1114 Textfield* field) { | 1114 Textfield* field) { |
1115 return new NativeTextfieldViews(field); | 1115 return new NativeTextfieldViews(field); |
1116 } | 1116 } |
1117 #endif | 1117 #endif |
1118 | 1118 |
1119 } // namespace views | 1119 } // namespace views |
OLD | NEW |