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

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

Issue 2477463003: Replace ui::AXViewState with AXNodeData and AXActionData (Closed)
Patch Set: Fix test Created 4 years, 1 month 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 | « ui/views/controls/button/custom_button.h ('k') | ui/views/controls/button/image_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/accessibility/ax_view_state.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"
11 #include "ui/gfx/animation/throb_animation.h" 11 #include "ui/gfx/animation/throb_animation.h"
12 #include "ui/gfx/color_palette.h" 12 #include "ui/gfx/color_palette.h"
13 #include "ui/native_theme/native_theme.h" 13 #include "ui/native_theme/native_theme.h"
14 #include "ui/views/animation/ink_drop_highlight.h" 14 #include "ui/views/animation/ink_drop_highlight.h"
15 #include "ui/views/controls/button/blue_button.h" 15 #include "ui/views/controls/button/blue_button.h"
16 #include "ui/views/controls/button/checkbox.h" 16 #include "ui/views/controls/button/checkbox.h"
17 #include "ui/views/controls/button/image_button.h" 17 #include "ui/views/controls/button/image_button.h"
(...skipping 305 matching lines...) Expand 10 before | Expand all | Expand 10 after
323 } 323 }
324 324
325 void CustomButton::OnDragDone() { 325 void CustomButton::OnDragDone() {
326 // Only reset the state to normal if the button isn't currently disabled 326 // Only reset the state to normal if the button isn't currently disabled
327 // (since disabled buttons may still be able to be dragged). 327 // (since disabled buttons may still be able to be dragged).
328 if (state_ != STATE_DISABLED) 328 if (state_ != STATE_DISABLED)
329 SetState(STATE_NORMAL); 329 SetState(STATE_NORMAL);
330 AnimateInkDrop(InkDropState::HIDDEN, nullptr /* event */); 330 AnimateInkDrop(InkDropState::HIDDEN, nullptr /* event */);
331 } 331 }
332 332
333 void CustomButton::GetAccessibleState(ui::AXViewState* state) { 333 void CustomButton::GetAccessibleNodeData(ui::AXNodeData* node_data) {
334 Button::GetAccessibleState(state); 334 Button::GetAccessibleNodeData(node_data);
335 switch (state_) { 335 switch (state_) {
336 case STATE_HOVERED: 336 case STATE_HOVERED:
337 state->AddStateFlag(ui::AX_STATE_HOVERED); 337 node_data->AddStateFlag(ui::AX_STATE_HOVERED);
338 break; 338 break;
339 case STATE_PRESSED: 339 case STATE_PRESSED:
340 state->AddStateFlag(ui::AX_STATE_PRESSED); 340 node_data->AddStateFlag(ui::AX_STATE_PRESSED);
341 break; 341 break;
342 case STATE_DISABLED: 342 case STATE_DISABLED:
343 state->AddStateFlag(ui::AX_STATE_DISABLED); 343 node_data->AddStateFlag(ui::AX_STATE_DISABLED);
344 break; 344 break;
345 case STATE_NORMAL: 345 case STATE_NORMAL:
346 case STATE_COUNT: 346 case STATE_COUNT:
347 // No additional accessibility state set for this button state. 347 // No additional accessibility node_data set for this button node_data.
348 break; 348 break;
349 } 349 }
350 } 350 }
351 351
352 void CustomButton::VisibilityChanged(View* starting_from, bool visible) { 352 void CustomButton::VisibilityChanged(View* starting_from, bool visible) {
353 Button::VisibilityChanged(starting_from, visible); 353 Button::VisibilityChanged(starting_from, visible);
354 if (state_ == STATE_DISABLED) 354 if (state_ == STATE_DISABLED)
355 return; 355 return;
356 SetState(visible && ShouldEnterHoveredState() ? STATE_HOVERED : STATE_NORMAL); 356 SetState(visible && ShouldEnterHoveredState() ? STATE_HOVERED : STATE_NORMAL);
357 } 357 }
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after
474 views::InkDropState::ACTION_PENDING || 474 views::InkDropState::ACTION_PENDING ||
475 ink_drop()->GetTargetInkDropState() == 475 ink_drop()->GetTargetInkDropState() ==
476 views::InkDropState::ALTERNATE_ACTION_PENDING) { 476 views::InkDropState::ALTERNATE_ACTION_PENDING) {
477 AnimateInkDrop(views::InkDropState::HIDDEN, 477 AnimateInkDrop(views::InkDropState::HIDDEN,
478 ui::LocatedEvent::FromIfValid(&event)); 478 ui::LocatedEvent::FromIfValid(&event));
479 } 479 }
480 Button::OnClickCanceled(event); 480 Button::OnClickCanceled(event);
481 } 481 }
482 482
483 } // namespace views 483 } // namespace views
OLDNEW
« no previous file with comments | « ui/views/controls/button/custom_button.h ('k') | ui/views/controls/button/image_button.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698