| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 VIEWS_CONTROLS_TEXTFIELD_TEXTFIELD_VIEWS_MODEL_H_ | 5 #ifndef VIEWS_CONTROLS_TEXTFIELD_TEXTFIELD_VIEWS_MODEL_H_ |
| 6 #define VIEWS_CONTROLS_TEXTFIELD_TEXTFIELD_VIEWS_MODEL_H_ | 6 #define VIEWS_CONTROLS_TEXTFIELD_TEXTFIELD_VIEWS_MODEL_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 130 // if text has changed after cutting. | 130 // if text has changed after cutting. |
| 131 bool Cut(); | 131 bool Cut(); |
| 132 | 132 |
| 133 // Copies the currently selected text and puts it to clipboard. | 133 // Copies the currently selected text and puts it to clipboard. |
| 134 void Copy(); | 134 void Copy(); |
| 135 | 135 |
| 136 // Pastes text from the clipboard at current cursor position. Returns true | 136 // Pastes text from the clipboard at current cursor position. Returns true |
| 137 // if text has changed after pasting. | 137 // if text has changed after pasting. |
| 138 bool Paste(); | 138 bool Paste(); |
| 139 | 139 |
| 140 // Tells if any text is selected. |
| 141 bool HasSelection() const; |
| 142 |
| 140 private: | 143 private: |
| 141 friend class NativeTextfieldViews; | 144 friend class NativeTextfieldViews; |
| 142 | 145 |
| 143 // Tells if any text is selected. | |
| 144 bool HasSelection() const; | |
| 145 | |
| 146 // Deletes the selected text. | 146 // Deletes the selected text. |
| 147 void DeleteSelection(); | 147 void DeleteSelection(); |
| 148 | 148 |
| 149 // Returns the visible text given |start| and |end|. | 149 // Returns the visible text given |start| and |end|. |
| 150 string16 GetVisibleText(size_t start, size_t end) const; | 150 string16 GetVisibleText(size_t start, size_t end) const; |
| 151 | 151 |
| 152 // The text in utf16 format. | 152 // The text in utf16 format. |
| 153 string16 text_; | 153 string16 text_; |
| 154 | 154 |
| 155 // Current cursor position. | 155 // Current cursor position. |
| 156 size_t cursor_pos_; | 156 size_t cursor_pos_; |
| 157 | 157 |
| 158 // Selection range. | 158 // Selection range. |
| 159 size_t selection_begin_; | 159 size_t selection_begin_; |
| 160 | 160 |
| 161 // True if the text is the password. | 161 // True if the text is the password. |
| 162 bool is_password_; | 162 bool is_password_; |
| 163 | 163 |
| 164 DISALLOW_COPY_AND_ASSIGN(TextfieldViewsModel); | 164 DISALLOW_COPY_AND_ASSIGN(TextfieldViewsModel); |
| 165 }; | 165 }; |
| 166 | 166 |
| 167 } // namespace views | 167 } // namespace views |
| 168 | 168 |
| 169 #endif // VIEWS_CONTROLS_TEXTFIELD_TEXTFIELD_VIEWS_MODEL_H_ | 169 #endif // VIEWS_CONTROLS_TEXTFIELD_TEXTFIELD_VIEWS_MODEL_H_ |
| OLD | NEW |