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 <utility> |
| 8 |
7 #include "chrome/browser/ui/autofill/autofill_dialog_types.h" | 9 #include "chrome/browser/ui/autofill/autofill_dialog_types.h" |
8 #include "chrome/browser/ui/views/autofill/tooltip_icon.h" | 10 #include "chrome/browser/ui/views/autofill/tooltip_icon.h" |
9 #include "ui/gfx/canvas.h" | 11 #include "ui/gfx/canvas.h" |
10 #include "ui/views/background.h" | 12 #include "ui/views/background.h" |
11 #include "ui/views/controls/button/label_button.h" | 13 #include "ui/views/controls/button/label_button.h" |
12 #include "ui/views/controls/focusable_border.h" | 14 #include "ui/views/controls/focusable_border.h" |
13 #include "ui/views/controls/textfield/textfield_controller.h" | 15 #include "ui/views/controls/textfield/textfield_controller.h" |
14 #include "ui/views/view_targeter.h" | 16 #include "ui/views/view_targeter.h" |
15 | 17 |
16 namespace { | 18 namespace { |
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
155 | 157 |
156 // Adjust the border insets to include the icon and its padding. | 158 // Adjust the border insets to include the icon and its padding. |
157 if (icon_view_ && icon_view_->visible()) { | 159 if (icon_view_ && icon_view_->visible()) { |
158 int w = icon_view_->GetPreferredSize().width() + 2 * kTextfieldIconPadding; | 160 int w = icon_view_->GetPreferredSize().width() + 2 * kTextfieldIconPadding; |
159 gfx::Insets insets = border->GetInsets(); | 161 gfx::Insets insets = border->GetInsets(); |
160 int left = insets.left() + (base::i18n::IsRTL() ? w : 0); | 162 int left = insets.left() + (base::i18n::IsRTL() ? w : 0); |
161 int right = insets.right() + (base::i18n::IsRTL() ? 0 : w); | 163 int right = insets.right() + (base::i18n::IsRTL() ? 0 : w); |
162 border->SetInsets(insets.top(), left, insets.bottom(), right); | 164 border->SetInsets(insets.top(), left, insets.bottom(), right); |
163 } | 165 } |
164 | 166 |
165 SetBorder(border.Pass()); | 167 SetBorder(std::move(border)); |
166 } | 168 } |
167 | 169 |
168 void DecoratedTextfield::IconChanged() { | 170 void DecoratedTextfield::IconChanged() { |
169 // Don't show the icon if nothing else is showing. | 171 // Don't show the icon if nothing else is showing. |
170 icon_view_->SetVisible(editable_ || !text().empty()); | 172 icon_view_->SetVisible(editable_ || !text().empty()); |
171 UpdateBorder(); | 173 UpdateBorder(); |
172 Layout(); | 174 Layout(); |
173 } | 175 } |
174 | 176 |
175 } // namespace autofill | 177 } // namespace autofill |
OLD | NEW |