Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(109)

Side by Side Diff: ui/views/controls/link.cc

Issue 11280290: events: Change gesture-event handler in EventHandler to not return any values. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « ui/views/controls/link.h ('k') | ui/views/controls/menu/menu_controller.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
115 // Make sure we don't process space or enter as accelerators. 115 // Make sure we don't process space or enter as accelerators.
116 return (event.key_code() == ui::VKEY_SPACE) || 116 return (event.key_code() == ui::VKEY_SPACE) ||
117 (event.key_code() == ui::VKEY_RETURN); 117 (event.key_code() == ui::VKEY_RETURN);
118 } 118 }
119 119
120 void Link::GetAccessibleState(ui::AccessibleViewState* state) { 120 void Link::GetAccessibleState(ui::AccessibleViewState* state) {
121 Label::GetAccessibleState(state); 121 Label::GetAccessibleState(state);
122 state->role = ui::AccessibilityTypes::ROLE_LINK; 122 state->role = ui::AccessibilityTypes::ROLE_LINK;
123 } 123 }
124 124
125 ui::EventResult Link::OnGestureEvent(ui::GestureEvent* event) { 125 void Link::OnGestureEvent(ui::GestureEvent* event) {
126 if (!enabled()) 126 if (!enabled())
127 return ui::ER_UNHANDLED; 127 return;
128 128
129 if (event->type() == ui::ET_GESTURE_TAP_DOWN) { 129 if (event->type() == ui::ET_GESTURE_TAP_DOWN) {
130 SetPressed(true); 130 SetPressed(true);
131 } else if (event->type() == ui::ET_GESTURE_TAP) { 131 } else if (event->type() == ui::ET_GESTURE_TAP) {
132 RequestFocus(); 132 RequestFocus();
133 if (listener_) 133 if (listener_)
134 listener_->LinkClicked(this, event->flags()); 134 listener_->LinkClicked(this, event->flags());
135 } else { 135 } else {
136 SetPressed(false); 136 SetPressed(false);
137 return ui::ER_UNHANDLED; 137 return;
138 } 138 }
139 return ui::ER_CONSUMED; 139 event->SetHandled();
140 } 140 }
141 141
142 void Link::SetFont(const gfx::Font& font) { 142 void Link::SetFont(const gfx::Font& font) {
143 Label::SetFont(font); 143 Label::SetFont(font);
144 RecalculateFont(); 144 RecalculateFont();
145 } 145 }
146 146
147 void Link::SetEnabledColor(SkColor color) { 147 void Link::SetEnabledColor(SkColor color) {
148 requested_enabled_color_ = color; 148 requested_enabled_color_ = color;
149 if (!pressed_) 149 if (!pressed_)
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
208 // true. 208 // true.
209 if ((enabled() && underline_) == 209 if ((enabled() && underline_) ==
210 !(font().GetStyle() & gfx::Font::UNDERLINED)) { 210 !(font().GetStyle() & gfx::Font::UNDERLINED)) {
211 Label::SetFont(font().DeriveFont(0, enabled() && underline_ ? 211 Label::SetFont(font().DeriveFont(0, enabled() && underline_ ?
212 (font().GetStyle() | gfx::Font::UNDERLINED) : 212 (font().GetStyle() | gfx::Font::UNDERLINED) :
213 (font().GetStyle() & ~gfx::Font::UNDERLINED))); 213 (font().GetStyle() & ~gfx::Font::UNDERLINED)));
214 } 214 }
215 } 215 }
216 216
217 } // namespace views 217 } // namespace views
OLDNEW
« no previous file with comments | « ui/views/controls/link.h ('k') | ui/views/controls/menu/menu_controller.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698