Chromium Code Reviews| Index: views/controls/link.cc |
| diff --git a/views/controls/link.cc b/views/controls/link.cc |
| index 3c8bceac650e07cf51334554c89ba9c8ed10ccc9..0be2b5bee47ff119c9ac9f88c180956d1aaeeeb0 100644 |
| --- a/views/controls/link.cc |
| +++ b/views/controls/link.cc |
| @@ -88,12 +88,9 @@ void Link::Init() { |
| Link::~Link() { |
| } |
| -void Link::SetEnabled(bool flag) { |
| - if (flag != enabled_) { |
| - enabled_ = flag; |
| - ValidateStyle(); |
| - SchedulePaint(); |
| - } |
| +void Link::OnEnabledChanged() { |
| + ValidateStyle(); |
| + SchedulePaint(); |
|
Ben Goodger (Google)
2011/05/27 17:43:02
View::OnEnabledChanged();
tfarina
2011/05/27 18:05:07
Done.
|
| } |
| std::string Link::GetClassName() const { |
| @@ -101,7 +98,7 @@ std::string Link::GetClassName() const { |
| } |
| gfx::NativeCursor Link::GetCursor(const MouseEvent& event) { |
| - if (!enabled_) |
| + if (!View::IsEnabled()) |
| return NULL; |
| #if defined(OS_WIN) |
| static HCURSOR g_hand_cursor = LoadCursor(NULL, IDC_HAND); |
| @@ -112,14 +109,15 @@ gfx::NativeCursor Link::GetCursor(const MouseEvent& event) { |
| } |
| bool Link::OnMousePressed(const MouseEvent& event) { |
| - if (!enabled_ || (!event.IsLeftMouseButton() && !event.IsMiddleMouseButton())) |
| + if (!View::IsEnabled() || |
| + (!event.IsLeftMouseButton() && !event.IsMiddleMouseButton())) |
| return false; |
| SetHighlighted(true); |
| return true; |
| } |
| bool Link::OnMouseDragged(const MouseEvent& event) { |
| - SetHighlighted(enabled_ && |
| + SetHighlighted(View::IsEnabled() && |
| (event.IsLeftMouseButton() || event.IsMiddleMouseButton()) && |
| HitTest(event.location())); |
| return true; |
| @@ -129,7 +127,8 @@ void Link::OnMouseReleased(const MouseEvent& event) { |
| // Change the highlight first just in case this instance is deleted |
| // while calling the controller |
| OnMouseCaptureLost(); |
| - if (enabled_ && (event.IsLeftMouseButton() || event.IsMiddleMouseButton()) && |
| + if (View::IsEnabled() && |
| + (event.IsLeftMouseButton() || event.IsMiddleMouseButton()) && |
| HitTest(event.location())) { |
| // Focus the link on click. |
| RequestFocus(); |
| @@ -205,7 +204,7 @@ void Link::SetHighlighted(bool f) { |
| } |
| void Link::ValidateStyle() { |
| - if (enabled_) { |
| + if (View::IsEnabled()) { |
| if (!(font().GetStyle() & gfx::Font::UNDERLINED)) { |
| Label::SetFont( |
| font().DeriveFont(0, font().GetStyle() | gfx::Font::UNDERLINED)); |