| 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 #include "chrome/browser/ui/views/autofill/decorated_textfield.h" | 5 #include "chrome/browser/ui/views/autofill/decorated_textfield.h" |
| 6 | 6 |
| 7 #include "chrome/browser/ui/autofill/autofill_dialog_types.h" | 7 #include "chrome/browser/ui/autofill/autofill_dialog_types.h" |
| 8 #include "chrome/browser/ui/views/autofill/tooltip_icon.h" | 8 #include "chrome/browser/ui/views/autofill/tooltip_icon.h" |
| 9 #include "ui/gfx/canvas.h" | 9 #include "ui/gfx/canvas.h" |
| 10 #include "ui/views/background.h" | 10 #include "ui/views/background.h" |
| (...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 132 void DecoratedTextfield::UpdateBackground() { | 132 void DecoratedTextfield::UpdateBackground() { |
| 133 if (editable_) | 133 if (editable_) |
| 134 UseDefaultBackgroundColor(); | 134 UseDefaultBackgroundColor(); |
| 135 else | 135 else |
| 136 SetBackgroundColor(SK_ColorTRANSPARENT); | 136 SetBackgroundColor(SK_ColorTRANSPARENT); |
| 137 set_background( | 137 set_background( |
| 138 views::Background::CreateSolidBackground(GetBackgroundColor())); | 138 views::Background::CreateSolidBackground(GetBackgroundColor())); |
| 139 } | 139 } |
| 140 | 140 |
| 141 void DecoratedTextfield::UpdateBorder() { | 141 void DecoratedTextfield::UpdateBorder() { |
| 142 views::FocusableBorder* border = new views::FocusableBorder(); | 142 scoped_ptr<views::FocusableBorder> border(new views::FocusableBorder()); |
| 143 if (invalid_) | 143 if (invalid_) |
| 144 border->SetColor(kWarningColor); | 144 border->SetColor(kWarningColor); |
| 145 else if (!editable_) | 145 else if (!editable_) |
| 146 border->SetColor(SK_ColorTRANSPARENT); | 146 border->SetColor(SK_ColorTRANSPARENT); |
| 147 set_border(border); | 147 SetBorder(border.PassAs<views::Border>()); |
| 148 } | 148 } |
| 149 | 149 |
| 150 void DecoratedTextfield::IconChanged() { | 150 void DecoratedTextfield::IconChanged() { |
| 151 // Don't show the icon if nothing else is showing. | 151 // Don't show the icon if nothing else is showing. |
| 152 icon_view_->SetVisible(editable_ || !text().empty()); | 152 icon_view_->SetVisible(editable_ || !text().empty()); |
| 153 Layout(); | 153 Layout(); |
| 154 } | 154 } |
| 155 | 155 |
| 156 } // namespace autofill | 156 } // namespace autofill |
| OLD | NEW |