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

Side by Side Diff: ash/common/system/tray_accessibility.cc

Issue 2802783002: List all a11y features in a11y detailed view in ash system menu (Closed)
Patch Set: Address the comments on PS#1 Created 3 years, 8 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 | « ash/common/system/tray_accessibility.h ('k') | ash/metrics/user_metrics_recorder.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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "ash/common/system/tray_accessibility.h" 5 #include "ash/common/system/tray_accessibility.h"
6 6
7 #include "ash/common/accessibility_delegate.h" 7 #include "ash/common/accessibility_delegate.h"
8 #include "ash/common/accessibility_types.h" 8 #include "ash/common/accessibility_types.h"
9 #include "ash/common/session/session_state_delegate.h" 9 #include "ash/common/session/session_state_delegate.h"
10 #include "ash/common/system/tray/hover_highlight_view.h" 10 #include "ash/common/system/tray/hover_highlight_view.h"
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
47 A11Y_HIGH_CONTRAST = 1 << 1, 47 A11Y_HIGH_CONTRAST = 1 << 1,
48 A11Y_SCREEN_MAGNIFIER = 1 << 2, 48 A11Y_SCREEN_MAGNIFIER = 1 << 2,
49 A11Y_LARGE_CURSOR = 1 << 3, 49 A11Y_LARGE_CURSOR = 1 << 3,
50 A11Y_AUTOCLICK = 1 << 4, 50 A11Y_AUTOCLICK = 1 << 4,
51 A11Y_VIRTUAL_KEYBOARD = 1 << 5, 51 A11Y_VIRTUAL_KEYBOARD = 1 << 5,
52 A11Y_BRAILLE_DISPLAY_CONNECTED = 1 << 6, 52 A11Y_BRAILLE_DISPLAY_CONNECTED = 1 << 6,
53 A11Y_MONO_AUDIO = 1 << 7, 53 A11Y_MONO_AUDIO = 1 << 7,
54 A11Y_CARET_HIGHLIGHT = 1 << 8, 54 A11Y_CARET_HIGHLIGHT = 1 << 8,
55 A11Y_HIGHLIGHT_MOUSE_CURSOR = 1 << 9, 55 A11Y_HIGHLIGHT_MOUSE_CURSOR = 1 << 9,
56 A11Y_HIGHLIGHT_KEYBOARD_FOCUS = 1 << 10, 56 A11Y_HIGHLIGHT_KEYBOARD_FOCUS = 1 << 10,
57 A11Y_STICKY_KEYS = 1 << 11,
58 A11Y_TAP_DRAGGING = 1 << 12,
57 }; 59 };
58 60
59 uint32_t GetAccessibilityState() { 61 uint32_t GetAccessibilityState() {
60 AccessibilityDelegate* delegate = Shell::Get()->accessibility_delegate(); 62 AccessibilityDelegate* delegate = Shell::Get()->accessibility_delegate();
61 uint32_t state = A11Y_NONE; 63 uint32_t state = A11Y_NONE;
62 if (delegate->IsSpokenFeedbackEnabled()) 64 if (delegate->IsSpokenFeedbackEnabled())
63 state |= A11Y_SPOKEN_FEEDBACK; 65 state |= A11Y_SPOKEN_FEEDBACK;
64 if (delegate->IsHighContrastEnabled()) 66 if (delegate->IsHighContrastEnabled())
65 state |= A11Y_HIGH_CONTRAST; 67 state |= A11Y_HIGH_CONTRAST;
66 if (delegate->IsMagnifierEnabled()) 68 if (delegate->IsMagnifierEnabled())
67 state |= A11Y_SCREEN_MAGNIFIER; 69 state |= A11Y_SCREEN_MAGNIFIER;
68 if (delegate->IsLargeCursorEnabled()) 70 if (delegate->IsLargeCursorEnabled())
69 state |= A11Y_LARGE_CURSOR; 71 state |= A11Y_LARGE_CURSOR;
70 if (delegate->IsAutoclickEnabled()) 72 if (delegate->IsAutoclickEnabled())
71 state |= A11Y_AUTOCLICK; 73 state |= A11Y_AUTOCLICK;
72 if (delegate->IsVirtualKeyboardEnabled()) 74 if (delegate->IsVirtualKeyboardEnabled())
73 state |= A11Y_VIRTUAL_KEYBOARD; 75 state |= A11Y_VIRTUAL_KEYBOARD;
74 if (delegate->IsBrailleDisplayConnected()) 76 if (delegate->IsBrailleDisplayConnected())
75 state |= A11Y_BRAILLE_DISPLAY_CONNECTED; 77 state |= A11Y_BRAILLE_DISPLAY_CONNECTED;
76 if (delegate->IsMonoAudioEnabled()) 78 if (delegate->IsMonoAudioEnabled())
77 state |= A11Y_MONO_AUDIO; 79 state |= A11Y_MONO_AUDIO;
78 if (delegate->IsCaretHighlightEnabled()) 80 if (delegate->IsCaretHighlightEnabled())
79 state |= A11Y_CARET_HIGHLIGHT; 81 state |= A11Y_CARET_HIGHLIGHT;
80 if (delegate->IsCursorHighlightEnabled()) 82 if (delegate->IsCursorHighlightEnabled())
81 state |= A11Y_HIGHLIGHT_MOUSE_CURSOR; 83 state |= A11Y_HIGHLIGHT_MOUSE_CURSOR;
82 if (delegate->IsFocusHighlightEnabled()) 84 if (delegate->IsFocusHighlightEnabled())
83 state |= A11Y_HIGHLIGHT_KEYBOARD_FOCUS; 85 state |= A11Y_HIGHLIGHT_KEYBOARD_FOCUS;
86 if (delegate->IsStickyKeysEnabled())
87 state |= A11Y_STICKY_KEYS;
88 if (delegate->IsTapDraggingEnabled())
89 state |= A11Y_TAP_DRAGGING;
84 return state; 90 return state;
85 } 91 }
86 92
87 LoginStatus GetCurrentLoginStatus() { 93 LoginStatus GetCurrentLoginStatus() {
88 return Shell::Get()->system_tray_delegate()->GetUserLoginStatus(); 94 return Shell::Get()->system_tray_delegate()->GetUserLoginStatus();
89 } 95 }
90 96
91 void UpdateCheckMark(HoverHighlightView* container, bool checked) { 97 void UpdateCheckMark(HoverHighlightView* container, bool checked) {
92 if (checked) { 98 if (checked) {
93 gfx::ImageSkia check_mark = 99 gfx::ImageSkia check_mark =
(...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after
284 290
285 // Focus highlighting can't be on when spoken feedback is on because 291 // Focus highlighting can't be on when spoken feedback is on because
286 // ChromeVox does its own focus highlighting. 292 // ChromeVox does its own focus highlighting.
287 if (!spoken_feedback_enabled_) { 293 if (!spoken_feedback_enabled_) {
288 highlight_keyboard_focus_enabled_ = delegate->IsFocusHighlightEnabled(); 294 highlight_keyboard_focus_enabled_ = delegate->IsFocusHighlightEnabled();
289 highlight_keyboard_focus_view_ = AddScrollListItemWithoutIcon( 295 highlight_keyboard_focus_view_ = AddScrollListItemWithoutIcon(
290 l10n_util::GetStringUTF16( 296 l10n_util::GetStringUTF16(
291 IDS_ASH_STATUS_TRAY_ACCESSIBILITY_HIGHLIGHT_KEYBOARD_FOCUS), 297 IDS_ASH_STATUS_TRAY_ACCESSIBILITY_HIGHLIGHT_KEYBOARD_FOCUS),
292 highlight_keyboard_focus_enabled_); 298 highlight_keyboard_focus_enabled_);
293 } 299 }
300
301 sticky_keys_enabled_ = delegate->IsStickyKeysEnabled();
302 sticky_keys_view_ = AddScrollListItemWithoutIcon(
303 l10n_util::GetStringUTF16(IDS_ASH_STATUS_TRAY_ACCESSIBILITY_STICKY_KEYS),
304 sticky_keys_enabled_);
305
306 tap_dragging_enabled_ = delegate->IsTapDraggingEnabled();
307 tap_dragging_view_ = AddScrollListItemWithoutIcon(
308 l10n_util::GetStringUTF16(IDS_ASH_STATUS_TRAY_ACCESSIBILITY_TAP_DRAGGING),
309 tap_dragging_enabled_);
294 } 310 }
295 311
296 HoverHighlightView* AccessibilityDetailedView::AddScrollListItem( 312 HoverHighlightView* AccessibilityDetailedView::AddScrollListItem(
297 const base::string16& text, 313 const base::string16& text,
298 bool checked, 314 bool checked,
299 const gfx::VectorIcon& icon) { 315 const gfx::VectorIcon& icon) {
300 HoverHighlightView* container = new HoverHighlightView(this); 316 HoverHighlightView* container = new HoverHighlightView(this);
301 gfx::ImageSkia image = CreateVectorIcon(icon, kMenuIconColor); 317 gfx::ImageSkia image = CreateVectorIcon(icon, kMenuIconColor);
302 container->AddIconAndLabel(image, text); 318 container->AddIconAndLabel(image, text);
303 UpdateCheckMark(container, checked); 319 UpdateCheckMark(container, checked);
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
379 user_action = delegate->IsCursorHighlightEnabled() 395 user_action = delegate->IsCursorHighlightEnabled()
380 ? ash::UMA_STATUS_AREA_DISABLE_HIGHLIGHT_MOUSE_CURSOR 396 ? ash::UMA_STATUS_AREA_DISABLE_HIGHLIGHT_MOUSE_CURSOR
381 : ash::UMA_STATUS_AREA_ENABLE_HIGHLIGHT_MOUSE_CURSOR; 397 : ash::UMA_STATUS_AREA_ENABLE_HIGHLIGHT_MOUSE_CURSOR;
382 delegate->SetCursorHighlightEnabled(!delegate->IsCursorHighlightEnabled()); 398 delegate->SetCursorHighlightEnabled(!delegate->IsCursorHighlightEnabled());
383 } else if (highlight_keyboard_focus_view_ && 399 } else if (highlight_keyboard_focus_view_ &&
384 view == highlight_keyboard_focus_view_) { 400 view == highlight_keyboard_focus_view_) {
385 user_action = delegate->IsFocusHighlightEnabled() 401 user_action = delegate->IsFocusHighlightEnabled()
386 ? ash::UMA_STATUS_AREA_DISABLE_HIGHLIGHT_KEYBOARD_FOCUS 402 ? ash::UMA_STATUS_AREA_DISABLE_HIGHLIGHT_KEYBOARD_FOCUS
387 : ash::UMA_STATUS_AREA_ENABLE_HIGHLIGHT_KEYBOARD_FOCUS; 403 : ash::UMA_STATUS_AREA_ENABLE_HIGHLIGHT_KEYBOARD_FOCUS;
388 delegate->SetFocusHighlightEnabled(!delegate->IsFocusHighlightEnabled()); 404 delegate->SetFocusHighlightEnabled(!delegate->IsFocusHighlightEnabled());
405 } else if (sticky_keys_view_ && view == sticky_keys_view_) {
406 user_action = delegate->IsStickyKeysEnabled()
407 ? ash::UMA_STATUS_AREA_DISABLE_STICKY_KEYS
408 : ash::UMA_STATUS_AREA_ENABLE_STICKY_KEYS;
409 delegate->SetStickyKeysEnabled(!delegate->IsStickyKeysEnabled());
410 } else if (tap_dragging_view_ && view == tap_dragging_view_) {
411 user_action = delegate->IsTapDraggingEnabled()
412 ? ash::UMA_STATUS_AREA_DISABLE_TAP_DRAGGING
413 : ash::UMA_STATUS_AREA_ENABLE_TAP_DRAGGING;
414 delegate->SetTapDraggingEnabled(!delegate->IsTapDraggingEnabled());
389 } else { 415 } else {
390 return; 416 return;
391 } 417 }
392 WmShell::Get()->RecordUserMetricsAction(user_action); 418 WmShell::Get()->RecordUserMetricsAction(user_action);
393 } 419 }
394 420
395 void AccessibilityDetailedView::HandleButtonPressed(views::Button* sender, 421 void AccessibilityDetailedView::HandleButtonPressed(views::Button* sender,
396 const ui::Event& event) { 422 const ui::Event& event) {
397 if (sender == help_view_) 423 if (sender == help_view_)
398 ShowHelp(); 424 ShowHelp();
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after
550 if (detailed_popup_) 576 if (detailed_popup_)
551 detailed_popup_->GetWidget()->Close(); 577 detailed_popup_->GetWidget()->Close();
552 if (detailed_menu_) 578 if (detailed_menu_)
553 detailed_menu_->GetWidget()->Close(); 579 detailed_menu_->GetWidget()->Close();
554 } 580 }
555 581
556 previous_accessibility_state_ = accessibility_state; 582 previous_accessibility_state_ = accessibility_state;
557 } 583 }
558 584
559 } // namespace ash 585 } // namespace ash
OLDNEW
« no previous file with comments | « ash/common/system/tray_accessibility.h ('k') | ash/metrics/user_metrics_recorder.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698