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

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

Issue 2518183002: Moved action verbs out of Blink. (Closed)
Patch Set: Only enabled buttons should expose the press action. Created 4 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
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_node_data.h" 7 #include "ui/accessibility/ax_node_data.h"
8 #include "ui/events/event.h" 8 #include "ui/events/event.h"
9 #include "ui/events/event_utils.h" 9 #include "ui/events/event_utils.h"
10 #include "ui/events/keycodes/keyboard_codes.h" 10 #include "ui/events/keycodes/keyboard_codes.h"
(...skipping 333 matching lines...) Expand 10 before | Expand all | Expand 10 after
344 node_data->AddStateFlag(ui::AX_STATE_PRESSED); 344 node_data->AddStateFlag(ui::AX_STATE_PRESSED);
345 break; 345 break;
346 case STATE_DISABLED: 346 case STATE_DISABLED:
347 node_data->AddStateFlag(ui::AX_STATE_DISABLED); 347 node_data->AddStateFlag(ui::AX_STATE_DISABLED);
348 break; 348 break;
349 case STATE_NORMAL: 349 case STATE_NORMAL:
350 case STATE_COUNT: 350 case STATE_COUNT:
351 // No additional accessibility node_data set for this button node_data. 351 // No additional accessibility node_data set for this button node_data.
352 break; 352 break;
353 } 353 }
354 if (state() != STATE_DISABLED)
355 node_data->AddIntAttribute(ui::AX_ATTR_ACTION,
356 ui::AX_SUPPORTED_ACTION_PRESS);
354 } 357 }
355 358
356 void CustomButton::VisibilityChanged(View* starting_from, bool visible) { 359 void CustomButton::VisibilityChanged(View* starting_from, bool visible) {
357 Button::VisibilityChanged(starting_from, visible); 360 Button::VisibilityChanged(starting_from, visible);
358 if (state_ == STATE_DISABLED) 361 if (state_ == STATE_DISABLED)
359 return; 362 return;
360 SetState(visible && ShouldEnterHoveredState() ? STATE_HOVERED : STATE_NORMAL); 363 SetState(visible && ShouldEnterHoveredState() ? STATE_HOVERED : STATE_NORMAL);
361 } 364 }
362 365
363 std::unique_ptr<InkDrop> CustomButton::CreateInkDrop() { 366 std::unique_ptr<InkDrop> CustomButton::CreateInkDrop() {
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after
470 views::InkDropState::ACTION_PENDING || 473 views::InkDropState::ACTION_PENDING ||
471 GetInkDrop()->GetTargetInkDropState() == 474 GetInkDrop()->GetTargetInkDropState() ==
472 views::InkDropState::ALTERNATE_ACTION_PENDING) { 475 views::InkDropState::ALTERNATE_ACTION_PENDING) {
473 AnimateInkDrop(views::InkDropState::HIDDEN, 476 AnimateInkDrop(views::InkDropState::HIDDEN,
474 ui::LocatedEvent::FromIfValid(&event)); 477 ui::LocatedEvent::FromIfValid(&event));
475 } 478 }
476 Button::OnClickCanceled(event); 479 Button::OnClickCanceled(event);
477 } 480 }
478 481
479 } // namespace views 482 } // namespace views
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698