Index: ui/views/controls/textfield/textfield.cc |
diff --git a/ui/views/controls/textfield/textfield.cc b/ui/views/controls/textfield/textfield.cc |
index ea2a29aa89fec7a4c5d5b8aa545a4bfca1126253..952bc5a20de4e78497bb0c522c33a210a18a4bba 100644 |
--- a/ui/views/controls/textfield/textfield.cc |
+++ b/ui/views/controls/textfield/textfield.cc |
@@ -212,6 +212,13 @@ ui::TextEditCommand GetTextEditCommandFromMenuCommand(int command_id, |
return ui::TextEditCommand::INVALID_COMMAND; |
} |
+base::TimeDelta GetPasswordRevealDuration() { |
+ return ViewsDelegate::GetInstance() |
+ ? ViewsDelegate::GetInstance() |
+ ->GetTextfieldPasswordRevealDuration() |
+ : base::TimeDelta(); |
+} |
+ |
} // namespace |
// static |
@@ -261,12 +268,6 @@ Textfield::Textfield() |
SetBorder(std::unique_ptr<Border>(new FocusableBorder())); |
SetFocusBehavior(FocusBehavior::ALWAYS); |
- if (ViewsDelegate::GetInstance()) { |
- password_reveal_duration_ = |
- ViewsDelegate::GetInstance() |
- ->GetDefaultTextfieldObscuredRevealDuration(); |
- } |
- |
// These allow BrowserView to pass edit commands from the Chrome menu to us |
// when we're focused by simply asking the FocusManager to |
// ProcessAccelerator() with the relevant accelerators. |
@@ -1291,7 +1292,7 @@ void Textfield::InsertChar(const ui::KeyEvent& event) { |
DoInsertChar(ch); |
if (text_input_type_ == ui::TEXT_INPUT_TYPE_PASSWORD && |
- !password_reveal_duration_.is_zero()) { |
+ !GetPasswordRevealDuration().is_zero()) { |
const size_t change_offset = model_->GetCursorPosition(); |
DCHECK_GT(change_offset, 0u); |
RevealPasswordChar(change_offset - 1); |
@@ -1985,7 +1986,7 @@ void Textfield::RevealPasswordChar(int index) { |
SchedulePaint(); |
if (index != -1) { |
- password_reveal_timer_.Start(FROM_HERE, password_reveal_duration_, |
+ password_reveal_timer_.Start(FROM_HERE, GetPasswordRevealDuration(), |
base::Bind(&Textfield::RevealPasswordChar, |
weak_ptr_factory_.GetWeakPtr(), -1)); |
} |