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

Side by Side Diff: chrome/browser/ui/views/autofill/autofill_popup_base_view.cc

Issue 2670003002: Accessibility for Autofill Popup View in native code (Closed)
Patch Set: Incorporates Mathieu Perreault's suggestions. Adds NotifyAccessibilityEvent to mouse events in Auto… Created 3 years, 10 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 unified diff | Download patch
« no previous file with comments | « no previous file | chrome/browser/ui/views/autofill/autofill_popup_view_views.h » ('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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/ui/views/autofill/autofill_popup_base_view.h" 5 #include "chrome/browser/ui/views/autofill/autofill_popup_base_view.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/location.h" 8 #include "base/location.h"
9 #include "base/single_thread_task_runner.h" 9 #include "base/single_thread_task_runner.h"
10 #include "base/threading/thread_task_runner_handle.h" 10 #include "base/threading/thread_task_runner_handle.h"
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after
118 void AutofillPopupBaseView::OnMouseCaptureLost() { 118 void AutofillPopupBaseView::OnMouseCaptureLost() {
119 ClearSelection(); 119 ClearSelection();
120 } 120 }
121 121
122 bool AutofillPopupBaseView::OnMouseDragged(const ui::MouseEvent& event) { 122 bool AutofillPopupBaseView::OnMouseDragged(const ui::MouseEvent& event) {
123 if (HitTestPoint(event.location())) { 123 if (HitTestPoint(event.location())) {
124 SetSelection(event.location()); 124 SetSelection(event.location());
125 125
126 // We must return true in order to get future OnMouseDragged and 126 // We must return true in order to get future OnMouseDragged and
127 // OnMouseReleased events. 127 // OnMouseReleased events.
128 NotifyAccessibilityEvent(ui::AX_EVENT_MOUSE_DRAGGED, true);
dmazzoni 2017/02/06 16:27:11 The mouse events aren't meant to be fired directly
csashi 2017/02/25 02:09:16 Done.
128 return true; 129 return true;
129 } 130 }
130 131
131 // If we move off of the popup, we lose the selection. 132 // If we move off of the popup, we lose the selection.
132 ClearSelection(); 133 ClearSelection();
133 return false; 134 return false;
134 } 135 }
135 136
136 void AutofillPopupBaseView::OnMouseExited(const ui::MouseEvent& event) { 137 void AutofillPopupBaseView::OnMouseExited(const ui::MouseEvent& event) {
137 // Pressing return causes the cursor to hide, which will generate an 138 // Pressing return causes the cursor to hide, which will generate an
(...skipping 14 matching lines...) Expand all
152 return; 153 return;
153 #else 154 #else
154 if (event.flags() & ui::EF_IS_SYNTHESIZED) 155 if (event.flags() & ui::EF_IS_SYNTHESIZED)
155 return; 156 return;
156 #endif 157 #endif
157 158
158 if (HitTestPoint(event.location())) 159 if (HitTestPoint(event.location()))
159 SetSelection(event.location()); 160 SetSelection(event.location());
160 else 161 else
161 ClearSelection(); 162 ClearSelection();
163 NotifyAccessibilityEvent(ui::AX_EVENT_MOUSE_MOVED, true);
162 } 164 }
163 165
164 bool AutofillPopupBaseView::OnMousePressed(const ui::MouseEvent& event) { 166 bool AutofillPopupBaseView::OnMousePressed(const ui::MouseEvent& event) {
167 NotifyAccessibilityEvent(ui::AX_EVENT_MOUSE_PRESSED, true);
165 return event.GetClickCount() == 1; 168 return event.GetClickCount() == 1;
166 } 169 }
167 170
168 void AutofillPopupBaseView::OnMouseReleased(const ui::MouseEvent& event) { 171 void AutofillPopupBaseView::OnMouseReleased(const ui::MouseEvent& event) {
172 NotifyAccessibilityEvent(ui::AX_EVENT_MOUSE_RELEASED, true);
169 // We only care about the left click. 173 // We only care about the left click.
170 if (event.IsOnlyLeftMouseButton() && HitTestPoint(event.location())) 174 if (event.IsOnlyLeftMouseButton() && HitTestPoint(event.location()))
171 AcceptSelection(event.location()); 175 AcceptSelection(event.location());
172 } 176 }
173 177
174 void AutofillPopupBaseView::OnGestureEvent(ui::GestureEvent* event) { 178 void AutofillPopupBaseView::OnGestureEvent(ui::GestureEvent* event) {
175 switch (event->type()) { 179 switch (event->type()) {
176 case ui::ET_GESTURE_TAP_DOWN: 180 case ui::ET_GESTURE_TAP_DOWN:
177 case ui::ET_GESTURE_SCROLL_BEGIN: 181 case ui::ET_GESTURE_SCROLL_BEGIN:
178 case ui::ET_GESTURE_SCROLL_UPDATE: 182 case ui::ET_GESTURE_SCROLL_UPDATE:
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
210 if (accelerator.key_code() == ui::VKEY_RETURN) 214 if (accelerator.key_code() == ui::VKEY_RETURN)
211 return delegate_->AcceptSelectedLine(); 215 return delegate_->AcceptSelectedLine();
212 216
213 NOTREACHED(); 217 NOTREACHED();
214 return false; 218 return false;
215 } 219 }
216 220
217 void AutofillPopupBaseView::SetSelection(const gfx::Point& point) { 221 void AutofillPopupBaseView::SetSelection(const gfx::Point& point) {
218 if (delegate_) 222 if (delegate_)
219 delegate_->SetSelectionAtPoint(point); 223 delegate_->SetSelectionAtPoint(point);
224 NotifyAccessibilityEvent(ui::AX_EVENT_SELECTION, true);
dmazzoni 2017/02/06 16:27:11 Normally the SELECTION event should be fired on th
csashi 2017/02/25 02:09:16 Done.
220 } 225 }
221 226
222 void AutofillPopupBaseView::AcceptSelection(const gfx::Point& point) { 227 void AutofillPopupBaseView::AcceptSelection(const gfx::Point& point) {
223 if (!delegate_) 228 if (!delegate_)
224 return; 229 return;
225 230
226 delegate_->SetSelectionAtPoint(point); 231 delegate_->SetSelectionAtPoint(point);
227 delegate_->AcceptSelectedLine(); 232 delegate_->AcceptSelectedLine();
228 } 233 }
229 234
230 void AutofillPopupBaseView::ClearSelection() { 235 void AutofillPopupBaseView::ClearSelection() {
231 if (delegate_) 236 if (delegate_)
232 delegate_->SelectionCleared(); 237 delegate_->SelectionCleared();
238 NotifyAccessibilityEvent(ui::AX_EVENT_SELECTION_REMOVE, true);
233 } 239 }
234 240
235 void AutofillPopupBaseView::HideController() { 241 void AutofillPopupBaseView::HideController() {
236 if (delegate_) 242 if (delegate_)
237 delegate_->Hide(); 243 delegate_->Hide();
238 } 244 }
239 245
240 gfx::NativeView AutofillPopupBaseView::container_view() { 246 gfx::NativeView AutofillPopupBaseView::container_view() {
241 return delegate_->container_view(); 247 return delegate_->container_view();
242 } 248 }
243 249
244 } // namespace autofill 250 } // namespace autofill
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/ui/views/autofill/autofill_popup_view_views.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698