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

Side by Side Diff: ui/views/controls/textfield/textfield_views_model.h

Issue 9117012: Rename visual style "password" to "obscured" (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: copyright Created 8 years, 11 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 #ifndef UI_VIEWS_CONTROLS_TEXTFIELD_TEXTFIELD_VIEWS_MODEL_H_ 5 #ifndef UI_VIEWS_CONTROLS_TEXTFIELD_TEXTFIELD_VIEWS_MODEL_H_
6 #define UI_VIEWS_CONTROLS_TEXTFIELD_TEXTFIELD_VIEWS_MODEL_H_ 6 #define UI_VIEWS_CONTROLS_TEXTFIELD_TEXTFIELD_VIEWS_MODEL_H_
7 #pragma once 7 #pragma once
8 8
9 #include <list> 9 #include <list>
10 #include <vector> 10 #include <vector>
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
58 // Called when the current composition text is confirmed or cleared. 58 // Called when the current composition text is confirmed or cleared.
59 virtual void OnCompositionTextConfirmedOrCleared() = 0; 59 virtual void OnCompositionTextConfirmedOrCleared() = 0;
60 60
61 protected: 61 protected:
62 virtual ~Delegate(); 62 virtual ~Delegate();
63 }; 63 };
64 64
65 explicit TextfieldViewsModel(Delegate* delegate); 65 explicit TextfieldViewsModel(Delegate* delegate);
66 virtual ~TextfieldViewsModel(); 66 virtual ~TextfieldViewsModel();
67 67
68 void set_is_password(bool is_password) { 68 void set_is_obscured(bool is_obscured) {
69 is_password_ = is_password; 69 is_obscured_ = is_obscured;
70 } 70 }
71 71
72 // Edit related methods. 72 // Edit related methods.
73 73
74 const string16& GetText() const; 74 const string16& GetText() const;
75 // Sets the text. Returns true if the text has been modified. The 75 // Sets the text. Returns true if the text has been modified. The
76 // current composition text will be confirmed first. Setting 76 // current composition text will be confirmed first. Setting
77 // the same text will not add edit history because it's not user 77 // the same text will not add edit history because it's not user
78 // visible change nor user-initiated change. This allow a client 78 // visible change nor user-initiated change. This allow a client
79 // code to set the same text multiple times without worrying about 79 // code to set the same text multiple times without worrying about
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
176 176
177 // Returns true if there is an redoable edit. 177 // Returns true if there is an redoable edit.
178 bool CanRedo(); 178 bool CanRedo();
179 179
180 // Undo edit. Returns true if undo changed the text. 180 // Undo edit. Returns true if undo changed the text.
181 bool Undo(); 181 bool Undo();
182 182
183 // Redo edit. Returns true if redo changed the text. 183 // Redo edit. Returns true if redo changed the text.
184 bool Redo(); 184 bool Redo();
185 185
186 // Returns visible text. If the field is password, it returns the 186 // Returns visible text. If the field is obscured, it returns the
187 // sequence of "*". 187 // sequence of "*".
188 string16 GetVisibleText() const; 188 string16 GetVisibleText() const;
189 189
190 // Cuts the currently selected text and puts it to clipboard. Returns true 190 // Cuts the currently selected text and puts it to clipboard. Returns true
191 // if text has changed after cutting. 191 // if text has changed after cutting.
192 bool Cut(); 192 bool Cut();
193 193
194 // Copies the currently selected text and puts it to clipboard. Returns true 194 // Copies the currently selected text and puts it to clipboard. Returns true
195 // if something was copied to the clipboard. 195 // if something was copied to the clipboard.
196 bool Copy(); 196 bool Copy();
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
297 297
298 void ClearComposition(); 298 void ClearComposition();
299 299
300 // Pointer to a TextfieldViewsModel::Delegate instance, should be provided by 300 // Pointer to a TextfieldViewsModel::Delegate instance, should be provided by
301 // the View object. 301 // the View object.
302 Delegate* delegate_; 302 Delegate* delegate_;
303 303
304 // The stylized text, cursor, selection, and the visual layout model. 304 // The stylized text, cursor, selection, and the visual layout model.
305 scoped_ptr<gfx::RenderText> render_text_; 305 scoped_ptr<gfx::RenderText> render_text_;
306 306
307 // True if the text is the password. 307 // True if the text is obscured (e.g., a password).
308 bool is_password_; 308 bool is_obscured_;
309 309
310 typedef std::list<internal::Edit*> EditHistory; 310 typedef std::list<internal::Edit*> EditHistory;
311 EditHistory edit_history_; 311 EditHistory edit_history_;
312 312
313 // An iterator that points to the current edit that can be undone. 313 // An iterator that points to the current edit that can be undone.
314 // This iterator moves from the |end()|, meaining no edit to undo, 314 // This iterator moves from the |end()|, meaining no edit to undo,
315 // to the last element (one before |end()|), meaning no edit to redo. 315 // to the last element (one before |end()|), meaning no edit to redo.
316 // There is no edit to undo (== end()) when: 316 // There is no edit to undo (== end()) when:
317 // 1) in initial state. (nothing to undo) 317 // 1) in initial state. (nothing to undo)
318 // 2) very 1st edit is undone. 318 // 2) very 1st edit is undone.
319 // 3) all edit history is removed. 319 // 3) all edit history is removed.
320 // There is no edit to redo (== last element or no element) when: 320 // There is no edit to redo (== last element or no element) when:
321 // 1) in initial state. (nothing to redo) 321 // 1) in initial state. (nothing to redo)
322 // 2) new edit is added. (redo history is cleared) 322 // 2) new edit is added. (redo history is cleared)
323 // 3) redone all undone edits. 323 // 3) redone all undone edits.
324 EditHistory::iterator current_edit_; 324 EditHistory::iterator current_edit_;
325 325
326 DISALLOW_COPY_AND_ASSIGN(TextfieldViewsModel); 326 DISALLOW_COPY_AND_ASSIGN(TextfieldViewsModel);
327 }; 327 };
328 328
329 } // namespace views 329 } // namespace views
330 330
331 #endif // UI_VIEWS_CONTROLS_TEXTFIELD_TEXTFIELD_VIEWS_MODEL_H_ 331 #endif // UI_VIEWS_CONTROLS_TEXTFIELD_TEXTFIELD_VIEWS_MODEL_H_
OLDNEW
« no previous file with comments | « ui/views/controls/textfield/textfield.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