| OLD | NEW |
| (Empty) |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef CHROME_BROWSER_UI_VIEWS_AUTOFILL_DECORATED_TEXTFIELD_H_ | |
| 6 #define CHROME_BROWSER_UI_VIEWS_AUTOFILL_DECORATED_TEXTFIELD_H_ | |
| 7 | |
| 8 #include <memory> | |
| 9 | |
| 10 #include "base/macros.h" | |
| 11 #include "base/strings/string16.h" | |
| 12 #include "ui/views/controls/textfield/textfield.h" | |
| 13 | |
| 14 namespace views { | |
| 15 class TextfieldController; | |
| 16 } | |
| 17 | |
| 18 namespace autofill { | |
| 19 | |
| 20 // A class which holds a textfield and draws extra stuff on top, like | |
| 21 // invalid content indications. | |
| 22 // TODO(estade): the usefulness of this class is dubious now that it's been | |
| 23 // stripped of most of its functionality. | |
| 24 class DecoratedTextfield : public views::Textfield { | |
| 25 public: | |
| 26 static const char kViewClassName[]; | |
| 27 | |
| 28 DecoratedTextfield(const base::string16& default_value, | |
| 29 const base::string16& placeholder, | |
| 30 views::TextfieldController* controller); | |
| 31 ~DecoratedTextfield() override; | |
| 32 | |
| 33 // Sets whether to indicate the textfield has invalid content. | |
| 34 void SetInvalid(bool invalid); | |
| 35 bool invalid() const { return invalid_; } | |
| 36 | |
| 37 // views::View implementation. | |
| 38 const char* GetClassName() const override; | |
| 39 | |
| 40 private: | |
| 41 // Updates the border after its color or insets may have changed. | |
| 42 void UpdateBorder(); | |
| 43 | |
| 44 // Whether the text contents are "invalid" (i.e. should special markers be | |
| 45 // shown to indicate invalidness). | |
| 46 bool invalid_; | |
| 47 | |
| 48 DISALLOW_COPY_AND_ASSIGN(DecoratedTextfield); | |
| 49 }; | |
| 50 | |
| 51 } // namespace autofill | |
| 52 | |
| 53 #endif // CHROME_BROWSER_UI_VIEWS_AUTOFILL_DECORATED_TEXTFIELD_H_ | |
| OLD | NEW |