| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "ui/views/controls/link.h" | 5 #include "ui/views/controls/link.h" |
| 6 | 6 |
| 7 #include "build/build_config.h" | 7 #include "build/build_config.h" |
| 8 | 8 |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "base/utf_string_conversions.h" | 10 #include "base/utf_string_conversions.h" |
| (...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 104 | 104 |
| 105 // Focus the link on key pressed. | 105 // Focus the link on key pressed. |
| 106 RequestFocus(); | 106 RequestFocus(); |
| 107 | 107 |
| 108 if (listener_) | 108 if (listener_) |
| 109 listener_->LinkClicked(this, event.flags()); | 109 listener_->LinkClicked(this, event.flags()); |
| 110 | 110 |
| 111 return true; | 111 return true; |
| 112 } | 112 } |
| 113 | 113 |
| 114 ui::GestureStatus Link::OnGestureEvent(const ui::GestureEvent& event) { | 114 ui::EventResult Link::OnGestureEvent(const ui::GestureEvent& event) { |
| 115 if (!enabled()) | 115 if (!enabled()) |
| 116 return ui::GESTURE_STATUS_UNKNOWN; | 116 return ui::ER_UNHANDLED; |
| 117 | 117 |
| 118 if (event.type() == ui::ET_GESTURE_TAP_DOWN) { | 118 if (event.type() == ui::ET_GESTURE_TAP_DOWN) { |
| 119 SetPressed(true); | 119 SetPressed(true); |
| 120 } else if (event.type() == ui::ET_GESTURE_TAP) { | 120 } else if (event.type() == ui::ET_GESTURE_TAP) { |
| 121 RequestFocus(); | 121 RequestFocus(); |
| 122 if (listener_) | 122 if (listener_) |
| 123 listener_->LinkClicked(this, event.flags()); | 123 listener_->LinkClicked(this, event.flags()); |
| 124 } else { | 124 } else { |
| 125 SetPressed(false); | 125 SetPressed(false); |
| 126 return ui::GESTURE_STATUS_UNKNOWN; | 126 return ui::ER_UNHANDLED; |
| 127 } | 127 } |
| 128 return ui::GESTURE_STATUS_CONSUMED; | 128 return ui::ER_CONSUMED; |
| 129 } | 129 } |
| 130 | 130 |
| 131 bool Link::SkipDefaultKeyEventProcessing(const ui::KeyEvent& event) { | 131 bool Link::SkipDefaultKeyEventProcessing(const ui::KeyEvent& event) { |
| 132 // Make sure we don't process space or enter as accelerators. | 132 // Make sure we don't process space or enter as accelerators. |
| 133 return (event.key_code() == ui::VKEY_SPACE) || | 133 return (event.key_code() == ui::VKEY_SPACE) || |
| 134 (event.key_code() == ui::VKEY_RETURN); | 134 (event.key_code() == ui::VKEY_RETURN); |
| 135 } | 135 } |
| 136 | 136 |
| 137 void Link::GetAccessibleState(ui::AccessibleViewState* state) { | 137 void Link::GetAccessibleState(ui::AccessibleViewState* state) { |
| 138 Label::GetAccessibleState(state); | 138 Label::GetAccessibleState(state); |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 198 void Link::RecalculateFont() { | 198 void Link::RecalculateFont() { |
| 199 // The font should be underlined iff the link is enabled. | 199 // The font should be underlined iff the link is enabled. |
| 200 if (enabled() == !(font().GetStyle() & gfx::Font::UNDERLINED)) { | 200 if (enabled() == !(font().GetStyle() & gfx::Font::UNDERLINED)) { |
| 201 Label::SetFont(font().DeriveFont(0, enabled() ? | 201 Label::SetFont(font().DeriveFont(0, enabled() ? |
| 202 (font().GetStyle() | gfx::Font::UNDERLINED) : | 202 (font().GetStyle() | gfx::Font::UNDERLINED) : |
| 203 (font().GetStyle() & ~gfx::Font::UNDERLINED))); | 203 (font().GetStyle() & ~gfx::Font::UNDERLINED))); |
| 204 } | 204 } |
| 205 } | 205 } |
| 206 | 206 |
| 207 } // namespace views | 207 } // namespace views |
| OLD | NEW |