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

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: Tests updated, ready for review 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..6c4910be21aebd5666bcdba314e4269d67917e41 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,6 +26,11 @@ 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;
@@ -62,6 +73,8 @@ class SelectToSpeakEventHandler : public ui::EventHandler {
// 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);
};

Powered by Google App Engine
This is Rietveld 408576698