summaryrefslogtreecommitdiffstats
path: root/views/controls/textfield/native_textfield_gtk.cc
diff options
context:
space:
mode:
Diffstat (limited to 'views/controls/textfield/native_textfield_gtk.cc')
-rw-r--r--views/controls/textfield/native_textfield_gtk.cc7
1 files changed, 7 insertions, 0 deletions
diff --git a/views/controls/textfield/native_textfield_gtk.cc b/views/controls/textfield/native_textfield_gtk.cc
index ebaa614..9704e7e 100644
--- a/views/controls/textfield/native_textfield_gtk.cc
+++ b/views/controls/textfield/native_textfield_gtk.cc
@@ -12,6 +12,8 @@
#include "views/controls/textfield/textfield.h"
namespace views {
+// A character used to hide a text in password mode.
+const char kPasswordChar = '*';
////////////////////////////////////////////////////////////////////////////////
// NativeTextfieldGtk, public:
@@ -229,6 +231,11 @@ gboolean NativeTextfieldGtk::OnChanged() {
void NativeTextfieldGtk::CreateNativeControl() {
NativeControlCreated(gtk_entry_new());
+ if (textfield_->IsPassword()) {
+ gtk_entry_set_invisible_char(GTK_ENTRY(native_view()),
+ static_cast<gunichar>(kPasswordChar));
+ gtk_entry_set_visibility(GTK_ENTRY(native_view()), false);
+ }
}
void NativeTextfieldGtk::NativeControlCreated(GtkWidget* widget) {