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

Unified Diff: ui/views/controls/textfield/textfield_views_model.h

Issue 9467017: Password support for NativeTextfieldViews, in the model (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 10 months 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 side-by-side diff with in-line comments
Download patch
Index: ui/views/controls/textfield/textfield_views_model.h
diff --git a/ui/views/controls/textfield/textfield_views_model.h b/ui/views/controls/textfield/textfield_views_model.h
index c6c1c400d998ab9609d313db8269e984010a8d85..6cbcfbbcb22021afe24c44535298c2b0adf48c95 100644
--- a/ui/views/controls/textfield/textfield_views_model.h
+++ b/ui/views/controls/textfield/textfield_views_model.h
@@ -67,7 +67,7 @@ class VIEWS_EXPORT TextfieldViewsModel {
// Edit related methods.
- const string16& GetText() const;
+ const string16& GetText() const { return text_; }
// Sets the text. Returns true if the text has been modified. The
// current composition text will be confirmed first. Setting
// the same text will not add edit history because it's not user
@@ -76,6 +76,10 @@ class VIEWS_EXPORT TextfieldViewsModel {
// messing edit history.
bool SetText(const string16& text);
+ // In an obscured (password) field, all text is drawn as asterisks or bullets.
+ bool is_obscured() const { return obscured_; }
+ void SetObscured(bool obscured);
+
gfx::RenderText* render_text() { return render_text_.get(); }
// Inserts given |text| at the current cursor position.
@@ -286,6 +290,29 @@ class VIEWS_EXPORT TextfieldViewsModel {
void ClearComposition();
+ void SetTextInternal(const string16& text);
+
+ // Like GetText() except that it returns asterisks or bullets if this is an
+ // obscured field.
+ string16 GetDisplayText() const;
+
+ // Functions for converting between indices into the text and indices into the
+ // displayed text (which might be a bunch of asterisks).
+ size_t FromDisplayIndex(size_t index) const;
+ size_t ToDisplayIndex(size_t index) const;
+ ui::Range FromDisplayRange(ui::Range range) const;
+ ui::Range ToDisplayRange(ui::Range range) const;
+ gfx::SelectionModel FromDisplaySelection(
+ const gfx::SelectionModel& model) const;
+ gfx::SelectionModel ToDisplaySelection(
+ const gfx::SelectionModel& model) const;
+
+ // The current text.
+ string16 text_;
+
+ // True if this is an obscured (password) field.
+ bool obscured_;
+
// Pointer to a TextfieldViewsModel::Delegate instance, should be provided by
// the View object.
Delegate* delegate_;
« no previous file with comments | « ui/views/controls/textfield/native_textfield_views_unittest.cc ('k') | ui/views/controls/textfield/textfield_views_model.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698