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

Unified Diff: ash/accelerators/accelerator_controller.cc

Issue 14674002: Support Shift+Search+Arrows to navigate and Control to silence speech everywhere (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fixed non-ash ChromeShellDelegate Created 7 years, 8 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 19f3f3fafd9471ad4256ed7e7b508d2801779806..d37a398c0c750969e1eccad09ba821a83d517bec 100644
--- a/ash/accelerators/accelerator_controller.cc
+++ b/ash/accelerators/accelerator_controller.cc
@@ -61,6 +61,7 @@
#include "ui/compositor/layer_animator.h"
#include "ui/gfx/screen.h"
#include "ui/oak/oak.h"
+#include "ui/views/controls/webview/webview.h"
#include "ui/views/debug_utils.h"
#include "ui/views/widget/widget.h"
@@ -96,6 +97,34 @@ void HandleCycleWindowLinear(CycleDirection direction) {
window_cycle_controller()->HandleLinearCycleWindow();
}
+bool HandleAccessibleFocusCycle(bool reverse) {
+ if (!Shell::GetInstance()->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();
+ if (view->GetClassName() == views::WebView::kViewClassName)
+ return false;
+
+ focus_manager->AdvanceFocus(reverse);
+ return true;
+}
+
+void HandleSilenceSpokenFeedback() {
+ if (!Shell::GetInstance()->delegate()->IsSpokenFeedbackEnabled())
+ return;
+
+ Shell::GetInstance()->delegate()->SilenceSpokenFeedback();
+}
+
#if defined(OS_CHROMEOS)
bool HandleLock() {
Shell::GetInstance()->session_state_delegate()->LockScreen();
@@ -474,6 +503,10 @@ bool AcceleratorController::PerformAction(int action,
// function might be called *twice*, via BrowserView::PreHandleKeyboardEvent
// and BrowserView::HandleKeyboardEvent, for a single accelerator press.
switch (action) {
+ case ACCESSIBLE_FOCUS_NEXT:
+ return HandleAccessibleFocusCycle(false);
+ case ACCESSIBLE_FOCUS_PREVIOUS:
+ return HandleAccessibleFocusCycle(true);
case CYCLE_BACKWARD_MRU:
if (key_code == ui::VKEY_TAB)
shell->delegate()->RecordUserMetricsAction(UMA_ACCEL_PREVWINDOW_TAB);
@@ -508,6 +541,9 @@ bool AcceleratorController::PerformAction(int action,
return HandleFileManager(false /* as_dialog */);
case OPEN_CROSH:
return HandleCrosh();
+ case SILENCE_SPOKEN_FEEDBACK:
+ HandleSilenceSpokenFeedback();
+ break;
case SWAP_PRIMARY_DISPLAY:
Shell::GetInstance()->display_controller()->SwapPrimaryDisplay();
return true;
« 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