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

Side by Side Diff: chrome/browser/ui/views/autofill/expanding_textfield.h

Issue 686543002: Standardize usage of virtual/override/final specifiers. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 1 month 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
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 CHROME_BROWSER_UI_VIEWS_AUTOFILL_EXPANDING_TEXTFIELD_H_ 5 #ifndef CHROME_BROWSER_UI_VIEWS_AUTOFILL_EXPANDING_TEXTFIELD_H_
6 #define CHROME_BROWSER_UI_VIEWS_AUTOFILL_EXPANDING_TEXTFIELD_H_ 6 #define CHROME_BROWSER_UI_VIEWS_AUTOFILL_EXPANDING_TEXTFIELD_H_
7 7
8 #include <list> 8 #include <list>
9 9
10 #include "base/strings/string16.h" 10 #include "base/strings/string16.h"
(...skipping 12 matching lines...) Expand all
23 public views::TextfieldController { 23 public views::TextfieldController {
24 public: 24 public:
25 static const char kViewClassName[]; 25 static const char kViewClassName[];
26 26
27 // When |multiline| is false, the view acts pretty much like a normal 27 // When |multiline| is false, the view acts pretty much like a normal
28 // DecoratedTextfield. 28 // DecoratedTextfield.
29 ExpandingTextfield(const base::string16& default_value, 29 ExpandingTextfield(const base::string16& default_value,
30 const base::string16& placeholder, 30 const base::string16& placeholder,
31 bool multiline, 31 bool multiline,
32 views::TextfieldController* controller); 32 views::TextfieldController* controller);
33 virtual ~ExpandingTextfield(); 33 ~ExpandingTextfield() override;
34 34
35 // Sets the contents of the textfields. Textfield n is set to the nth line 35 // Sets the contents of the textfields. Textfield n is set to the nth line
36 // of |text|, as separated by line returns. 36 // of |text|, as separated by line returns.
37 void SetText(const base::string16& text); 37 void SetText(const base::string16& text);
38 // Concatenates text contents of all textfields (with line returns as the 38 // Concatenates text contents of all textfields (with line returns as the
39 // joining character) and returns it. 39 // joining character) and returns it.
40 base::string16 GetText(); 40 base::string16 GetText();
41 41
42 // Sets whether to indicate the first textfield has invalid content. Latter 42 // Sets whether to indicate the first textfield has invalid content. Latter
43 // textfields are always valid. 43 // textfields are always valid.
44 void SetInvalid(bool invalid); 44 void SetInvalid(bool invalid);
45 bool invalid() { 45 bool invalid() {
46 return textfields_.front()->invalid(); 46 return textfields_.front()->invalid();
47 } 47 }
48 48
49 // Like validity, this only cares about the first textfield. 49 // Like validity, this only cares about the first textfield.
50 void SetEditable(bool editable); 50 void SetEditable(bool editable);
51 bool editable() { 51 bool editable() {
52 return textfields_.front()->editable(); 52 return textfields_.front()->editable();
53 } 53 }
54 54
55 // DecoratedTextfield pass-throughs. 55 // DecoratedTextfield pass-throughs.
56 void SetDefaultWidthInCharacters(int chars); 56 void SetDefaultWidthInCharacters(int chars);
57 void SetPlaceholderText(const base::string16& placeholder); 57 void SetPlaceholderText(const base::string16& placeholder);
58 void SetIcon(const gfx::Image& icon); 58 void SetIcon(const gfx::Image& icon);
59 void SetTooltipIcon(const base::string16& text); 59 void SetTooltipIcon(const base::string16& text);
60 60
61 // View implementation. 61 // View implementation.
62 virtual const char* GetClassName() const override; 62 const char* GetClassName() const override;
63 using views::View::needs_layout; 63 using views::View::needs_layout;
64 64
65 // TextfieldController implementation. 65 // TextfieldController implementation.
66 virtual void ContentsChanged(views::Textfield* sender, 66 void ContentsChanged(views::Textfield* sender,
67 const base::string16& new_contents) override; 67 const base::string16& new_contents) override;
68 virtual bool HandleKeyEvent(views::Textfield* sender, 68 bool HandleKeyEvent(views::Textfield* sender,
69 const ui::KeyEvent& key_event) override; 69 const ui::KeyEvent& key_event) override;
70 virtual bool HandleMouseEvent(views::Textfield* sender, 70 bool HandleMouseEvent(views::Textfield* sender,
71 const ui::MouseEvent& mouse_event) override; 71 const ui::MouseEvent& mouse_event) override;
72 72
73 private: 73 private:
74 // Calls a given function on every textfield. 74 // Calls a given function on every textfield.
75 template <typename BaseType, typename Param> 75 template <typename BaseType, typename Param>
76 void ForEachTextfield(void (BaseType::* f)(Param), Param p) const; 76 void ForEachTextfield(void (BaseType::* f)(Param), Param p) const;
77 77
78 // The list of textfields. Owned as child views. 78 // The list of textfields. Owned as child views.
79 std::list<DecoratedTextfield*> textfields_; 79 std::list<DecoratedTextfield*> textfields_;
80 80
81 TextfieldController* controller_; 81 TextfieldController* controller_;
82 82
83 DISALLOW_COPY_AND_ASSIGN(ExpandingTextfield); 83 DISALLOW_COPY_AND_ASSIGN(ExpandingTextfield);
84 }; 84 };
85 85
86 } // namespace autofill 86 } // namespace autofill
87 87
88 #endif // CHROME_BROWSER_UI_VIEWS_AUTOFILL_EXPANDING_TEXTFIELD_H_ 88 #endif // CHROME_BROWSER_UI_VIEWS_AUTOFILL_EXPANDING_TEXTFIELD_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698