| 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 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 92 } | 92 } |
| 93 | 93 |
| 94 base::string16 DecoratedTextfield::GetPlaceholderText() const { | 94 base::string16 DecoratedTextfield::GetPlaceholderText() const { |
| 95 return editable_ ? views::Textfield::GetPlaceholderText() : base::string16(); | 95 return editable_ ? views::Textfield::GetPlaceholderText() : base::string16(); |
| 96 } | 96 } |
| 97 | 97 |
| 98 const char* DecoratedTextfield::GetClassName() const { | 98 const char* DecoratedTextfield::GetClassName() const { |
| 99 return kViewClassName; | 99 return kViewClassName; |
| 100 } | 100 } |
| 101 | 101 |
| 102 views::View* DecoratedTextfield::GetEventHandlerForRect(const gfx::Rect& rect) { | 102 views::View* DecoratedTextfield::GetEventHandlerForRect( |
| 103 const gfx::RectF& rect) { |
| 103 views::View* handler = views::Textfield::GetEventHandlerForRect(rect); | 104 views::View* handler = views::Textfield::GetEventHandlerForRect(rect); |
| 104 if (handler->GetClassName() == TooltipIcon::kViewClassName) | 105 if (handler->GetClassName() == TooltipIcon::kViewClassName) |
| 105 return handler; | 106 return handler; |
| 106 return this; | 107 return this; |
| 107 } | 108 } |
| 108 | 109 |
| 109 gfx::Size DecoratedTextfield::GetPreferredSize() { | 110 gfx::Size DecoratedTextfield::GetPreferredSize() { |
| 110 static const int height = | 111 static const int height = |
| 111 views::LabelButton(NULL, base::string16()).GetPreferredSize().height(); | 112 views::LabelButton(NULL, base::string16()).GetPreferredSize().height(); |
| 112 const gfx::Size size = views::Textfield::GetPreferredSize(); | 113 const gfx::Size size = views::Textfield::GetPreferredSize(); |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 159 } | 160 } |
| 160 | 161 |
| 161 void DecoratedTextfield::IconChanged() { | 162 void DecoratedTextfield::IconChanged() { |
| 162 // Don't show the icon if nothing else is showing. | 163 // Don't show the icon if nothing else is showing. |
| 163 icon_view_->SetVisible(editable_ || !text().empty()); | 164 icon_view_->SetVisible(editable_ || !text().empty()); |
| 164 UpdateBorder(); | 165 UpdateBorder(); |
| 165 Layout(); | 166 Layout(); |
| 166 } | 167 } |
| 167 | 168 |
| 168 } // namespace autofill | 169 } // namespace autofill |
| OLD | NEW |