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

Unified Diff: chrome/browser/chromeos/accessibility/select_to_speak_event_handler.h

Issue 2814213002: Refactor Select-to-speak so that mouse events are forwarded to the extension. (Closed)
Patch Set: closure Created 3 years, 7 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
Index: chrome/browser/chromeos/accessibility/select_to_speak_event_handler.h
diff --git a/chrome/browser/chromeos/accessibility/select_to_speak_event_handler.h b/chrome/browser/chromeos/accessibility/select_to_speak_event_handler.h
index 048e2cf83d5055ca4fa458efd3a069db383b8438..21dbef0f1632e42fe62fc8cbe0a911520c9e8530 100644
--- a/chrome/browser/chromeos/accessibility/select_to_speak_event_handler.h
+++ b/chrome/browser/chromeos/accessibility/select_to_speak_event_handler.h
@@ -13,6 +13,12 @@
namespace chromeos {
+class SelectToSpeakForwardedEventDelegateForTesting {
+ public:
+ virtual void OnForwardEventToSelectToSpeakExtension(
+ const ui::MouseEvent& event) = 0;
+};
+
// Intercepts mouse events while the Search key is held down, and sends
// accessibility events to the Select-to-speak extension instead.
class SelectToSpeakEventHandler : public ui::EventHandler {
@@ -20,13 +26,17 @@ class SelectToSpeakEventHandler : public ui::EventHandler {
SelectToSpeakEventHandler();
~SelectToSpeakEventHandler() override;
+ // For testing, call the provided callback with any events that would have
+ // been forwarded to the Select-to-speak extension instead.
+ void CaptureForwardedEventsForTesting(
+ SelectToSpeakForwardedEventDelegateForTesting* delegate);
+
private:
// EventHandler:
void OnKeyEvent(ui::KeyEvent* event) override;
void OnMouseEvent(ui::MouseEvent* event) override;
void CancelEvent(ui::Event* event);
- void SendCancelAXEvent();
enum State {
// Neither the Search key nor the mouse button are down.
@@ -55,12 +65,7 @@ class SelectToSpeakEventHandler : public ui::EventHandler {
State state_ = INACTIVE;
- // The set of keys that are currently down. Updated whenever a key is
- // pressed or released.
- std::set<ui::KeyboardCode> keys_currently_down_;
- // The set of keys that have been pressed together. Updated whenever a key
- // is pressed, and only cleared when all keys are released.
- std::set<ui::KeyboardCode> keys_pressed_together_;
+ SelectToSpeakForwardedEventDelegateForTesting* event_delegate_for_testing_;
DISALLOW_COPY_AND_ASSIGN(SelectToSpeakEventHandler);
};
« no previous file with comments | « chrome/browser/chromeos/BUILD.gn ('k') | chrome/browser/chromeos/accessibility/select_to_speak_event_handler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698