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

Side by Side Diff: views/controls/textfield/native_textfield_views.h

Issue 6685082: Refactor Textfield and AutocompleteEditViewViews. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rename IsValidChar to ShouldInsertChar. Created 9 years, 9 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) 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 #ifndef VIEWS_CONTROLS_TEXTFIELD_NATIVE_TEXTFIELD_VIEWS_H_ 5 #ifndef VIEWS_CONTROLS_TEXTFIELD_NATIVE_TEXTFIELD_VIEWS_H_
6 #define VIEWS_CONTROLS_TEXTFIELD_NATIVE_TEXTFIELD_VIEWS_H_ 6 #define VIEWS_CONTROLS_TEXTFIELD_NATIVE_TEXTFIELD_VIEWS_H_
7 #pragma once 7 #pragma once
8 8
9 #include "base/string16.h" 9 #include "base/string16.h"
10 #include "base/task.h" 10 #include "base/task.h"
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after
162 void RepaintCursor(); 162 void RepaintCursor();
163 163
164 // Update the cursor_bounds and text_offset. 164 // Update the cursor_bounds and text_offset.
165 void UpdateCursorBoundsAndTextOffset(); 165 void UpdateCursorBoundsAndTextOffset();
166 166
167 void PaintTextAndCursor(gfx::Canvas* canvas); 167 void PaintTextAndCursor(gfx::Canvas* canvas);
168 168
169 // Handle the keyevent. 169 // Handle the keyevent.
170 bool HandleKeyEvent(const KeyEvent& key_event); 170 bool HandleKeyEvent(const KeyEvent& key_event);
171 171
172 // Utility function. Gets the character corresponding to a keyevent.
173 // Returns 0 if the character is not printable.
174 char16 GetPrintableChar(const KeyEvent& key_event);
175
176 // Find a cusor position for given |point| in this views coordinates. 172 // Find a cusor position for given |point| in this views coordinates.
177 size_t FindCursorPosition(const gfx::Point& point) const; 173 size_t FindCursorPosition(const gfx::Point& point) const;
178 174
179 // Mouse event handler. Returns true if textfield needs to be repainted. 175 // Mouse event handler. Returns true if textfield needs to be repainted.
180 bool HandleMousePressed(const views::MouseEvent& e); 176 bool HandleMousePressed(const views::MouseEvent& e);
181 177
182 // Helper function that sets the cursor position at the location of mouse 178 // Helper function that sets the cursor position at the location of mouse
183 // event. 179 // event.
184 void SetCursorForMouseClick(const views::MouseEvent& e); 180 void SetCursorForMouseClick(const views::MouseEvent& e);
185 181
186 // Utility function to inform the parent textfield (and its controller if any) 182 // Utility function to inform the parent textfield (and its controller if any)
187 // that the text in the textfield has changed. 183 // that the text in the textfield has changed.
188 void PropagateTextChange(); 184 void PropagateTextChange();
189 185
190 // Does necessary updates when the text and/or the position of the cursor 186 // Does necessary updates when the text and/or the position of the cursor
191 // changed. 187 // changed.
192 void UpdateAfterChange(bool text_changed, bool cursor_changed); 188 void UpdateAfterChange(bool text_changed, bool cursor_changed);
193 189
194 // Utility function to create the context menu if one does not already exist. 190 // Utility function to create the context menu if one does not already exist.
195 void InitContextMenuIfRequired(); 191 void InitContextMenuIfRequired();
196 192
193 // Convenience method to call TextfieldController::OnBeforeUserAction();
194 void OnBeforeUserAction();
195
196 // Convenience method to call TextfieldController::OnAfterUserAction();
197 void OnAfterUserAction();
198
199 // Checks if a char is ok to be inserted into the textfield.
oshima 2011/03/22 23:22:23 Can you add comment that ch is modified char?
James Su 2011/03/22 23:49:57 Done.
200 static bool ShouldInsertChar(char16 ch, int flags);
201
197 // The parent textfield, the owner of this object. 202 // The parent textfield, the owner of this object.
198 Textfield* textfield_; 203 Textfield* textfield_;
199 204
200 // The text model. 205 // The text model.
201 scoped_ptr<TextfieldViewsModel> model_; 206 scoped_ptr<TextfieldViewsModel> model_;
202 207
203 // The reference to the border class. The object is owned by View::border_. 208 // The reference to the border class. The object is owned by View::border_.
204 TextfieldBorder* text_border_; 209 TextfieldBorder* text_border_;
205 210
206 // The x offset for the text to be drawn, without insets; 211 // The x offset for the text to be drawn, without insets;
(...skipping 23 matching lines...) Expand all
230 // Context menu and its content list for the textfield. 235 // Context menu and its content list for the textfield.
231 scoped_ptr<ui::SimpleMenuModel> context_menu_contents_; 236 scoped_ptr<ui::SimpleMenuModel> context_menu_contents_;
232 scoped_ptr<Menu2> context_menu_menu_; 237 scoped_ptr<Menu2> context_menu_menu_;
233 238
234 DISALLOW_COPY_AND_ASSIGN(NativeTextfieldViews); 239 DISALLOW_COPY_AND_ASSIGN(NativeTextfieldViews);
235 }; 240 };
236 241
237 } // namespace views 242 } // namespace views
238 243
239 #endif // VIEWS_CONTROLS_TEXTFIELD_NATIVE_TEXTFIELD_VIEWS_H_ 244 #endif // VIEWS_CONTROLS_TEXTFIELD_NATIVE_TEXTFIELD_VIEWS_H_
OLDNEW
« no previous file with comments | « chrome/browser/autocomplete/autocomplete_edit_view_views.cc ('k') | views/controls/textfield/native_textfield_views.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698