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

Unified Diff: ui/views/view.cc

Issue 2795843002: Move implementation of accessibility actions to views::View (Closed)
Patch Set: Fix win compile Created 3 years, 9 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ui/views/accessibility/native_view_accessibility_unittest.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/views/view.cc
diff --git a/ui/views/view.cc b/ui/views/view.cc
index d02ebd4fbc88a5921f5c054c213ac75600d4f316..83192d8c93df41d122c633fa68f89130182ba0cb 100644
--- a/ui/views/view.cc
+++ b/ui/views/view.cc
@@ -23,6 +23,7 @@
#include "base/trace_event/trace_event.h"
#include "build/build_config.h"
#include "third_party/skia/include/core/SkRect.h"
+#include "ui/accessibility/ax_action_data.h"
#include "ui/accessibility/ax_enums.h"
#include "ui/base/cursor/cursor.h"
#include "ui/base/dragdrop/drag_drop_types.h"
@@ -36,6 +37,7 @@
#include "ui/compositor/paint_recorder.h"
#include "ui/compositor/transform_recorder.h"
#include "ui/display/screen.h"
+#include "ui/events/base_event_utils.h"
#include "ui/events/event_target_iterator.h"
#include "ui/gfx/canvas.h"
#include "ui/gfx/geometry/point3_f.h"
@@ -1398,6 +1400,41 @@ bool View::ExceededDragThreshold(const gfx::Vector2d& delta) {
// Accessibility----------------------------------------------------------------
bool View::HandleAccessibleAction(const ui::AXActionData& action_data) {
+ switch (action_data.action) {
+ case ui::AX_ACTION_BLUR:
+ if (HasFocus()) {
+ GetFocusManager()->ClearFocus();
+ return true;
+ }
+ break;
+ case ui::AX_ACTION_DO_DEFAULT: {
+ const gfx::Point center = GetLocalBounds().CenterPoint();
+ OnMousePressed(ui::MouseEvent(
+ ui::ET_MOUSE_PRESSED, center, center, ui::EventTimeForNow(),
+ ui::EF_LEFT_MOUSE_BUTTON, ui::EF_LEFT_MOUSE_BUTTON));
+ OnMouseReleased(ui::MouseEvent(
+ ui::ET_MOUSE_RELEASED, center, center, ui::EventTimeForNow(),
+ ui::EF_LEFT_MOUSE_BUTTON, ui::EF_LEFT_MOUSE_BUTTON));
+ return true;
+ }
+ case ui::AX_ACTION_FOCUS:
+ if (IsAccessibilityFocusable()) {
+ RequestFocus();
+ return true;
+ }
+ break;
+ case ui::AX_ACTION_SCROLL_TO_MAKE_VISIBLE:
+ ScrollRectToVisible(GetLocalBounds());
+ return true;
+ case ui::AX_ACTION_SHOW_CONTEXT_MENU:
+ ShowContextMenu(GetBoundsInScreen().CenterPoint(),
+ ui::MENU_SOURCE_KEYBOARD);
+ return true;
+ default:
+ // Some actions are handled by subclasses of View.
+ break;
+ }
+
return false;
}
« no previous file with comments | « ui/views/accessibility/native_view_accessibility_unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698