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

Unified Diff: ash/accelerators/accelerator_controller.cc

Issue 1213513003: Revert of Support Compat mode inside of the desktop tree. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@commands_alt
Patch Set: Created 5 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | ash/accelerators/accelerator_table.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ash/accelerators/accelerator_controller.cc
diff --git a/ash/accelerators/accelerator_controller.cc b/ash/accelerators/accelerator_controller.cc
index 8f1d9477b775d5e515cc4969996b7b603e89d145..6eb68a3921409ddb09a7388551f83661ff71e866 100644
--- a/ash/accelerators/accelerator_controller.cc
+++ b/ash/accelerators/accelerator_controller.cc
@@ -79,6 +79,37 @@
using base::UserMetricsAction;
+bool CanHandleAccessibleFocusCycle() {
+ if (!Shell::GetInstance()->accessibility_delegate()->
+ IsSpokenFeedbackEnabled()) {
+ return false;
+ }
+ aura::Window* active_window = ash::wm::GetActiveWindow();
+ if (!active_window)
+ return false;
+ views::Widget* widget =
+ views::Widget::GetWidgetForNativeWindow(active_window);
+ if (!widget)
+ return false;
+ views::FocusManager* focus_manager = widget->GetFocusManager();
+ if (!focus_manager)
+ return false;
+ views::View* view = focus_manager->GetFocusedView();
+ return view && strcmp(view->GetClassName(), views::WebView::kViewClassName);
+}
+
+void HandleAccessibleFocusCycle(bool reverse) {
+ if (reverse)
+ base::RecordAction(UserMetricsAction("Accel_Accessible_Focus_Previous"));
+ else
+ base::RecordAction(UserMetricsAction("Accel_Accessible_Focus_Next"));
+
+ aura::Window* active_window = ash::wm::GetActiveWindow();
+ views::Widget* widget =
+ views::Widget::GetWidgetForNativeWindow(active_window);
+ widget->GetFocusManager()->AdvanceFocus(reverse);
+}
+
void HandleCycleBackwardMRU(const ui::Accelerator& accelerator) {
if (accelerator.key_code() == ui::VKEY_TAB)
base::RecordAction(base::UserMetricsAction("Accel_PrevWindow_Tab"));
@@ -849,6 +880,9 @@
// false should be returned to give the web contents a chance at handling the
// accelerator.
switch (action) {
+ case ACCESSIBLE_FOCUS_NEXT:
+ case ACCESSIBLE_FOCUS_PREVIOUS:
+ return CanHandleAccessibleFocusCycle();
case DEBUG_PRINT_LAYER_HIERARCHY:
case DEBUG_PRINT_VIEW_HIERARCHY:
case DEBUG_PRINT_WINDOW_HIERARCHY:
@@ -979,6 +1013,12 @@
// implement it in your module's controller code (like TOGGLE_MIRROR_MODE
// below) or pull it into a HandleFoo() function above.
switch (action) {
+ case ACCESSIBLE_FOCUS_NEXT:
+ HandleAccessibleFocusCycle(false);
+ break;
+ case ACCESSIBLE_FOCUS_PREVIOUS:
+ HandleAccessibleFocusCycle(true);
+ break;
case CYCLE_BACKWARD_MRU:
HandleCycleBackwardMRU(accelerator);
break;
« no previous file with comments | « no previous file | ash/accelerators/accelerator_table.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698