Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(68)

Side by Side Diff: ui/views/controls/textfield/native_textfield_gtk.cc

Issue 8748001: Make text input type and password visibility bit independent in Textfield (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Textfield(STYLE_OBSCURED) sets TEXT_INPUT_TYPE_PASSWORD Created 9 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 <gdk/gdkkeysyms.h> 5 #include <gdk/gdkkeysyms.h>
6 #include <gtk/gtk.h> 6 #include <gtk/gtk.h>
7 7
8 #include "ui/views/controls/textfield/native_textfield_gtk.h" 8 #include "ui/views/controls/textfield/native_textfield_gtk.h"
9 9
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after
159 } 159 }
160 160
161 void NativeTextfieldGtk::UpdateFont() { 161 void NativeTextfieldGtk::UpdateFont() {
162 if (!native_view()) 162 if (!native_view())
163 return; 163 return;
164 PangoFontDescription* pfd = textfield_->font().GetNativeFont(); 164 PangoFontDescription* pfd = textfield_->font().GetNativeFont();
165 gtk_widget_modify_font(native_view(), pfd); 165 gtk_widget_modify_font(native_view(), pfd);
166 pango_font_description_free(pfd); 166 pango_font_description_free(pfd);
167 } 167 }
168 168
169 void NativeTextfieldGtk::UpdateIsPassword() { 169 void NativeTextfieldGtk::UpdateIsObscured() {
170 if (!native_view()) 170 if (!native_view())
171 return; 171 return;
172 gtk_entry_set_visibility(GTK_ENTRY(native_view()), !textfield_->IsPassword()); 172 gtk_entry_set_visibility(GTK_ENTRY(native_view()), !textfield_->IsObscured());
173 } 173 }
174 174
175 void NativeTextfieldGtk::UpdateEnabled() { 175 void NativeTextfieldGtk::UpdateEnabled() {
176 if (!native_view()) 176 if (!native_view())
177 return; 177 return;
178 SetEnabled(textfield_->IsEnabled()); 178 SetEnabled(textfield_->IsEnabled());
179 } 179 }
180 180
181 gfx::Insets NativeTextfieldGtk::CalculateInsets() { 181 gfx::Insets NativeTextfieldGtk::CalculateInsets() {
182 if (!native_view()) 182 if (!native_view())
(...skipping 230 matching lines...) Expand 10 before | Expand all | Expand 10 after
413 G_CALLBACK(OnKeyPressEventThunk), this); 413 G_CALLBACK(OnKeyPressEventThunk), this);
414 g_signal_connect(widget, "paste-clipboard", 414 g_signal_connect(widget, "paste-clipboard",
415 G_CALLBACK(OnPasteClipboardThunk), this); 415 G_CALLBACK(OnPasteClipboardThunk), this);
416 416
417 g_signal_connect_after(widget, "button-release-event", 417 g_signal_connect_after(widget, "button-release-event",
418 G_CALLBACK(OnButtonReleaseEventAfterThunk), this); 418 G_CALLBACK(OnButtonReleaseEventAfterThunk), this);
419 g_signal_connect_after(widget, "key-press-event", 419 g_signal_connect_after(widget, "key-press-event",
420 G_CALLBACK(OnKeyPressEventAfterThunk), this); 420 G_CALLBACK(OnKeyPressEventAfterThunk), this);
421 } 421 }
422 422
423 bool NativeTextfieldGtk::IsPassword() { 423 bool NativeTextfieldGtk::IsObscured() {
424 return textfield_->IsPassword(); 424 return textfield_->IsObscured();
425 } 425 }
426 426
427 /////////////////////////////////////////////////////////////////////////////// 427 ///////////////////////////////////////////////////////////////////////////////
428 // NativeTextfieldWrapper: 428 // NativeTextfieldWrapper:
429 429
430 // static 430 // static
431 NativeTextfieldWrapper* NativeTextfieldWrapper::CreateWrapper( 431 NativeTextfieldWrapper* NativeTextfieldWrapper::CreateWrapper(
432 Textfield* field) { 432 Textfield* field) {
433 if (Widget::IsPureViews()) 433 if (Widget::IsPureViews())
434 return new NativeTextfieldViews(field); 434 return new NativeTextfieldViews(field);
435 return new NativeTextfieldGtk(field); 435 return new NativeTextfieldGtk(field);
436 } 436 }
437 437
438 } // namespace views 438 } // namespace views
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698