| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 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 | 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_DECORATED_TEXTFIELD_H_ | 5 #ifndef CHROME_BROWSER_UI_VIEWS_AUTOFILL_DECORATED_TEXTFIELD_H_ |
| 6 #define CHROME_BROWSER_UI_VIEWS_AUTOFILL_DECORATED_TEXTFIELD_H_ | 6 #define CHROME_BROWSER_UI_VIEWS_AUTOFILL_DECORATED_TEXTFIELD_H_ |
| 7 | 7 |
| 8 #include "base/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
| 9 #include "base/strings/string16.h" | 9 #include "base/strings/string16.h" |
| 10 #include "ui/gfx/image/image.h" | 10 #include "ui/gfx/image/image.h" |
| (...skipping 28 matching lines...) Expand all Loading... |
| 39 bool editable() const { return editable_; } | 39 bool editable() const { return editable_; } |
| 40 | 40 |
| 41 // Sets the icon to display inside the textfield at the end of the text. | 41 // Sets the icon to display inside the textfield at the end of the text. |
| 42 void SetIcon(const gfx::Image& icon); | 42 void SetIcon(const gfx::Image& icon); |
| 43 | 43 |
| 44 // Sets a tooltip for this field. This will override the icon set with | 44 // Sets a tooltip for this field. This will override the icon set with |
| 45 // SetIcon(), if any, and will be overridden by future calls to SetIcon(). | 45 // SetIcon(), if any, and will be overridden by future calls to SetIcon(). |
| 46 void SetTooltipIcon(const base::string16& text); | 46 void SetTooltipIcon(const base::string16& text); |
| 47 | 47 |
| 48 // views::Textfield implementation. | 48 // views::Textfield implementation. |
| 49 virtual base::string16 GetPlaceholderText() const OVERRIDE; | 49 virtual base::string16 GetPlaceholderText() const override; |
| 50 | 50 |
| 51 // views::View implementation. | 51 // views::View implementation. |
| 52 virtual const char* GetClassName() const OVERRIDE; | 52 virtual const char* GetClassName() const override; |
| 53 virtual gfx::Size GetPreferredSize() const OVERRIDE; | 53 virtual gfx::Size GetPreferredSize() const override; |
| 54 virtual void Layout() OVERRIDE; | 54 virtual void Layout() override; |
| 55 | 55 |
| 56 private: | 56 private: |
| 57 FRIEND_TEST_ALL_PREFIXES(DecoratedTextfieldTest, HeightMatchesButton); | 57 FRIEND_TEST_ALL_PREFIXES(DecoratedTextfieldTest, HeightMatchesButton); |
| 58 | 58 |
| 59 // views::ViewTargeterDelegate: | 59 // views::ViewTargeterDelegate: |
| 60 virtual views::View* TargetForRect(views::View* root, | 60 virtual views::View* TargetForRect(views::View* root, |
| 61 const gfx::Rect& rect) OVERRIDE; | 61 const gfx::Rect& rect) override; |
| 62 | 62 |
| 63 // Updates the background after its color may have changed. | 63 // Updates the background after its color may have changed. |
| 64 void UpdateBackground(); | 64 void UpdateBackground(); |
| 65 | 65 |
| 66 // Updates the border after its color or insets may have changed. | 66 // Updates the border after its color or insets may have changed. |
| 67 void UpdateBorder(); | 67 void UpdateBorder(); |
| 68 | 68 |
| 69 // Called to update the layout after SetIcon or SetTooltipIcon was called. | 69 // Called to update the layout after SetIcon or SetTooltipIcon was called. |
| 70 void IconChanged(); | 70 void IconChanged(); |
| 71 | 71 |
| 72 // The view that holds the icon at the end of the textfield. | 72 // The view that holds the icon at the end of the textfield. |
| 73 scoped_ptr<views::ImageView> icon_view_; | 73 scoped_ptr<views::ImageView> icon_view_; |
| 74 | 74 |
| 75 // Whether the text contents are "invalid" (i.e. should special markers be | 75 // Whether the text contents are "invalid" (i.e. should special markers be |
| 76 // shown to indicate invalidness). | 76 // shown to indicate invalidness). |
| 77 bool invalid_; | 77 bool invalid_; |
| 78 | 78 |
| 79 // Whether the user can edit the field. When not editable, many of the | 79 // Whether the user can edit the field. When not editable, many of the |
| 80 // pieces of the textfield disappear (border, background, icon, placeholder | 80 // pieces of the textfield disappear (border, background, icon, placeholder |
| 81 // text) and it can't receive focus. | 81 // text) and it can't receive focus. |
| 82 bool editable_; | 82 bool editable_; |
| 83 | 83 |
| 84 DISALLOW_COPY_AND_ASSIGN(DecoratedTextfield); | 84 DISALLOW_COPY_AND_ASSIGN(DecoratedTextfield); |
| 85 }; | 85 }; |
| 86 | 86 |
| 87 } // namespace autofill | 87 } // namespace autofill |
| 88 | 88 |
| 89 #endif // CHROME_BROWSER_UI_VIEWS_AUTOFILL_DECORATED_TEXTFIELD_H_ | 89 #endif // CHROME_BROWSER_UI_VIEWS_AUTOFILL_DECORATED_TEXTFIELD_H_ |
| OLD | NEW |