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

Side by Side Diff: ui/views/controls/button/custom_button.cc

Issue 10534092: Add touch gestures to views menu controls. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: ReleaseCapture if capture was started. Created 8 years, 6 months 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 | « no previous file | ui/views/controls/button/menu_button.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/button/custom_button.h" 5 #include "ui/views/controls/button/custom_button.h"
6 6
7 #include "ui/base/accessibility/accessible_view_state.h" 7 #include "ui/base/accessibility/accessible_view_state.h"
8 #include "ui/base/animation/throb_animation.h" 8 #include "ui/base/animation/throb_animation.h"
9 #include "ui/base/keycodes/keyboard_codes.h" 9 #include "ui/base/keycodes/keyboard_codes.h"
10 #include "ui/gfx/screen.h" 10 #include "ui/gfx/screen.h"
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after
188 if ((state_ == BS_DISABLED) || (event.key_code() != ui::VKEY_SPACE)) 188 if ((state_ == BS_DISABLED) || (event.key_code() != ui::VKEY_SPACE))
189 return false; 189 return false;
190 190
191 SetState(BS_NORMAL); 191 SetState(BS_NORMAL);
192 NotifyClick(event); 192 NotifyClick(event);
193 return true; 193 return true;
194 } 194 }
195 195
196 ui::GestureStatus CustomButton::OnGestureEvent(const GestureEvent& event) { 196 ui::GestureStatus CustomButton::OnGestureEvent(const GestureEvent& event) {
197 if (state_ == BS_DISABLED) 197 if (state_ == BS_DISABLED)
198 return ui::GESTURE_STATUS_UNKNOWN; 198 return Button::OnGestureEvent(event);
199 199
200 if (event.type() == ui::ET_GESTURE_TAP) { 200 if (event.type() == ui::ET_GESTURE_TAP) {
201 // Set the button state to hot and start the animation fully faded in. The 201 // Set the button state to hot and start the animation fully faded in. The
202 // TAP_UP event issued immediately after will set the state to BS_NORMAL 202 // TAP_UP event issued immediately after will set the state to BS_NORMAL
203 // beginning the fade out animation. See http://crbug.com/131184. 203 // beginning the fade out animation. See http://crbug.com/131184.
204 SetState(BS_HOT); 204 SetState(BS_HOT);
205 hover_animation_->Reset(1.0); 205 hover_animation_->Reset(1.0);
206 NotifyClick(event); 206 NotifyClick(event);
207 return ui::GESTURE_STATUS_CONSUMED; 207 return ui::GESTURE_STATUS_CONSUMED;
208 } else if (event.type() == ui::ET_GESTURE_TAP_DOWN) { 208 } else if (event.type() == ui::ET_GESTURE_TAP_DOWN) {
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
298 if (!is_add && state_ != BS_DISABLED) 298 if (!is_add && state_ != BS_DISABLED)
299 SetState(BS_NORMAL); 299 SetState(BS_NORMAL);
300 } 300 }
301 301
302 void CustomButton::OnBlur() { 302 void CustomButton::OnBlur() {
303 if (IsHotTracked()) 303 if (IsHotTracked())
304 SetState(BS_NORMAL); 304 SetState(BS_NORMAL);
305 } 305 }
306 306
307 } // namespace views 307 } // namespace views
OLDNEW
« no previous file with comments | « no previous file | ui/views/controls/button/menu_button.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698