OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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/spoken_feedback_event_rewriter.h
" | 5 #include "chrome/browser/chromeos/accessibility/spoken_feedback_event_rewriter.h
" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 | 8 |
9 #include "ash/shell.h" | 9 #include "ash/shell.h" |
10 #include "chrome/browser/chromeos/accessibility/accessibility_manager.h" | 10 #include "chrome/browser/chromeos/accessibility/accessibility_manager.h" |
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
109 scoped_ptr<SpokenFeedbackEventRewriterDelegate> delegate) { | 109 scoped_ptr<SpokenFeedbackEventRewriterDelegate> delegate) { |
110 delegate_ = delegate.Pass(); | 110 delegate_ = delegate.Pass(); |
111 } | 111 } |
112 | 112 |
113 ui::EventRewriteStatus SpokenFeedbackEventRewriter::RewriteEvent( | 113 ui::EventRewriteStatus SpokenFeedbackEventRewriter::RewriteEvent( |
114 const ui::Event& event, | 114 const ui::Event& event, |
115 scoped_ptr<ui::Event>* new_event) { | 115 scoped_ptr<ui::Event>* new_event) { |
116 if (!delegate_->IsSpokenFeedbackEnabled()) | 116 if (!delegate_->IsSpokenFeedbackEnabled()) |
117 return ui::EVENT_REWRITE_CONTINUE; | 117 return ui::EVENT_REWRITE_CONTINUE; |
118 | 118 |
| 119 if (event.IsMouseEvent()) { |
| 120 const auto& mouse_event = static_cast<const ui::MouseEvent&>(event); |
| 121 scoped_ptr<ui::MouseEvent> ax_mouse_event( |
| 122 new ui::MouseEvent(mouse_event.type(), |
| 123 mouse_event.location(), |
| 124 mouse_event.root_location(), |
| 125 mouse_event.time_stamp(), |
| 126 mouse_event.flags() | ui::EF_TOUCH_ACCESSIBILITY, |
| 127 mouse_event.changed_button_flags())); |
| 128 *new_event = ax_mouse_event.Pass(); |
| 129 return ui::EVENT_REWRITE_REWRITTEN; |
| 130 } |
| 131 |
119 if ((event.type() != ui::ET_KEY_PRESSED && | 132 if ((event.type() != ui::ET_KEY_PRESSED && |
120 event.type() != ui::ET_KEY_RELEASED)) | 133 event.type() != ui::ET_KEY_RELEASED)) |
121 return ui::EVENT_REWRITE_CONTINUE; | 134 return ui::EVENT_REWRITE_CONTINUE; |
122 | 135 |
123 const ui::KeyEvent key_event = static_cast<const ui::KeyEvent&>(event); | 136 const ui::KeyEvent key_event = static_cast<const ui::KeyEvent&>(event); |
124 if (delegate_->DispatchKeyEventToChromeVox(key_event)) | 137 if (delegate_->DispatchKeyEventToChromeVox(key_event)) |
125 return ui::EVENT_REWRITE_DISCARD; | 138 return ui::EVENT_REWRITE_DISCARD; |
126 return ui::EVENT_REWRITE_CONTINUE; | 139 return ui::EVENT_REWRITE_CONTINUE; |
127 } | 140 } |
128 | 141 |
129 ui::EventRewriteStatus SpokenFeedbackEventRewriter::NextDispatchEvent( | 142 ui::EventRewriteStatus SpokenFeedbackEventRewriter::NextDispatchEvent( |
130 const ui::Event& last_event, | 143 const ui::Event& last_event, |
131 scoped_ptr<ui::Event>* new_event) { | 144 scoped_ptr<ui::Event>* new_event) { |
132 return ui::EVENT_REWRITE_CONTINUE; | 145 return ui::EVENT_REWRITE_CONTINUE; |
133 } | 146 } |
OLD | NEW |