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

Side by Side Diff: chrome/browser/chromeos/accessibility/select_to_speak_event_handler.cc

Issue 2558903002: Chrome OS select-to-speak feature not properly handling key repeat (Closed)
Patch Set: 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
« no previous file with comments | « no previous file | chrome/browser/chromeos/accessibility/select_to_speak_event_handler_unittest.cc » ('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 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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 "chrome/browser/chromeos/accessibility/select_to_speak_event_handler.h" 5 #include "chrome/browser/chromeos/accessibility/select_to_speak_event_handler.h"
6 6
7 #include "ash/shell.h" 7 #include "ash/shell.h"
8 #include "chrome/browser/ui/aura/accessibility/automation_manager_aura.h" 8 #include "chrome/browser/ui/aura/accessibility/automation_manager_aura.h"
9 #include "ui/aura/window.h" 9 #include "ui/aura/window.h"
10 #include "ui/display/display.h" 10 #include "ui/display/display.h"
11 #include "ui/events/event.h" 11 #include "ui/events/event.h"
12 #include "ui/views/focus/view_storage.h" 12 #include "ui/views/focus/view_storage.h"
13 #include "ui/views/view.h" 13 #include "ui/views/view.h"
14 #include "ui/views/widget/widget.h" 14 #include "ui/views/widget/widget.h"
15 15
16 namespace chromeos { 16 namespace chromeos {
17 17
18 SelectToSpeakEventHandler::SelectToSpeakEventHandler() { 18 SelectToSpeakEventHandler::SelectToSpeakEventHandler() {
19 if (ash::Shell::HasInstance()) 19 if (ash::Shell::HasInstance())
20 ash::Shell::GetInstance()->AddPreTargetHandler(this); 20 ash::Shell::GetInstance()->AddPreTargetHandler(this);
21 } 21 }
22 22
23 SelectToSpeakEventHandler::~SelectToSpeakEventHandler() { 23 SelectToSpeakEventHandler::~SelectToSpeakEventHandler() {
24 if (ash::Shell::HasInstance()) 24 if (ash::Shell::HasInstance())
25 ash::Shell::GetInstance()->RemovePreTargetHandler(this); 25 ash::Shell::GetInstance()->RemovePreTargetHandler(this);
26 } 26 }
27 27
28 void SelectToSpeakEventHandler::OnKeyEvent(ui::KeyEvent* event) { 28 void SelectToSpeakEventHandler::OnKeyEvent(ui::KeyEvent* event) {
29 if (event->key_code() == ui::VKEY_LWIN) { 29 if (event->key_code() == ui::VKEY_LWIN) {
30 if (event->type() == ui::ET_KEY_PRESSED) { 30 if (event->type() == ui::ET_KEY_PRESSED && state_ == INACTIVE) {
31 state_ = SEARCH_DOWN; 31 state_ = SEARCH_DOWN;
32 } else if (event->type() == ui::ET_KEY_RELEASED) { 32 } else if (event->type() == ui::ET_KEY_RELEASED) {
33 if (state_ == CAPTURING) { 33 if (state_ == CAPTURING) {
34 SendCancelAXEvent(); 34 SendCancelAXEvent();
35 CancelEvent(event); 35 CancelEvent(event);
36 state_ = WAIT_FOR_MOUSE_RELEASE; 36 state_ = WAIT_FOR_MOUSE_RELEASE;
37 } else if (state_ == MOUSE_RELEASED) { 37 } else if (state_ == MOUSE_RELEASED) {
38 CancelEvent(event); 38 CancelEvent(event);
39 state_ = INACTIVE; 39 state_ = INACTIVE;
40 } 40 }
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
146 : nullptr; 146 : nullptr;
147 if (last_view) { 147 if (last_view) {
148 last_view->NotifyAccessibilityEvent(ui::AX_EVENT_MOUSE_CANCELED, true); 148 last_view->NotifyAccessibilityEvent(ui::AX_EVENT_MOUSE_CANCELED, true);
149 } else { 149 } else {
150 AutomationManagerAura::GetInstance()->HandleEvent( 150 AutomationManagerAura::GetInstance()->HandleEvent(
151 nullptr, nullptr, ui::AX_EVENT_MOUSE_CANCELED); 151 nullptr, nullptr, ui::AX_EVENT_MOUSE_CANCELED);
152 } 152 }
153 } 153 }
154 154
155 } // namespace chromeos 155 } // namespace chromeos
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/chromeos/accessibility/select_to_speak_event_handler_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698