Chromium Code Reviews| Index: chrome/browser/ui/views/autofill/decorated_textfield.cc |
| diff --git a/chrome/browser/ui/views/autofill/decorated_textfield.cc b/chrome/browser/ui/views/autofill/decorated_textfield.cc |
| index 47d3b30da56ed413492b8a7e3796dd4a9362d02e..21cf38435d7f90999f7d17f80e77bb09bc34f2d9 100644 |
| --- a/chrome/browser/ui/views/autofill/decorated_textfield.cc |
| +++ b/chrome/browser/ui/views/autofill/decorated_textfield.cc |
| @@ -5,7 +5,7 @@ |
| #include "chrome/browser/ui/views/autofill/decorated_textfield.h" |
| #include "chrome/browser/ui/autofill/autofill_dialog_types.h" |
| -#include "chrome/browser/ui/views/autofill/tooltip_icon.h" |
| +#include "chrome/browser/ui/views/autofill/learn_more_icon.h" |
| #include "ui/gfx/canvas.h" |
| #include "ui/views/background.h" |
| #include "ui/views/controls/button/label_button.h" |
| @@ -94,7 +94,9 @@ void DecoratedTextfield::SetIcon(const gfx::Image& icon) { |
| IconChanged(); |
| } |
| -void DecoratedTextfield::SetTooltipIcon(const base::string16& text) { |
| +void DecoratedTextfield::SetLearnMoreIcon( |
| + const base::string16& text, |
| + const base::WeakPtr<LearnMoreIconDelegate>& delegate) { |
| if (!icon_view_ && text.empty()) |
| return; |
| @@ -102,7 +104,7 @@ void DecoratedTextfield::SetTooltipIcon(const base::string16& text) { |
| RemoveChildView(icon_view_.get()); |
| if (!text.empty()) { |
| - icon_view_.reset(new TooltipIcon(text)); |
| + icon_view_.reset(new LearnMoreIcon(text, delegate)); |
| AddChildView(icon_view_.get()); |
| } |
| @@ -122,7 +124,9 @@ const char* DecoratedTextfield::GetClassName() const { |
| views::View* DecoratedTextfield::GetEventHandlerForPoint( |
| const gfx::Point& point) { |
| - return native_wrapper_->GetView(); |
| + if (icon_view_ && icon_view_->GetClassName() != LearnMoreIcon::kViewClassName) |
| + return native_wrapper_->GetView(); |
| + return views::Textfield::GetEventHandlerForPoint(point); |
|
Evan Stade
2013/11/05 02:01:40
I'd write this as:
views::View* handler = views::
Dan Beam
2013/11/05 07:00:55
Done.
|
| } |
| void DecoratedTextfield::OnFocus() { |
| @@ -170,6 +174,9 @@ void DecoratedTextfield::IconChanged() { |
| // Don't show the icon if nothing else is showing. |
| icon_view_->SetVisible(editable_ || !text().empty()); |
| + if (!icon_view_->visible()) |
| + icon_view_->SetSize(gfx::Size()); |
|
Evan Stade
2013/11/05 02:01:40
why necessary?
Dan Beam
2013/11/05 07:00:55
not
|
| + |
| int icon_space = icon_view_ ? |
| icon_view_->GetPreferredSize().width() + 2 * kTextfieldIconPadding : 0; |