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

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

Issue 868473002: [Views] Don't reset button state after dragging if the button is disabled. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Latest master Created 5 years, 10 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
« no previous file with comments | « no previous file | no next file » | 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/accessibility/ax_view_state.h" 7 #include "ui/accessibility/ax_view_state.h"
8 #include "ui/events/event.h" 8 #include "ui/events/event.h"
9 #include "ui/events/keycodes/keyboard_codes.h" 9 #include "ui/events/keycodes/keyboard_codes.h"
10 #include "ui/gfx/animation/throb_animation.h" 10 #include "ui/gfx/animation/throb_animation.h"
(...skipping 255 matching lines...) Expand 10 before | Expand all | Expand 10 after
266 return; 266 return;
267 267
268 // We're about to show the context menu. Showing the context menu likely means 268 // We're about to show the context menu. Showing the context menu likely means
269 // we won't get a mouse exited and reset state. Reset it now to be sure. 269 // we won't get a mouse exited and reset state. Reset it now to be sure.
270 if (state_ != STATE_DISABLED) 270 if (state_ != STATE_DISABLED)
271 SetState(STATE_NORMAL); 271 SetState(STATE_NORMAL);
272 View::ShowContextMenu(p, source_type); 272 View::ShowContextMenu(p, source_type);
273 } 273 }
274 274
275 void CustomButton::OnDragDone() { 275 void CustomButton::OnDragDone() {
276 SetState(STATE_NORMAL); 276 // Only reset the state to normal if the button isn't currently disabled
277 // (since disabled buttons may still be able to be dragged).
278 if (state_ != STATE_DISABLED)
279 SetState(STATE_NORMAL);
277 } 280 }
278 281
279 void CustomButton::GetAccessibleState(ui::AXViewState* state) { 282 void CustomButton::GetAccessibleState(ui::AXViewState* state) {
280 Button::GetAccessibleState(state); 283 Button::GetAccessibleState(state);
281 switch (state_) { 284 switch (state_) {
282 case STATE_HOVERED: 285 case STATE_HOVERED:
283 state->AddStateFlag(ui::AX_STATE_HOVERED); 286 state->AddStateFlag(ui::AX_STATE_HOVERED);
284 break; 287 break;
285 case STATE_PRESSED: 288 case STATE_PRESSED:
286 state->AddStateFlag(ui::AX_STATE_PRESSED); 289 state->AddStateFlag(ui::AX_STATE_PRESSED);
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
344 if (!details.is_add && state_ != STATE_DISABLED) 347 if (!details.is_add && state_ != STATE_DISABLED)
345 SetState(STATE_NORMAL); 348 SetState(STATE_NORMAL);
346 } 349 }
347 350
348 void CustomButton::OnBlur() { 351 void CustomButton::OnBlur() {
349 if (IsHotTracked()) 352 if (IsHotTracked())
350 SetState(STATE_NORMAL); 353 SetState(STATE_NORMAL);
351 } 354 }
352 355
353 } // namespace views 356 } // namespace views
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698